Skip to content

Commit 04c3bb3

Browse files
committed
EasyShell v2.0 prototype
- complete rewrite of plugin with EPL license #35 - [v2.0] new license: EPL - added table view to support adding, removing and change order of commands - new name space "de.anbos.eclipse.easyshell" Addressed enhancement requests: #9 - Editable / custom commands #11 - Change argument names #12 - Change order menue entries #14 - ability to select which of the 4 options to be visible #17 - add linux 'nemo' file browser #21 - add Xfce4 Terminal to linux presets #23 - add linux 'thunar' file browser #31 - add support of eclipse variables Bug fixes: #4 - "cd" cannot be used/called like a stand-alone program in configurations under #6 - gnome-terminal: change to working directory does not work in LMDE 201403 #29 - EasyShell v1.4.2 cannot be installed in Eclipse Neon(4.6.0M5) #30 - Compatibility Issue with Neon-M7 #45 - EasyShell not compatible with new Eclipse Neon Signed-off-by: Andre Bossert <anb0s@anbos.de>
1 parent 78787bc commit 04c3bb3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2926
-204
lines changed

plugin/META-INF/MANIFEST.MF

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Bundle-Activator: de.anbos.eclipse.easyshell.plugin.Activator
77
Bundle-Vendor: Andre Bossert
88
Require-Bundle: org.eclipse.ui,
99
org.eclipse.core.runtime,
10-
org.eclipse.core.resources
10+
org.eclipse.core.resources,
11+
org.eclipse.core.expressions,
12+
org.eclipse.core.variables
1113
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
1214
Bundle-ActivationPolicy: lazy
1315
Bundle-ClassPath: target/easyshell-library.jar

plugin/build.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ bin.includes = icons/,\
33
releases/README.TXT,\
44
releases/CHANGES.TXT,\
55
META-INF/,\
6-
target/easyshell-library.jar
6+
target/easyshell-library.jar,\
7+
src/de/anbos/eclipse/easyshell/plugin/UIMessages.properties
78
src.includes = icons/,\
89
manpages/,\
910
releases/CHANGES.TXT,\

plugin/icons/console_view.gif

582 Bytes
Loading

plugin/icons/copy.gif

-469 Bytes
Loading

plugin/icons/copy_edit.gif

594 Bytes
Loading

plugin/icons/cpyqual_menu.gif

378 Bytes
Loading

plugin/icons/easyshell.gif

891 Bytes
Loading

plugin/icons/editor.gif

932 Bytes
Loading

plugin/icons/editor_area.gif

219 Bytes
Loading

plugin/icons/environment_obj.gif

615 Bytes
Loading
214 Bytes
Loading

plugin/icons/fldr_obj.gif

216 Bytes
Loading

plugin/icons/run_exc.gif

379 Bytes
Loading

plugin/plugin.xml

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,94 +5,90 @@
55
<extension
66
point="org.eclipse.ui.commands">
77
<category
8-
name="Sample Category"
8+
name="EasyShell"
99
id="de.anbos.eclipse.easyshell.plugin.commands.category">
1010
</category>
1111
<command
12-
name="Sample Command"
12+
name="EasyShell Execute"
1313
categoryId="de.anbos.eclipse.easyshell.plugin.commands.category"
14-
id="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand">
14+
id="de.anbos.eclipse.easyshell.plugin.commands.execute">
15+
<commandParameter
16+
id="de.anbos.eclipse.easyshell.plugin.commands.parameter.type"
17+
name="type"
18+
optional="false">
19+
</commandParameter>
20+
<commandParameter
21+
id="de.anbos.eclipse.easyshell.plugin.commands.parameter.value"
22+
name="value"
23+
optional="false">
24+
</commandParameter>
1525
</command>
1626
</extension>
1727
<extension
1828
point="org.eclipse.ui.handlers">
1929
<handler
20-
commandId="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand"
21-
class="de.anbos.eclipse.easyshell.plugin.handlers.SampleHandler">
30+
class="de.anbos.eclipse.easyshell.plugin.handlers.CommandHandler"
31+
commandId="de.anbos.eclipse.easyshell.plugin.commands.execute">
2232
</handler>
2333
</extension>
24-
<extension
25-
point="org.eclipse.ui.bindings">
26-
<key
27-
commandId="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand"
28-
contextId="org.eclipse.ui.contexts.window"
29-
sequence="M1+6"
30-
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
31-
</key>
32-
</extension>
3334
<extension
3435
point="org.eclipse.ui.menus">
3536
<menuContribution
36-
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
37+
locationURI="popup:org.eclipse.ui.popup.any?after=group.open">
3738
<menu
38-
label="Sample Menu"
39-
mnemonic="M"
40-
id="de.anbos.eclipse.easyshell.plugin.menus.sampleMenu">
41-
<command
42-
commandId="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand"
43-
mnemonic="S"
44-
id="de.anbos.eclipse.easyshell.plugin.menus.sampleCommand">
45-
</command>
39+
icon="icons/easyshell.gif"
40+
id="de.anbos.eclipse.easyshell.plugin.menu"
41+
label="EasyShell">
42+
<visibleWhen
43+
checkEnabled="false">
44+
<with
45+
variable="activePart">
46+
<test
47+
forcePluginActivation="true"
48+
property="de.anbos.eclipse.easyshell.plugin.EditorPropertyTester.hasResourceSelection">
49+
</test>
50+
</with>
51+
</visibleWhen>
4652
</menu>
4753
</menuContribution>
4854
<menuContribution
49-
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
50-
<toolbar
51-
id="de.anbos.eclipse.easyshell.plugin.toolbars.sampleToolbar">
52-
<command
53-
commandId="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand"
54-
icon="icons/sample.gif"
55-
tooltip="Say hello world"
56-
id="de.anbos.eclipse.easyshell.plugin.toolbars.sampleCommand">
57-
</command>
58-
</toolbar>
55+
allPopups="true"
56+
class="de.anbos.eclipse.easyshell.plugin.commands.DefineCommands"
57+
locationURI="popup:de.anbos.eclipse.easyshell.plugin.menu">
5958
</menuContribution>
6059
</extension>
61-
<extension
62-
point="org.eclipse.ui.popupMenus">
63-
<objectContribution
64-
objectClass="org.eclipse.core.resources.IFile"
65-
id="de.anbos.eclipse.easyshell.plugin.contribution1">
66-
<menu
67-
label="New Submenu"
68-
path="additions"
69-
id="de.anbos.eclipse.easyshell.plugin.menu1">
70-
<separator
71-
name="group1">
72-
</separator>
73-
</menu>
74-
<action
75-
label="New Action"
76-
class="de.anbos.eclipse.easyshell.plugin.popup.actions.NewAction"
77-
menubarPath="de.anbos.eclipse.easyshell.plugin.menu1/group1"
78-
enablesFor="multiple"
79-
id="de.anbos.eclipse.easyshell.plugin.newAction">
80-
</action>
81-
</objectContribution>
82-
</extension>
8360
<extension
8461
point="org.eclipse.ui.preferencePages">
8562
<page
86-
name="Sample Preferences"
87-
class="de.anbos.eclipse.easyshell.plugin.preferences.SamplePreferencePage"
88-
id="de.anbos.eclipse.easyshell.plugin.preferences.SamplePreferencePage">
63+
class="de.anbos.eclipse.easyshell.plugin.preferences.PresetsPage"
64+
id="de.anbos.eclipse.easyshell.plugin.preferences.PresetsPage"
65+
name="EasyShell">
8966
</page>
9067
</extension>
9168
<extension
9269
point="org.eclipse.core.runtime.preferences">
9370
<initializer
94-
class="de.anbos.eclipse.easyshell.plugin.preferences.PreferenceInitializer">
71+
class="de.anbos.eclipse.easyshell.plugin.preferences.Initializer">
9572
</initializer>
9673
</extension>
74+
<extension
75+
point="org.eclipse.core.expressions.propertyTesters">
76+
<propertyTester
77+
class="de.anbos.eclipse.easyshell.plugin.EditorPropertyTester"
78+
id="de.anbos.eclipse.easyshell.plugin.EditorPropertyTester"
79+
namespace="de.anbos.eclipse.easyshell.plugin.EditorPropertyTester"
80+
properties="hasResourceSelection"
81+
type="org.eclipse.ui.IWorkbenchPart">
82+
</propertyTester>
83+
</extension>
84+
<extension
85+
point="org.eclipse.core.variables.dynamicVariables">
86+
<variable
87+
description="EasyShell Variables"
88+
name="easyshell"
89+
resolver="de.anbos.eclipse.easyshell.plugin.DynamicVariableResolver"
90+
supportsArgument="true">
91+
</variable>
92+
</extension>
9793

9894
</plugin>

plugin/src/de/anbos/eclipse/easyshell/plugin/Activator.java

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2015 Andre Bossert.
2+
* Copyright (c) 2014 - 2016 Andre Bossert.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -11,21 +11,34 @@
1111

1212
package de.anbos.eclipse.easyshell.plugin;
1313

14+
import java.net.URL;
15+
import java.text.MessageFormat;
16+
import java.util.MissingResourceException;
17+
import java.util.ResourceBundle;
18+
19+
import org.eclipse.core.runtime.FileLocator;
20+
import org.eclipse.core.runtime.IPath;
21+
import org.eclipse.core.runtime.Path;
22+
import org.eclipse.core.runtime.Platform;
1423
import org.eclipse.jface.resource.ImageDescriptor;
24+
import org.eclipse.jface.resource.ImageRegistry;
1525
import org.eclipse.ui.plugin.AbstractUIPlugin;
26+
import org.osgi.framework.Bundle;
1627
import org.osgi.framework.BundleContext;
1728

29+
import de.anbos.eclipse.easyshell.plugin.preferences.Constants;
30+
1831
/**
1932
* The activator class controls the plug-in life cycle
2033
*/
2134
public class Activator extends AbstractUIPlugin {
2235

23-
// The plug-in ID
24-
public static final String PLUGIN_ID = "de.anbos.eclipse.easyshell.plugin"; //$NON-NLS-1$
25-
2636
// The shared instance
2737
private static Activator plugin;
2838

39+
//Resource bundle.
40+
private ResourceBundle resourceBundle;
41+
2942
/**
3043
* The constructor
3144
*/
@@ -39,6 +52,13 @@ public Activator() {
3952
public void start(BundleContext context) throws Exception {
4053
super.start(context);
4154
plugin = this;
55+
try {
56+
//resourceBundle = Platform.getResourceBundle(context.getBundle());
57+
resourceBundle = ResourceBundle.getBundle(Constants.PLUGIN_ID + ".UIMessages"); //$NON-NLS-1$
58+
} catch (MissingResourceException x) {
59+
resourceBundle = null;
60+
}
61+
getImageRegistry();
4262
}
4363

4464
/*
@@ -66,7 +86,44 @@ public static Activator getDefault() {
6686
* @param path the path
6787
* @return the image descriptor
6888
*/
89+
/*
6990
public static ImageDescriptor getImageDescriptor(String path) {
70-
return imageDescriptorFromPlugin(PLUGIN_ID, path);
91+
return imageDescriptorFromPlugin(Constants.PLUGIN_ID, path);
7192
}
93+
*/
94+
public static ImageDescriptor getImageDescriptor(String id) {
95+
return getDefault().getImageRegistry().getDescriptor(id);
96+
}
97+
protected void initializeImageRegistry(ImageRegistry registry) {
98+
Bundle bundle = Platform.getBundle(Constants.PLUGIN_ID);
99+
addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_OPEN, Constants.IMAGE_OPEN);
100+
addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_RUN, Constants.IMAGE_RUN);
101+
addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_EXPLORE, Constants.IMAGE_EXPLORE);
102+
addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_CLIPBOARD, Constants.IMAGE_CLIPBOARD);
103+
}
104+
105+
protected void addImageToRegistry(ImageRegistry registry, Bundle bundle, String imagePath, String image_id) {
106+
IPath path = new Path(imagePath);
107+
URL url = FileLocator.find(bundle, path, null);
108+
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
109+
registry.put(image_id, desc);
110+
}
111+
112+
public ResourceBundle getResourceBundle() {
113+
return resourceBundle;
114+
}
115+
116+
public static String getResourceString(String key) {
117+
ResourceBundle bundle = Activator.getDefault().getResourceBundle();
118+
try {
119+
return (bundle != null) ? bundle.getString(key) : key;
120+
} catch (MissingResourceException e) {
121+
return key;
122+
}
123+
}
124+
125+
public static String getResourceString(String key, Object[] args) {
126+
return MessageFormat.format(getResourceString(key),args);
127+
}
128+
72129
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2014 - 2016 Andre Bossert.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Andre Bossert - initial API and implementation and/or initial documentation
10+
*******************************************************************************/
11+
12+
package de.anbos.eclipse.easyshell.plugin;
13+
14+
import org.eclipse.core.runtime.CoreException;
15+
import org.eclipse.core.variables.IDynamicVariable;
16+
import org.eclipse.core.variables.IDynamicVariableResolver;
17+
18+
public class DynamicVariableResolver implements IDynamicVariableResolver {
19+
20+
private static String[] args = new String[6];
21+
22+
@Override
23+
public String resolveValue(IDynamicVariable variable, String argument)
24+
throws CoreException {
25+
if (variable.getName().equals("easyshell")) {
26+
if (argument.equals("drive")) {
27+
return args[0];
28+
} else if (argument.equals("container_loc")) {
29+
return args[1];
30+
} else if (argument.equals("resource_loc")) {
31+
return args[2];
32+
} else if (argument.equals("resource_name")) {
33+
return args[3];
34+
} else if (argument.equals("project_name")) {
35+
return args[4];
36+
} else if (argument.equals("line_separator")) {
37+
return args[5];
38+
}
39+
}
40+
return null;
41+
}
42+
43+
public String[] getArgs() {
44+
return args;
45+
}
46+
47+
public static void setArgs(String[] args) {
48+
DynamicVariableResolver.args = args;
49+
}
50+
51+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2014 - 2016 Andre Bossert.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Andre Bossert - initial API and implementation and/or initial documentation
10+
*******************************************************************************/
11+
12+
package de.anbos.eclipse.easyshell.plugin;
13+
14+
import org.eclipse.core.expressions.PropertyTester;
15+
import org.eclipse.jface.viewers.ISelection;
16+
import org.eclipse.ui.IWorkbenchPart;
17+
18+
import de.anbos.eclipse.easyshell.plugin.actions.ActionDelegate;
19+
20+
public class EditorPropertyTester extends PropertyTester {
21+
22+
public EditorPropertyTester() {
23+
super();
24+
}
25+
26+
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
27+
if("hasResourceSelection".equals(property) && receiver instanceof IWorkbenchPart){
28+
return hasResourceSelection((IWorkbenchPart)receiver) != null;
29+
}
30+
return false;
31+
}
32+
33+
static public ActionDelegate hasResourceSelection(IWorkbenchPart part) {
34+
ISelection selection = ResourceUtils.getResourceSelection(part);
35+
if (selection != null) {
36+
ActionDelegate action = new ActionDelegate();
37+
action.selectionChanged(null, selection);
38+
if (action.isEnabled())
39+
return action;
40+
}
41+
return null;
42+
}
43+
44+
}

0 commit comments

Comments
 (0)