Révision 3606

TXM/trunk/org.txm.groovy.ide.rcp/plugin.xml (revision 3606)
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="%category.name"
9
            id="org.txm.groovy.ide.rcp">
10
      </category>
11
      <view
12
            name="%view.name"
13
            icon="icons/sample.gif"
14
            category="org.txm.groovy.ide.rcp"
15
            class="org.txm.groovy.ide.rcp.views.SampleView"
16
            id="org.txm.groovy.ide.rcp.views.SampleView">
17
      </view>
18
   </extension>
19
   <extension point="org.eclipse.ui.activities">  
20
   <activity
21
         description="%activity.description"
22
         id="myActivity"
23
         name="%activity.name">  
24
      <enabledWhen>  
25
         <with variable="activePartId">    
26
            <equals value="nonExistentPartId"></equals>      
27
         </with>
28
      </enabledWhen>
29
   </activity>
30
   <activityPatternBinding
31
         activityId="myActivity"
32
         isEqualityPattern="true"
33
         pattern="opengroovyprojectwizard">  
34
   </activityPatternBinding>
35
</extension>  
36
   <extension
37
         point="org.eclipse.ui.perspectiveExtensions">
38
      <perspectiveExtension
39
            targetID="org.eclipse.jdt.ui.JavaPerspective">
40
         <view
41
               ratio="0.5"
42
               relative="org.eclipse.ui.views.ProblemView"
43
               relationship="right"
44
               id="org.txm.groovy.ide.rcp.views.SampleView">
45
         </view>
46
      </perspectiveExtension>
47
   </extension>
48
   <extension
49
         point="org.eclipse.help.contexts">
50
      <contexts
51
            file="contexts.xml">
52
      </contexts>
53
   </extension>
54

  
55
</plugin>
0 56

  
TXM/trunk/org.txm.groovy.ide.rcp/.classpath (revision 3606)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con"
4
		path="org.eclipse.jdt.launching.JRE_CONTAINER" />
5
	<classpathentry kind="con"
6
		path="org.eclipse.pde.core.requiredPlugins" />
7
	<classpathentry kind="src" path="src" />
8
	<classpathentry kind="output" path="bin" />
9
</classpath>
0 10

  
TXM/trunk/org.txm.groovy.ide.rcp/META-INF/MANIFEST.MF (revision 3606)
1
Manifest-Version: 1.0
2
Bundle-SymbolicName: org.txm.groovy.ide.rcp;singleton:=true
3
Export-Package: org.txm.groovy.ide.rcp,
4
 org.txm.groovy.ide.rcp.views
5
Bundle-Version: 1.0.0.qualifier
6
Bundle-Name: %Bundle-Name
7
Require-Bundle: org.eclipse.core.runtime;visibility:=reexport,org.ecli
8
 pse.ui;visibility:=reexport,org.txm.groovy.core;bundle-version="1.0.0
9
 ";visibility:=reexport,org.codehaus.groovy.eclipse.ui;bundle-version=
10
 "2.9.1";visibility:=reexport
11
Bundle-ManifestVersion: 2
12
Bundle-Activator: org.txm.groovy.ide.rcp.Activator
13
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
14
Bundle-Vendor: Textometry.org
15
Automatic-Module-Name: org.txm.groovy.rcp
16

  
0 17

  
TXM/trunk/org.txm.groovy.ide.rcp/.project (revision 3606)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.txm.groovy.ide.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

  
TXM/trunk/org.txm.groovy.ide.rcp/contexts.xml (revision 3606)
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
5
			viewer. It was generated by a PDE template.</description>
6
		<topic
7
			href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm"
8
			label="Context-sensitive help">
9
			<enablement>
10
				<with variable="platform">
11
					<test property="org.eclipse.core.runtime.isBundleInstalled"
12
						args="org.eclipse.platform.doc.isv" />
13
				</with>
14
			</enablement>
15
		</topic>
16
	</context>
17
</contexts>
0 18

  
TXM/trunk/org.txm.groovy.ide.rcp/src/org/txm/groovy/ide/rcp/Activator.java (revision 3606)
1
package org.txm.groovy.ide.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

  
TXM/trunk/org.txm.groovy.ide.rcp/src/org/txm/groovy/ide/rcp/views/SampleView.java (revision 3606)
1
package org.txm.groovy.ide.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
	
42
	private Action action1;
43
	
44
	private Action action2;
45
	
46
	private Action doubleClickAction;
47
	
48
	/*
49
	 * The content provider class is responsible for
50
	 * providing objects to the view. It can wrap
51
	 * existing objects in adapters or simply return
52
	 * objects as-is. These objects may be sensitive
53
	 * to the current input of the view, or ignore
54
	 * it and always show the same content
55
	 * (like Task List, for example).
56
	 */
57
	
58
	class ViewContentProvider implements IStructuredContentProvider {
59
		
60
		public void inputChanged(Viewer v, Object oldInput, Object newInput) {}
61
		
62
		public void dispose() {}
63
		
64
		public Object[] getElements(Object parent) {
65
			return new String[] { "One", "Two", "Three" };
66
		}
67
	}
68
	
69
	class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {
70
		
71
		public String getColumnText(Object obj, int index) {
72
			return getText(obj);
73
		}
74
		
75
		public Image getColumnImage(Object obj, int index) {
76
			return getImage(obj);
77
		}
78
		
79
		public Image getImage(Object obj) {
80
			return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
81
		}
82
	}
83
	
84
	class NameSorter extends ViewerSorter {
85
	}
86
	
87
	/**
88
	 * The constructor.
89
	 */
90
	public SampleView() {}
91
	
92
	/**
93
	 * This is a callback that will allow us
94
	 * to create the viewer and initialize it.
95
	 */
96
	public void createPartControl(Composite parent) {
97
		viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
98
		viewer.setContentProvider(new ViewContentProvider());
99
		viewer.setLabelProvider(new ViewLabelProvider());
100
		viewer.setSorter(new NameSorter());
101
		viewer.setInput(getViewSite());
102
		
103
		// Create the help context id for the viewer's control
104
		PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.txm.groovy.rcp.viewer");
105
		makeActions();
106
		hookContextMenu();
107
		hookDoubleClickAction();
108
		contributeToActionBars();
109
	}
110
	
111
	private void hookContextMenu() {
112
		MenuManager menuMgr = new MenuManager("#PopupMenu");
113
		menuMgr.setRemoveAllWhenShown(true);
114
		menuMgr.addMenuListener(new IMenuListener() {
115
			
116
			public void menuAboutToShow(IMenuManager manager) {
117
				SampleView.this.fillContextMenu(manager);
118
			}
119
		});
120
		Menu menu = menuMgr.createContextMenu(viewer.getControl());
121
		viewer.getControl().setMenu(menu);
122
		getSite().registerContextMenu(menuMgr, viewer);
123
	}
124
	
125
	private void contributeToActionBars() {
126
		IActionBars bars = getViewSite().getActionBars();
127
		fillLocalPullDown(bars.getMenuManager());
128
		fillLocalToolBar(bars.getToolBarManager());
129
	}
130
	
131
	private void fillLocalPullDown(IMenuManager manager) {
132
		manager.add(action1);
133
		manager.add(new Separator());
134
		manager.add(action2);
135
	}
136
	
137
	private void fillContextMenu(IMenuManager manager) {
138
		manager.add(action1);
139
		manager.add(action2);
140
		// Other plug-ins can contribute there actions here
141
		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
142
	}
143
	
144
	private void fillLocalToolBar(IToolBarManager manager) {
145
		manager.add(action1);
146
		manager.add(action2);
147
	}
148
	
149
	private void makeActions() {
150
		action1 = new Action() {
151
			
152
			public void run() {
153
				showMessage("Action 1 executed");
154
			}
155
		};
156
		action1.setText("Action 1");
157
		action1.setToolTipText("Action 1 tooltip");
158
		action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
159
		
160
		action2 = new Action() {
161
			
162
			public void run() {
163
				showMessage("Action 2 executed");
164
			}
165
		};
166
		action2.setText("Action 2");
167
		action2.setToolTipText("Action 2 tooltip");
168
		action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
169
		doubleClickAction = new Action() {
170
			
171
			public void run() {
172
				ISelection selection = viewer.getSelection();
173
				Object obj = ((IStructuredSelection) selection).getFirstElement();
174
				showMessage("Double-click detected on " + obj.toString());
175
			}
176
		};
177
	}
178
	
179
	private void hookDoubleClickAction() {
180
		viewer.addDoubleClickListener(new IDoubleClickListener() {
181
			
182
			public void doubleClick(DoubleClickEvent event) {
183
				doubleClickAction.run();
184
			}
185
		});
186
	}
187
	
188
	private void showMessage(String message) {
189
		MessageDialog.openInformation(
190
				viewer.getControl().getShell(),
191
				"Sample View",
192
				message);
193
	}
194
	
195
	/**
196
	 * Passing the focus request to the viewer's control.
197
	 */
198
	public void setFocus() {
199
		viewer.getControl().setFocus();
200
	}
201
}
0 202

  
TXM/trunk/org.txm.groovy.ide.rcp/build.properties (revision 3606)
1
#Fri Jul 06 10:25:10 CEST 2018
2
output..=bin/
3
bin.includes = plugin.xml,\
4
               META-INF/,\
5
               .,\
6
               icons/,\
7
               contexts.xml,\
8
               OSGI-INF/
9
source..=src/
10
#qualifier=svn
0 11

  
TXM/trunk/org.txm.groovy.ide.rcp/OSGI-INF/l10n/bundle.properties (revision 3606)
1
#Properties file for org.txm.groovy.rcp
2
Bundle-Name = Rcp
3
category.name = Sample Category
4
view.name = Sample View
5
activity.description = should hide the groovy project button
6
activity.name = MenuHidingActivity
0 7

  

Formats disponibles : Unified diff