Skip to content

Commit

Permalink
EasyShell v2.0 prototype
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
anb0s committed Jul 5, 2016
1 parent 78787bc commit 04c3bb3
Show file tree
Hide file tree
Showing 45 changed files with 2,926 additions and 204 deletions.
4 changes: 3 additions & 1 deletion plugin/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Bundle-Activator: de.anbos.eclipse.easyshell.plugin.Activator
Bundle-Vendor: Andre Bossert
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources
org.eclipse.core.resources,
org.eclipse.core.expressions,
org.eclipse.core.variables
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: target/easyshell-library.jar
3 changes: 2 additions & 1 deletion plugin/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ bin.includes = icons/,\
releases/README.TXT,\
releases/CHANGES.TXT,\
META-INF/,\
target/easyshell-library.jar
target/easyshell-library.jar,\
src/de/anbos/eclipse/easyshell/plugin/UIMessages.properties
src.includes = icons/,\
manpages/,\
releases/CHANGES.TXT,\
Expand Down
Binary file added plugin/icons/console_view.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified plugin/icons/copy.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/copy_edit.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/cpyqual_menu.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/easyshell.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/editor.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/editor_area.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/environment_obj.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/exclusion_filter_attrib.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/fldr_obj.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/icons/run_exc.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 55 additions & 59 deletions plugin/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,94 +5,90 @@
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
name="EasyShell"
id="de.anbos.eclipse.easyshell.plugin.commands.category">
</category>
<command
name="Sample Command"
name="EasyShell Execute"
categoryId="de.anbos.eclipse.easyshell.plugin.commands.category"
id="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand">
id="de.anbos.eclipse.easyshell.plugin.commands.execute">
<commandParameter
id="de.anbos.eclipse.easyshell.plugin.commands.parameter.type"
name="type"
optional="false">
</commandParameter>
<commandParameter
id="de.anbos.eclipse.easyshell.plugin.commands.parameter.value"
name="value"
optional="false">
</commandParameter>
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand"
class="de.anbos.eclipse.easyshell.plugin.handlers.SampleHandler">
class="de.anbos.eclipse.easyshell.plugin.handlers.CommandHandler"
commandId="de.anbos.eclipse.easyshell.plugin.commands.execute">
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
locationURI="popup:org.eclipse.ui.popup.any?after=group.open">
<menu
label="Sample Menu"
mnemonic="M"
id="de.anbos.eclipse.easyshell.plugin.menus.sampleMenu">
<command
commandId="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand"
mnemonic="S"
id="de.anbos.eclipse.easyshell.plugin.menus.sampleCommand">
</command>
icon="icons/easyshell.gif"
id="de.anbos.eclipse.easyshell.plugin.menu"
label="EasyShell">
<visibleWhen
checkEnabled="false">
<with
variable="activePart">
<test
forcePluginActivation="true"
property="de.anbos.eclipse.easyshell.plugin.EditorPropertyTester.hasResourceSelection">
</test>
</with>
</visibleWhen>
</menu>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
<toolbar
id="de.anbos.eclipse.easyshell.plugin.toolbars.sampleToolbar">
<command
commandId="de.anbos.eclipse.easyshell.plugin.commands.sampleCommand"
icon="icons/sample.gif"
tooltip="Say hello world"
id="de.anbos.eclipse.easyshell.plugin.toolbars.sampleCommand">
</command>
</toolbar>
allPopups="true"
class="de.anbos.eclipse.easyshell.plugin.commands.DefineCommands"
locationURI="popup:de.anbos.eclipse.easyshell.plugin.menu">
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
id="de.anbos.eclipse.easyshell.plugin.contribution1">
<menu
label="New Submenu"
path="additions"
id="de.anbos.eclipse.easyshell.plugin.menu1">
<separator
name="group1">
</separator>
</menu>
<action
label="New Action"
class="de.anbos.eclipse.easyshell.plugin.popup.actions.NewAction"
menubarPath="de.anbos.eclipse.easyshell.plugin.menu1/group1"
enablesFor="multiple"
id="de.anbos.eclipse.easyshell.plugin.newAction">
</action>
</objectContribution>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
name="Sample Preferences"
class="de.anbos.eclipse.easyshell.plugin.preferences.SamplePreferencePage"
id="de.anbos.eclipse.easyshell.plugin.preferences.SamplePreferencePage">
class="de.anbos.eclipse.easyshell.plugin.preferences.PresetsPage"
id="de.anbos.eclipse.easyshell.plugin.preferences.PresetsPage"
name="EasyShell">
</page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="de.anbos.eclipse.easyshell.plugin.preferences.PreferenceInitializer">
class="de.anbos.eclipse.easyshell.plugin.preferences.Initializer">
</initializer>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="de.anbos.eclipse.easyshell.plugin.EditorPropertyTester"
id="de.anbos.eclipse.easyshell.plugin.EditorPropertyTester"
namespace="de.anbos.eclipse.easyshell.plugin.EditorPropertyTester"
properties="hasResourceSelection"
type="org.eclipse.ui.IWorkbenchPart">
</propertyTester>
</extension>
<extension
point="org.eclipse.core.variables.dynamicVariables">
<variable
description="EasyShell Variables"
name="easyshell"
resolver="de.anbos.eclipse.easyshell.plugin.DynamicVariableResolver"
supportsArgument="true">
</variable>
</extension>

</plugin>
67 changes: 62 additions & 5 deletions plugin/src/de/anbos/eclipse/easyshell/plugin/Activator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015 Andre Bossert.
* Copyright (c) 2014 - 2016 Andre Bossert.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -11,21 +11,34 @@

package de.anbos.eclipse.easyshell.plugin;

import java.net.URL;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;

import de.anbos.eclipse.easyshell.plugin.preferences.Constants;

/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {

// The plug-in ID
public static final String PLUGIN_ID = "de.anbos.eclipse.easyshell.plugin"; //$NON-NLS-1$

// The shared instance
private static Activator plugin;

//Resource bundle.
private ResourceBundle resourceBundle;

/**
* The constructor
*/
Expand All @@ -39,6 +52,13 @@ public Activator() {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
try {
//resourceBundle = Platform.getResourceBundle(context.getBundle());
resourceBundle = ResourceBundle.getBundle(Constants.PLUGIN_ID + ".UIMessages"); //$NON-NLS-1$
} catch (MissingResourceException x) {
resourceBundle = null;
}
getImageRegistry();
}

/*
Expand Down Expand Up @@ -66,7 +86,44 @@ public static Activator getDefault() {
* @param path the path
* @return the image descriptor
*/
/*
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
return imageDescriptorFromPlugin(Constants.PLUGIN_ID, path);
}
*/
public static ImageDescriptor getImageDescriptor(String id) {
return getDefault().getImageRegistry().getDescriptor(id);
}
protected void initializeImageRegistry(ImageRegistry registry) {
Bundle bundle = Platform.getBundle(Constants.PLUGIN_ID);
addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_OPEN, Constants.IMAGE_OPEN);
addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_RUN, Constants.IMAGE_RUN);
addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_EXPLORE, Constants.IMAGE_EXPLORE);
addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_CLIPBOARD, Constants.IMAGE_CLIPBOARD);
}

protected void addImageToRegistry(ImageRegistry registry, Bundle bundle, String imagePath, String image_id) {
IPath path = new Path(imagePath);
URL url = FileLocator.find(bundle, path, null);
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
registry.put(image_id, desc);
}

public ResourceBundle getResourceBundle() {
return resourceBundle;
}

public static String getResourceString(String key) {
ResourceBundle bundle = Activator.getDefault().getResourceBundle();
try {
return (bundle != null) ? bundle.getString(key) : key;
} catch (MissingResourceException e) {
return key;
}
}

public static String getResourceString(String key, Object[] args) {
return MessageFormat.format(getResourceString(key),args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2014 - 2016 Andre Bossert.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andre Bossert - initial API and implementation and/or initial documentation
*******************************************************************************/

package de.anbos.eclipse.easyshell.plugin;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.variables.IDynamicVariable;
import org.eclipse.core.variables.IDynamicVariableResolver;

public class DynamicVariableResolver implements IDynamicVariableResolver {

private static String[] args = new String[6];

@Override
public String resolveValue(IDynamicVariable variable, String argument)
throws CoreException {
if (variable.getName().equals("easyshell")) {
if (argument.equals("drive")) {
return args[0];
} else if (argument.equals("container_loc")) {
return args[1];
} else if (argument.equals("resource_loc")) {
return args[2];
} else if (argument.equals("resource_name")) {
return args[3];
} else if (argument.equals("project_name")) {
return args[4];
} else if (argument.equals("line_separator")) {
return args[5];
}
}
return null;
}

public String[] getArgs() {
return args;
}

public static void setArgs(String[] args) {
DynamicVariableResolver.args = args;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright (c) 2014 - 2016 Andre Bossert.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andre Bossert - initial API and implementation and/or initial documentation
*******************************************************************************/

package de.anbos.eclipse.easyshell.plugin;

import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchPart;

import de.anbos.eclipse.easyshell.plugin.actions.ActionDelegate;

public class EditorPropertyTester extends PropertyTester {

public EditorPropertyTester() {
super();
}

public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if("hasResourceSelection".equals(property) && receiver instanceof IWorkbenchPart){
return hasResourceSelection((IWorkbenchPart)receiver) != null;
}
return false;
}

static public ActionDelegate hasResourceSelection(IWorkbenchPart part) {
ISelection selection = ResourceUtils.getResourceSelection(part);
if (selection != null) {
ActionDelegate action = new ActionDelegate();
action.selectionChanged(null, selection);
if (action.isEnabled())
return action;
}
return null;
}

}
Loading

0 comments on commit 04c3bb3

Please sign in to comment.