Révision 624
tmp/org.txm.groovy.rcp/contexts.xml (revision 624) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<contexts> |
|
3 |
<context id="viewer" title="Sample View"> |
|
4 |
<description>This is the context help for the sample view with a table viewer. It was generated by a PDE template.</description> |
|
5 |
<topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help"> |
|
6 |
<enablement> |
|
7 |
<with variable="platform"> |
|
8 |
<test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/> |
|
9 |
</with> |
|
10 |
</enablement> |
|
11 |
</topic> |
|
12 |
</context> |
|
13 |
</contexts> |
|
0 | 14 |
tmp/org.txm.groovy.rcp/src/org/txm/groovy/rcp/Activator.java (revision 624) | ||
---|---|---|
1 |
package org.txm.groovy.rcp; |
|
2 |
|
|
3 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
4 |
import org.osgi.framework.BundleContext; |
|
5 |
|
|
6 |
public class Activator extends AbstractUIPlugin { |
|
7 |
|
|
8 |
public Activator() { |
|
9 |
// TODO Auto-generated constructor stub |
|
10 |
} |
|
11 |
|
|
12 |
@Override |
|
13 |
public void start(BundleContext context) throws Exception { |
|
14 |
super.start(context); |
|
15 |
|
|
16 |
System.out.println("DISABLE CONTRIBUTIONS"); |
|
17 |
} |
|
18 |
} |
|
0 | 19 |
tmp/org.txm.groovy.rcp/src/org/txm/groovy/rcp/views/SampleView.java (revision 624) | ||
---|---|---|
1 |
package org.txm.groovy.rcp.views; |
|
2 |
|
|
3 |
|
|
4 |
import org.eclipse.swt.widgets.Composite; |
|
5 |
import org.eclipse.ui.part.*; |
|
6 |
import org.eclipse.jface.viewers.*; |
|
7 |
import org.eclipse.swt.graphics.Image; |
|
8 |
import org.eclipse.jface.action.*; |
|
9 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
10 |
import org.eclipse.ui.*; |
|
11 |
import org.eclipse.swt.widgets.Menu; |
|
12 |
import org.eclipse.swt.SWT; |
|
13 |
|
|
14 |
|
|
15 |
/** |
|
16 |
* This sample class demonstrates how to plug-in a new |
|
17 |
* workbench view. The view shows data obtained from the |
|
18 |
* model. The sample creates a dummy model on the fly, |
|
19 |
* but a real implementation would connect to the model |
|
20 |
* available either in this or another plug-in (e.g. the workspace). |
|
21 |
* The view is connected to the model using a content provider. |
|
22 |
* <p> |
|
23 |
* The view uses a label provider to define how model |
|
24 |
* objects should be presented in the view. Each |
|
25 |
* view can present the same model objects using |
|
26 |
* different labels and icons, if needed. Alternatively, |
|
27 |
* a single label provider can be shared between views |
|
28 |
* in order to ensure that objects of the same type are |
|
29 |
* presented in the same way everywhere. |
|
30 |
* <p> |
|
31 |
*/ |
|
32 |
|
|
33 |
public class SampleView extends ViewPart { |
|
34 |
|
|
35 |
/** |
|
36 |
* The ID of the view as specified by the extension. |
|
37 |
*/ |
|
38 |
public static final String ID = "org.txm.groovy.rcp.views.SampleView"; |
|
39 |
|
|
40 |
private TableViewer viewer; |
|
41 |
private Action action1; |
|
42 |
private Action action2; |
|
43 |
private Action doubleClickAction; |
|
44 |
|
|
45 |
/* |
|
46 |
* The content provider class is responsible for |
|
47 |
* providing objects to the view. It can wrap |
|
48 |
* existing objects in adapters or simply return |
|
49 |
* objects as-is. These objects may be sensitive |
|
50 |
* to the current input of the view, or ignore |
|
51 |
* it and always show the same content |
|
52 |
* (like Task List, for example). |
|
53 |
*/ |
|
54 |
|
|
55 |
class ViewContentProvider implements IStructuredContentProvider { |
|
56 |
public void inputChanged(Viewer v, Object oldInput, Object newInput) { |
|
57 |
} |
|
58 |
public void dispose() { |
|
59 |
} |
|
60 |
public Object[] getElements(Object parent) { |
|
61 |
return new String[] { "One", "Two", "Three" }; |
|
62 |
} |
|
63 |
} |
|
64 |
class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { |
|
65 |
public String getColumnText(Object obj, int index) { |
|
66 |
return getText(obj); |
|
67 |
} |
|
68 |
public Image getColumnImage(Object obj, int index) { |
|
69 |
return getImage(obj); |
|
70 |
} |
|
71 |
public Image getImage(Object obj) { |
|
72 |
return PlatformUI.getWorkbench(). |
|
73 |
getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); |
|
74 |
} |
|
75 |
} |
|
76 |
class NameSorter extends ViewerSorter { |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* The constructor. |
|
81 |
*/ |
|
82 |
public SampleView() { |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* This is a callback that will allow us |
|
87 |
* to create the viewer and initialize it. |
|
88 |
*/ |
|
89 |
public void createPartControl(Composite parent) { |
|
90 |
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); |
|
91 |
viewer.setContentProvider(new ViewContentProvider()); |
|
92 |
viewer.setLabelProvider(new ViewLabelProvider()); |
|
93 |
viewer.setSorter(new NameSorter()); |
|
94 |
viewer.setInput(getViewSite()); |
|
95 |
|
|
96 |
// Create the help context id for the viewer's control |
|
97 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.txm.groovy.rcp.viewer"); |
|
98 |
makeActions(); |
|
99 |
hookContextMenu(); |
|
100 |
hookDoubleClickAction(); |
|
101 |
contributeToActionBars(); |
|
102 |
} |
|
103 |
|
|
104 |
private void hookContextMenu() { |
|
105 |
MenuManager menuMgr = new MenuManager("#PopupMenu"); |
|
106 |
menuMgr.setRemoveAllWhenShown(true); |
|
107 |
menuMgr.addMenuListener(new IMenuListener() { |
|
108 |
public void menuAboutToShow(IMenuManager manager) { |
|
109 |
SampleView.this.fillContextMenu(manager); |
|
110 |
} |
|
111 |
}); |
|
112 |
Menu menu = menuMgr.createContextMenu(viewer.getControl()); |
|
113 |
viewer.getControl().setMenu(menu); |
|
114 |
getSite().registerContextMenu(menuMgr, viewer); |
|
115 |
} |
|
116 |
|
|
117 |
private void contributeToActionBars() { |
|
118 |
IActionBars bars = getViewSite().getActionBars(); |
|
119 |
fillLocalPullDown(bars.getMenuManager()); |
|
120 |
fillLocalToolBar(bars.getToolBarManager()); |
|
121 |
} |
|
122 |
|
|
123 |
private void fillLocalPullDown(IMenuManager manager) { |
|
124 |
manager.add(action1); |
|
125 |
manager.add(new Separator()); |
|
126 |
manager.add(action2); |
|
127 |
} |
|
128 |
|
|
129 |
private void fillContextMenu(IMenuManager manager) { |
|
130 |
manager.add(action1); |
|
131 |
manager.add(action2); |
|
132 |
// Other plug-ins can contribute there actions here |
|
133 |
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); |
|
134 |
} |
|
135 |
|
|
136 |
private void fillLocalToolBar(IToolBarManager manager) { |
|
137 |
manager.add(action1); |
|
138 |
manager.add(action2); |
|
139 |
} |
|
140 |
|
|
141 |
private void makeActions() { |
|
142 |
action1 = new Action() { |
|
143 |
public void run() { |
|
144 |
showMessage("Action 1 executed"); |
|
145 |
} |
|
146 |
}; |
|
147 |
action1.setText("Action 1"); |
|
148 |
action1.setToolTipText("Action 1 tooltip"); |
|
149 |
action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages(). |
|
150 |
getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); |
|
151 |
|
|
152 |
action2 = new Action() { |
|
153 |
public void run() { |
|
154 |
showMessage("Action 2 executed"); |
|
155 |
} |
|
156 |
}; |
|
157 |
action2.setText("Action 2"); |
|
158 |
action2.setToolTipText("Action 2 tooltip"); |
|
159 |
action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages(). |
|
160 |
getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); |
|
161 |
doubleClickAction = new Action() { |
|
162 |
public void run() { |
|
163 |
ISelection selection = viewer.getSelection(); |
|
164 |
Object obj = ((IStructuredSelection)selection).getFirstElement(); |
|
165 |
showMessage("Double-click detected on "+obj.toString()); |
|
166 |
} |
|
167 |
}; |
|
168 |
} |
|
169 |
|
|
170 |
private void hookDoubleClickAction() { |
|
171 |
viewer.addDoubleClickListener(new IDoubleClickListener() { |
|
172 |
public void doubleClick(DoubleClickEvent event) { |
|
173 |
doubleClickAction.run(); |
|
174 |
} |
|
175 |
}); |
|
176 |
} |
|
177 |
private void showMessage(String message) { |
|
178 |
MessageDialog.openInformation( |
|
179 |
viewer.getControl().getShell(), |
|
180 |
"Sample View", |
|
181 |
message); |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* Passing the focus request to the viewer's control. |
|
186 |
*/ |
|
187 |
public void setFocus() { |
|
188 |
viewer.getControl().setFocus(); |
|
189 |
} |
|
190 |
} |
|
0 | 191 |
tmp/org.txm.groovy.rcp/build.properties (revision 624) | ||
---|---|---|
1 |
source.. = src/ |
|
2 |
output.. = bin/ |
|
3 |
bin.includes = plugin.xml,\ |
|
4 |
META-INF/,\ |
|
5 |
.,\ |
|
6 |
icons/,\ |
|
7 |
contexts.xml |
|
0 | 8 |
tmp/org.txm.groovy.rcp/plugin.xml (revision 624) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<?eclipse version="3.4"?> |
|
3 |
<plugin> |
|
4 |
|
|
5 |
<extension |
|
6 |
point="org.eclipse.ui.views"> |
|
7 |
<category |
|
8 |
name="Sample Category" |
|
9 |
id="org.txm.groovy.rcp"> |
|
10 |
</category> |
|
11 |
<view |
|
12 |
name="Sample View" |
|
13 |
icon="icons/sample.gif" |
|
14 |
category="org.txm.groovy.rcp" |
|
15 |
class="org.txm.groovy.rcp.views.SampleView" |
|
16 |
id="org.txm.groovy.rcp.views.SampleView"> |
|
17 |
</view> |
|
18 |
</extension> |
|
19 |
<extension |
|
20 |
point="org.eclipse.ui.perspectiveExtensions"> |
|
21 |
<perspectiveExtension |
|
22 |
targetID="org.eclipse.jdt.ui.JavaPerspective"> |
|
23 |
<view |
|
24 |
ratio="0.5" |
|
25 |
relative="org.eclipse.ui.views.ProblemView" |
|
26 |
relationship="right" |
|
27 |
id="org.txm.groovy.rcp.views.SampleView"> |
|
28 |
</view> |
|
29 |
</perspectiveExtension> |
|
30 |
</extension> |
|
31 |
<extension |
|
32 |
point="org.eclipse.help.contexts"> |
|
33 |
<contexts |
|
34 |
file="contexts.xml"> |
|
35 |
</contexts> |
|
36 |
</extension> |
|
37 |
|
|
38 |
</plugin> |
|
0 | 39 |
tmp/org.txm.groovy.rcp/.settings/org.eclipse.jdt.core.prefs (revision 624) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
|
3 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 |
|
4 |
org.eclipse.jdt.core.compiler.compliance=1.6 |
|
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.6 |
|
0 | 8 |
tmp/org.txm.groovy.rcp/.classpath (revision 624) | ||
---|---|---|
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.6"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> |
|
5 |
<classpathentry kind="src" path="src"/> |
|
6 |
<classpathentry kind="output" path="bin"/> |
|
7 |
</classpath> |
|
0 | 8 |
tmp/org.txm.groovy.rcp/META-INF/MANIFEST.MF (revision 624) | ||
---|---|---|
1 |
Manifest-Version: 1.0 |
|
2 |
Bundle-ManifestVersion: 2 |
|
3 |
Bundle-Name: Rcp |
|
4 |
Bundle-SymbolicName: org.txm.groovy.rcp;singleton:=true |
|
5 |
Bundle-Version: 1.0.0.qualifier |
|
6 |
Bundle-Vendor: Textometry.org |
|
7 |
Require-Bundle: org.eclipse.core.runtime, |
|
8 |
org.eclipse.ui, |
|
9 |
org.txm.groovy.core;bundle-version="1.0.0", |
|
10 |
org.codehaus.groovy.eclipse.ui;bundle-version="2.9.1" |
|
11 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
|
12 |
Bundle-Activator: org.txm.groovy.rcp.Activator |
|
0 | 13 |
tmp/org.txm.groovy.rcp/.project (revision 624) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.txm.groovy.rcp</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> |
|
0 | 29 |
Formats disponibles : Unified diff