Skip to content

Commit 25a8587

Browse files
committed
Adds an example for the deprecated ActionSet to the eclipse example repo
1 parent 7dfd558 commit 25a8587

23 files changed

+744
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>com.vogella.rcp.example.actionset</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.pde.PluginNature</nature>
26+
<nature>org.eclipse.jdt.core.javanature</nature>
27+
</natures>
28+
</projectDescription>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.compliance=1.8
5+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7+
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: Testing
4+
Bundle-SymbolicName: com.vogella.rcp.example.actionset;singleton:=true
5+
Bundle-Version: 1.0.0.qualifier
6+
Require-Bundle: org.eclipse.ui,
7+
org.eclipse.core.runtime,
8+
org.eclipse.jface.text,
9+
org.eclipse.ui.editors
10+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
== Example for the deprecated ActionSet extension point
2+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = plugin.xml,\
4+
META-INF/,\
5+
.,\
6+
icons/
983 Bytes
Loading
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
5+
<extension
6+
point="org.eclipse.ui.commands">
7+
<category
8+
name="Sample Category"
9+
id="testing.commands.category">
10+
</category>
11+
<command
12+
name="Sample Command"
13+
categoryId="testing.commands.category"
14+
id="testing.commands.sampleCommand">
15+
</command>
16+
</extension>
17+
<extension
18+
point="org.eclipse.ui.handlers">
19+
<handler
20+
commandId="testing.commands.sampleCommand"
21+
class="testing.handlers.SampleHandler">
22+
</handler>
23+
</extension>
24+
<extension
25+
point="org.eclipse.ui.bindings">
26+
<key
27+
commandId="testing.commands.sampleCommand"
28+
contextId="org.eclipse.ui.contexts.window"
29+
sequence="M1+6"
30+
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
31+
</key>
32+
</extension>
33+
<extension
34+
point="org.eclipse.ui.menus">
35+
<menuContribution
36+
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
37+
<menu
38+
label="Sample Menu"
39+
mnemonic="M"
40+
id="testing.menus.sampleMenu">
41+
<command
42+
commandId="testing.commands.sampleCommand"
43+
mnemonic="S"
44+
id="testing.menus.sampleCommand">
45+
</command>
46+
</menu>
47+
</menuContribution>
48+
<menuContribution
49+
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
50+
<toolbar
51+
id="testing.toolbars.sampleToolbar">
52+
<command
53+
commandId="testing.commands.sampleCommand"
54+
icon="icons/sample.gif"
55+
tooltip="Say hello world"
56+
id="testing.toolbars.sampleCommand">
57+
</command>
58+
</toolbar>
59+
</menuContribution>
60+
</extension>
61+
<extension
62+
point="org.eclipse.ui.actionSets">
63+
<actionSet
64+
id="testing.actionSet"
65+
label="Sample Action Set"
66+
visible="true">
67+
<menu
68+
id="sampleMenu"
69+
label="Sample &amp;Menu">
70+
<separator
71+
name="sampleGroup">
72+
</separator>
73+
</menu>
74+
<action
75+
class="testing.actions.SampleAction"
76+
icon="icons/sample.gif"
77+
id="testing.actions.SampleAction"
78+
label="&amp;Sample Action"
79+
menubarPath="sampleMenu/sampleGroup"
80+
toolbarPath="sampleGroup"
81+
tooltip="Hello, Eclipse world">
82+
</action>
83+
</actionSet>
84+
</extension>
85+
86+
</plugin>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package testing.actions;
2+
3+
import org.eclipse.jface.action.IAction;
4+
import org.eclipse.jface.viewers.ISelection;
5+
import org.eclipse.ui.IWorkbenchWindow;
6+
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
7+
import org.eclipse.jface.dialogs.MessageDialog;
8+
9+
/**
10+
* Our sample action implements workbench action delegate.
11+
* The action proxy will be created by the workbench and
12+
* shown in the UI. When the user tries to use the action,
13+
* this delegate will be created and execution will be
14+
* delegated to it.
15+
* @see IWorkbenchWindowActionDelegate
16+
*/
17+
public class SampleAction implements IWorkbenchWindowActionDelegate {
18+
private IWorkbenchWindow window;
19+
/**
20+
* The constructor.
21+
*/
22+
public SampleAction() {
23+
}
24+
25+
/**
26+
* The action has been activated. The argument of the
27+
* method represents the 'real' action sitting
28+
* in the workbench UI.
29+
* @see IWorkbenchWindowActionDelegate#run
30+
*/
31+
public void run(IAction action) {
32+
MessageDialog.openInformation(
33+
window.getShell(),
34+
"Testing",
35+
"Hello, Eclipse world");
36+
}
37+
38+
/**
39+
* Selection in the workbench has been changed. We
40+
* can change the state of the 'real' action here
41+
* if we want, but this can only happen after
42+
* the delegate has been created.
43+
* @see IWorkbenchWindowActionDelegate#selectionChanged
44+
*/
45+
public void selectionChanged(IAction action, ISelection selection) {
46+
}
47+
48+
/**
49+
* We can use this method to dispose of any system
50+
* resources we previously allocated.
51+
* @see IWorkbenchWindowActionDelegate#dispose
52+
*/
53+
public void dispose() {
54+
}
55+
56+
/**
57+
* We will cache window object in order to
58+
* be able to provide parent shell for the message dialog.
59+
* @see IWorkbenchWindowActionDelegate#init
60+
*/
61+
public void init(IWorkbenchWindow window) {
62+
this.window = window;
63+
}
64+
}

0 commit comments

Comments
 (0)