Commit 31c7d80d authored by Sebastian Pretscher's avatar Sebastian Pretscher

Initial Plugin Project Commit (Adds a simple button to the UI located in

the upper navigation bar on the left side)
parent 5caf21cc
<?xml version="1.0" encoding="UTF-8"?>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CupPlugin
Bundle-SymbolicName: CupPlugin;singleton:=true
Bundle-Version: 0.0.0.qualifier
Bundle-Activator: cupplugin.Activator
Require-Bundle: org.eclipse.ui,
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
label="Sample Action Set"
label="Sample &amp;Menu"
label="&amp;Sample Action"
tooltip="Hello, Eclipse world"
package cupplugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
* The activator class controls the plug-in life cycle
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "CupPlugin"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
* The constructor
public Activator() {
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
public void start(BundleContext context) throws Exception {
plugin = this;
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
public void stop(BundleContext context) throws Exception {
plugin = null;
* Returns the shared instance
* @return the shared instance
public static Activator getDefault() {
return plugin;
* Returns an image descriptor for the image file at the given
* plug-in relative path
* @param path the path
* @return the image descriptor
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
package cupplugin.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.jface.dialogs.MessageDialog;
* Our sample action implements workbench action delegate.
* The action proxy will be created by the workbench and
* shown in the UI. When the user tries to use the action,
* this delegate will be created and execution will be
* delegated to it.
* @see IWorkbenchWindowActionDelegate
public class SampleAction implements IWorkbenchWindowActionDelegate {
private IWorkbenchWindow window;
* The constructor.
public SampleAction() {
* The action has been activated. The argument of the
* method represents the 'real' action sitting
* in the workbench UI.
* @see IWorkbenchWindowActionDelegate#run
public void run(IAction action) {
"Hello, Eclipse world");
* Selection in the workbench has been changed. We
* can change the state of the 'real' action here
* if we want, but this can only happen after
* the delegate has been created.
* @see IWorkbenchWindowActionDelegate#selectionChanged
public void selectionChanged(IAction action, ISelection selection) {
* We can use this method to dispose of any system
* resources we previously allocated.
* @see IWorkbenchWindowActionDelegate#dispose
public void dispose() {
* We will cache window object in order to
* be able to provide parent shell for the message dialog.
* @see IWorkbenchWindowActionDelegate#init
public void init(IWorkbenchWindow window) {
this.window = window;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment