Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 224892
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/pderesources.properties (+6 lines)
Lines 2079-2084 Link Here
2079
RegisterCSOperation_modCSExtensionExistingPlugin=Modifying existing cheat sheet extension in existing plug-in manifest file...
2079
RegisterCSOperation_modCSExtensionExistingPlugin=Modifying existing cheat sheet extension in existing plug-in manifest file...
2080
RegisterCSOperation_modCSElementExistingPlugin=Modifying existing cheat sheet element in existing plug-in manifest file...
2080
RegisterCSOperation_modCSElementExistingPlugin=Modifying existing cheat sheet element in existing plug-in manifest file...
2081
RegisterCSOperation_addNewCSExtensionNewPlugin=Adding new cheat sheet extension to new plug-in manifest file...
2081
RegisterCSOperation_addNewCSExtensionNewPlugin=Adding new cheat sheet extension to new plug-in manifest file...
2082
RegisterCtxHelpWizard_0=Register Context Help File
2083
RegisterCtxHelpWizard_2=Context Help
2084
RegisterCtxHelpWizard_3=Enter any additional information and hit finish to register the file in plugin.xml
2085
RegisterCtxHelpWizard_4=&Plugin:
2086
RegisterCtxHelpWizard_5=You can optionally specify a plugin that this context help file extends.
2082
RemoveRequireBundleResolution_description=Remove bundle ''{0}'' from the list
2087
RemoveRequireBundleResolution_description=Remove bundle ''{0}'' from the list
2083
RemoveSeperatorBuildEntryResolution_label=Remove the trailing separator in {0} from the {1} entry.
2088
RemoveSeperatorBuildEntryResolution_label=Remove the trailing separator in {0} from the {1} entry.
2084
RemoveImportPkgResolution_description=Remove the ''{0}'' package from list
2089
RemoveImportPkgResolution_description=Remove the ''{0}'' package from list
Lines 2441-2446 Link Here
2441
CtxHelpContextDetails_title=Title:
2446
CtxHelpContextDetails_title=Title:
2442
CtxHelpDescriptionDetails_description=Description:
2447
CtxHelpDescriptionDetails_description=Description:
2443
CtxHelpDescriptionDetails_specifyDescription=Specify the context description that will be displayed to the user:
2448
CtxHelpDescriptionDetails_specifyDescription=Specify the context description that will be displayed to the user:
2449
CtxHelpEditor_0=Register this context help file
2444
CtxHelpPage_contextHelp=Context Help
2450
CtxHelpPage_contextHelp=Context Help
2445
CtxHelpPage_errorParsing=An error occurred while parsing the context help xml file.
2451
CtxHelpPage_errorParsing=An error occurred while parsing the context help xml file.
2446
CtxHelpPage_failedToLoad=Failed to load context help contents
2452
CtxHelpPage_failedToLoad=Failed to load context help contents
(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+12 lines)
Lines 622-627 Link Here
622
622
623
	public static String RegisterCSWizardPage_wizardPageDescription;
623
	public static String RegisterCSWizardPage_wizardPageDescription;
624
624
625
	public static String RegisterCtxHelpWizard_0;
626
627
	public static String RegisterCtxHelpWizard_2;
628
629
	public static String RegisterCtxHelpWizard_3;
630
631
	public static String RegisterCtxHelpWizard_4;
632
633
	public static String RegisterCtxHelpWizard_5;
634
625
	public static String RemoveUnknownExecEnvironments_label;
635
	public static String RemoveUnknownExecEnvironments_label;
626
636
627
	public static String AddDefaultExecutionEnvironment_label;
637
	public static String AddDefaultExecutionEnvironment_label;
Lines 2889-2894 Link Here
2889
2899
2890
	public static String CtxHelpDescriptionDetails_specifyDescription;
2900
	public static String CtxHelpDescriptionDetails_specifyDescription;
2891
2901
2902
	public static String CtxHelpEditor_0;
2903
2892
	public static String CtxHelpPage_contextHelp;
2904
	public static String CtxHelpPage_contextHelp;
2893
2905
2894
	public static String CtxHelpPage_errorParsing;
2906
	public static String CtxHelpPage_errorParsing;
(-)src/org/eclipse/pde/internal/ui/editor/ctxhelp/CtxHelpEditor.java (-2 / +55 lines)
Lines 16-30 Link Here
16
import org.eclipse.core.resources.*;
16
import org.eclipse.core.resources.*;
17
import org.eclipse.core.runtime.IPath;
17
import org.eclipse.core.runtime.IPath;
18
import org.eclipse.jdt.ui.JavaUI;
18
import org.eclipse.jdt.ui.JavaUI;
19
import org.eclipse.jface.action.ControlContribution;
20
import org.eclipse.jface.action.IToolBarManager;
19
import org.eclipse.jface.viewers.*;
21
import org.eclipse.jface.viewers.*;
22
import org.eclipse.jface.wizard.WizardDialog;
23
import org.eclipse.pde.core.IModel;
20
import org.eclipse.pde.internal.core.text.ctxhelp.*;
24
import org.eclipse.pde.internal.core.text.ctxhelp.*;
21
import org.eclipse.pde.internal.ui.IPDEUIConstants;
25
import org.eclipse.pde.internal.ui.*;
22
import org.eclipse.pde.internal.ui.PDEPlugin;
23
import org.eclipse.pde.internal.ui.editor.*;
26
import org.eclipse.pde.internal.ui.editor.*;
24
import org.eclipse.pde.internal.ui.editor.context.InputContext;
27
import org.eclipse.pde.internal.ui.editor.context.InputContext;
25
import org.eclipse.pde.internal.ui.editor.context.InputContextManager;
28
import org.eclipse.pde.internal.ui.editor.context.InputContextManager;
29
import org.eclipse.pde.internal.ui.wizards.ctxhelp.RegisterCtxHelpWizard;
30
import org.eclipse.swt.SWT;
31
import org.eclipse.swt.widgets.Composite;
32
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.ui.*;
33
import org.eclipse.ui.*;
27
import org.eclipse.ui.forms.editor.IFormPage;
34
import org.eclipse.ui.forms.editor.IFormPage;
35
import org.eclipse.ui.forms.events.HyperlinkEvent;
36
import org.eclipse.ui.forms.events.IHyperlinkListener;
37
import org.eclipse.ui.forms.widgets.ImageHyperlink;
28
import org.eclipse.ui.part.*;
38
import org.eclipse.ui.part.*;
29
39
30
/**
40
/**
Lines 267-270 Link Here
267
		return new CtxHelpSourcePage(editor, title, name);
277
		return new CtxHelpSourcePage(editor, title, name);
268
	}
278
	}
269
279
280
	/* (non-Javadoc)
281
	 * @see org.eclipse.pde.internal.ui.editor.PDEFormEditor#contributeToToolbar(org.eclipse.jface.action.IToolBarManager)
282
	 */
283
	public void contributeToToolbar(IToolBarManager manager) {
284
		if (getAggregateModel().isEditable()) {
285
			manager.add(new ControlContribution("Register") { //$NON-NLS-1$
286
						protected Control createControl(Composite parent) {
287
							ImageHyperlink fImageHyperlinkRegisterTOC = new ImageHyperlink(parent, SWT.NONE);
288
							fImageHyperlinkRegisterTOC.setText(PDEUIMessages.CtxHelpEditor_0);
289
							fImageHyperlinkRegisterTOC.setUnderlined(true);
290
							fImageHyperlinkRegisterTOC.setForeground(getToolkit().getHyperlinkGroup().getForeground());
291
							fImageHyperlinkRegisterTOC.addHyperlinkListener(new IHyperlinkListener() {
292
								public void linkActivated(HyperlinkEvent e) {
293
									handleRegisterCtxHelpFile();
294
								}
295
296
								public void linkEntered(HyperlinkEvent e) {
297
									((ImageHyperlink) e.getSource()).setForeground(getToolkit().getHyperlinkGroup().getActiveForeground());
298
									getEditorSite().getActionBars().getStatusLineManager().setMessage(PDEUIMessages.CtxHelpEditor_0);
299
								}
300
301
								public void linkExited(HyperlinkEvent e) {
302
									((ImageHyperlink) e.getSource()).setForeground(getToolkit().getHyperlinkGroup().getForeground());
303
									getEditorSite().getActionBars().getStatusLineManager().setMessage(null);
304
								}
305
							});
306
							return fImageHyperlinkRegisterTOC;
307
						}
308
					});
309
		}
310
	}
311
312
	/**
313
	 * Opens the register context help wizard dialog.
314
	 */
315
	private void handleRegisterCtxHelpFile() {
316
		RegisterCtxHelpWizard wizard = new RegisterCtxHelpWizard((IModel) getAggregateModel());
317
		WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
318
		dialog.create();
319
		dialog.getShell().setSize(400, 250);
320
		dialog.open();
321
	}
322
270
}
323
}
(-)src/org/eclipse/pde/internal/ui/wizards/ctxhelp/RegisterCtxHelpOperation.java (+282 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.ctxhelp;
12
13
import java.lang.reflect.InvocationTargetException;
14
import org.eclipse.core.resources.IFile;
15
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.pde.core.IBaseModel;
18
import org.eclipse.pde.core.IModel;
19
import org.eclipse.pde.core.build.*;
20
import org.eclipse.pde.core.plugin.*;
21
import org.eclipse.pde.internal.core.*;
22
import org.eclipse.pde.internal.core.build.BuildObject;
23
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
24
import org.eclipse.pde.internal.core.ibundle.*;
25
import org.eclipse.pde.internal.core.ictxhelp.ICtxHelpConstants;
26
import org.eclipse.pde.internal.core.plugin.*;
27
import org.eclipse.pde.internal.core.text.bundle.BundleSymbolicNameHeader;
28
import org.eclipse.pde.internal.core.text.bundle.RequireBundleHeader;
29
import org.eclipse.pde.internal.core.util.PDETextHelper;
30
import org.eclipse.pde.internal.ui.*;
31
import org.eclipse.pde.internal.ui.editor.ctxhelp.CtxHelpEditor;
32
import org.eclipse.pde.internal.ui.util.ModelModification;
33
import org.eclipse.pde.internal.ui.util.PDEModelUtility;
34
import org.eclipse.swt.widgets.Shell;
35
import org.eclipse.ui.actions.WorkspaceModifyOperation;
36
import org.osgi.framework.Constants;
37
38
/**
39
 * Register Context Help Operation, registers a context help xml file in the plugin.xml.
40
 * Must be run in the UI thread.
41
 * @since 3.4
42
 * @see RegisterCtxHelpOperation
43
 * @see CtxHelpEditor
44
 */
45
public class RegisterCtxHelpOperation extends WorkspaceModifyOperation {
46
47
	static final String CTX_HELP_EXTENSION_POINT_ID = "org.eclipse.help.contexts"; //$NON-NLS-1$
48
	static final String CTX_HELP_PLUGIN_ID = "org.eclipse.help"; //$NON-NLS-1$
49
50
	public static final String CTX_HELP_ATTR_FILE = "file"; //$NON-NLS-1$
51
	public final static String CTX_HELP_ATTR_PLUGIN = "plugin"; //$NON-NLS-1$
52
53
	private Shell fShell;
54
	private String fPluginText;
55
	private IProject fProject;
56
	private String fResourceString;
57
58
	public RegisterCtxHelpOperation(Shell shell, IModel model, String pluginText) {
59
		fPluginText = pluginText;
60
		fProject = model.getUnderlyingResource().getProject();
61
		fResourceString = model.getUnderlyingResource().getProjectRelativePath().toPortableString();
62
		fShell = shell;
63
	}
64
65
	/* (non-Javadoc)
66
	 * @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
67
	 */
68
	protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
69
		try {
70
			boolean fragment = PluginRegistry.findModel(fProject).isFragmentModel();
71
			IFile file = fProject.getFile(fragment ? ICoreConstants.FRAGMENT_PATH : ICoreConstants.PLUGIN_PATH);
72
			// If the plug-in exists modify it accordingly; otherwise, create
73
			// a new plug-in file
74
			if (file.exists()) {
75
				modifyExistingPluginFile(file, monitor);
76
			} else {
77
				createNewPluginFile(file, monitor);
78
			}
79
		} catch (CoreException e) {
80
			throw new InvocationTargetException(e);
81
		}
82
	}
83
84
	private void modifyExistingPluginFile(IFile file, IProgressMonitor monitor) throws CoreException {
85
		IStatus status = PDEPlugin.getWorkspace().validateEdit(new IFile[] {file}, fShell);
86
		if (status.getSeverity() != IStatus.OK) {
87
			throw new CoreException(new Status(IStatus.ERROR, IPDEUIConstants.PLUGIN_ID, IStatus.ERROR, PDEUIMessages.RegisterCSOperation_errorManifestReadOnly, null));
88
		}
89
		// Perform the modification of the plugin manifest file
90
		ModelModification mod = new ModelModification(fProject) {
91
			protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException {
92
				doModifyPluginModel(model, monitor);
93
				doModifyManifestModel(model);
94
			}
95
		};
96
		PDEModelUtility.modifyModel(mod, monitor);
97
	}
98
99
	private void doModifyPluginModel(IBaseModel model, IProgressMonitor monitor) throws CoreException {
100
		if ((model instanceof IPluginModelBase) == false) {
101
			return;
102
		}
103
104
		IPluginModelBase modelBase = (IPluginModelBase) model;
105
		IPluginExtension[] extensions = modelBase.getExtensions().getExtensions();
106
		IPluginExtension existingExtension = null;
107
		for (int i = 0; i < extensions.length; i++) {
108
			String point = extensions[i].getPoint();
109
			if (CTX_HELP_EXTENSION_POINT_ID.equals(point)) {
110
				if (checkExistingExtensionElement(extensions[i])) {
111
					// Exact match, no need to register anything
112
					return;
113
				}
114
				existingExtension = extensions[i];
115
			}
116
		}
117
118
		if (existingExtension != null) {
119
			// No exact match, add a new entry to the existing extension
120
			addElementToExtension(existingExtension);
121
		} else {
122
			// No existing extension found, create one
123
			addExtensionToModel(modelBase);
124
		}
125
	}
126
127
	private void doModifyManifestModel(IBaseModel model) {
128
		// Make sure we have a base model
129
		if ((model instanceof IBundlePluginModelBase) == false) {
130
			return;
131
		}
132
		IBundlePluginModelBase modelBase = (IBundlePluginModelBase) model;
133
		IBundle bundle = modelBase.getBundleModel().getBundle();
134
		// Get the heading specifying the singleton declaration 
135
		IManifestHeader header = bundle.getManifestHeader(Constants.BUNDLE_SYMBOLICNAME);
136
		if (header instanceof BundleSymbolicNameHeader) {
137
			BundleSymbolicNameHeader symbolic = (BundleSymbolicNameHeader) header;
138
			// If the singleton declaration is false, change it to true
139
			// This is required because plug-ins that specify extensions
140
			// must be singletons.
141
			if (symbolic.isSingleton() == false) {
142
				symbolic.setSingleton(true);
143
			}
144
		}
145
		// Add the context help plug-in to the list of required bundles
146
		header = bundle.getManifestHeader(Constants.REQUIRE_BUNDLE);
147
		if (header instanceof RequireBundleHeader) {
148
			RequireBundleHeader require = (RequireBundleHeader) header;
149
			if (require.hasElement(CTX_HELP_PLUGIN_ID) == false) {
150
				require.addBundle(CTX_HELP_PLUGIN_ID);
151
			}
152
		}
153
	}
154
155
	private void createNewPluginFile(IFile file, IProgressMonitor monitor) throws CoreException {
156
		monitor.beginTask(PDEUIMessages.RegisterCSOperation_addNewCSExtensionNewPlugin, 4);
157
158
		WorkspacePluginModelBase model;
159
		if (file.getProjectRelativePath().equals(ICoreConstants.FRAGMENT_PATH)) {
160
			model = new WorkspaceFragmentModel(file, false);
161
		} else {
162
			model = new WorkspacePluginModel(file, false);
163
		}
164
		monitor.worked(1);
165
166
		IPluginBase base = model.getPluginBase();
167
		double targetVersion = TargetPlatformHelper.getTargetVersion();
168
		String version = null;
169
		if (targetVersion < 3.2) {
170
			version = ICoreConstants.TARGET30;
171
		} else {
172
			version = ICoreConstants.TARGET32;
173
		}
174
		base.setSchemaVersion(version);
175
176
		addExtensionToModel(model);
177
		monitor.worked(1);
178
179
		model.save();
180
		monitor.worked(1);
181
		// Update the MANIFEST.MF file to ensure the singleton directive is set
182
		// to true
183
		modifyExistingManifestFile(file);
184
		monitor.done();
185
	}
186
187
	/**
188
	 * @param model
189
	 */
190
	private void modifyExistingManifestFile(IFile file) throws CoreException {
191
		// Validate the operation
192
		// Note: This is not accurate, we are validating the plugin.xml file rather
193
		// than the manifest file
194
		IStatus status = PDEPlugin.getWorkspace().validateEdit(new IFile[] {file}, fShell);
195
		if (status.getSeverity() != IStatus.OK) {
196
			throw new CoreException(new Status(IStatus.ERROR, IPDEUIConstants.PLUGIN_ID, IStatus.ERROR, PDEUIMessages.RegisterCSOperation_errorManifestReadOnly, null));
197
		}
198
		// Perform the modification of the manifest file
199
		ModelModification mod = new ModelModification(fProject) {
200
			protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException {
201
				doModifyManifestModel(model);
202
				doModifyBuildModel(model);
203
			}
204
		};
205
		PDEModelUtility.modifyModel(mod, null);
206
	}
207
208
	private void doModifyBuildModel(IBaseModel model) throws CoreException {
209
		// Make sure we have a base model
210
		if ((model instanceof IPluginModelBase) == false) {
211
			return;
212
		}
213
		IPluginModelBase modelBase = (IPluginModelBase) model;
214
		IBuild build = ClasspathUtilCore.getBuild(modelBase);
215
		// Make sure we have a plugin.properties file
216
		if (build == null) {
217
			return;
218
		}
219
		// Get the entry for bin.includes
220
		IBuildEntry entry = build.getEntry(IBuildEntry.BIN_INCLUDES);
221
		if (entry == null) {
222
			// This should never happen since the manifest.mf file exists and
223
			// it has to be in the bin.includes
224
			return;
225
		}
226
		// Add the plugin.xml file to the bin.includes build entry if it does
227
		// not exist
228
		if (entry.contains(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) == false) {
229
			entry.addToken(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
230
		}
231
		// There does not seem to be any support in PDEModelUtility or the 
232
		// ModelModification framework to save build.properties modifications
233
		// As a result, explicitly do that here
234
		if (build instanceof BuildObject) {
235
			IBuildModel buildModel = ((BuildObject) build).getModel();
236
			if (buildModel instanceof WorkspaceBuildModel) {
237
				((WorkspaceBuildModel) buildModel).save();
238
			}
239
		}
240
	}
241
242
	private boolean checkExistingExtensionElement(IPluginExtension extension) {
243
		IPluginObject[] pluginObjects = extension.getChildren();
244
		for (int j = 0; j < pluginObjects.length; j++) {
245
			if (pluginObjects[j] instanceof IPluginElement) {
246
				IPluginElement element = (IPluginElement) pluginObjects[j];
247
				if (element.getName().equals(ICtxHelpConstants.ELEMENT_ROOT)) {
248
					IPluginAttribute fileAttribute = element.getAttribute(CTX_HELP_ATTR_FILE);
249
					if ((fileAttribute != null) && PDETextHelper.isDefined(fileAttribute.getValue()) && fResourceString.equals(fileAttribute.getValue())) {
250
						IPluginAttribute pluginAttribute = element.getAttribute(CTX_HELP_ATTR_PLUGIN);
251
						if (pluginAttribute == null || !PDETextHelper.isDefined(pluginAttribute.getValue())) {
252
							if (fPluginText.length() == 0) {
253
								return true;
254
							}
255
						} else if (fPluginText.equals(pluginAttribute.getValue())) {
256
							return true;
257
						}
258
					}
259
				}
260
			}
261
		}
262
		return false;
263
	}
264
265
	private void addExtensionToModel(IPluginModelBase model) throws CoreException {
266
		IPluginExtension extension = model.getFactory().createExtension();
267
		extension.setPoint(CTX_HELP_EXTENSION_POINT_ID);
268
		addElementToExtension(extension);
269
		model.getPluginBase().add(extension);
270
	}
271
272
	private void addElementToExtension(IPluginExtension extension) throws CoreException {
273
		IPluginElement element = extension.getModel().getFactory().createElement(extension);
274
		element.setName(ICtxHelpConstants.ELEMENT_ROOT);
275
		element.setAttribute(CTX_HELP_ATTR_FILE, fResourceString);
276
		if (fPluginText.length() > 0) {
277
			element.setAttribute(CTX_HELP_ATTR_PLUGIN, fPluginText);
278
		}
279
		extension.add(element);
280
	}
281
282
}
(-)src/org/eclipse/pde/internal/ui/wizards/ctxhelp/RegisterCtxHelpWizard.java (+110 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.wizards.ctxhelp;
12
13
import java.lang.reflect.InvocationTargetException;
14
import org.eclipse.jface.wizard.Wizard;
15
import org.eclipse.jface.wizard.WizardPage;
16
import org.eclipse.pde.core.IModel;
17
import org.eclipse.pde.internal.ui.*;
18
import org.eclipse.pde.internal.ui.editor.ctxhelp.CtxHelpEditor;
19
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.layout.GridData;
21
import org.eclipse.swt.layout.GridLayout;
22
import org.eclipse.swt.widgets.*;
23
24
/**
25
 * Wizard to register a context help file in plugin.xml
26
 * @since 3.4
27
 * @see RegisterCtxHelpOperation
28
 * @see CtxHelpEditor
29
 */
30
public class RegisterCtxHelpWizard extends Wizard {
31
32
	private RegisterCtxHelpWizardPage fMainPage;
33
	private IModel fWizModel;
34
35
	public RegisterCtxHelpWizard(IModel model) {
36
		fWizModel = model;
37
		setWindowTitle(PDEUIMessages.RegisterCtxHelpWizard_0);
38
		setDefaultPageImageDescriptor(PDEPluginImages.DESC_CHEATSHEET_WIZ);
39
		setNeedsProgressMonitor(true);
40
	}
41
42
	/* (non-Javadoc)
43
	 * @see org.eclipse.jface.wizard.Wizard#addPages()
44
	 */
45
	public void addPages() {
46
		fMainPage = new RegisterCtxHelpWizardPage(PDEUIMessages.RegisterCtxHelpWizard_0);
47
		addPage(fMainPage);
48
	}
49
50
	/* (non-Javadoc)
51
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
52
	 */
53
	public boolean performFinish() {
54
		try {
55
			getContainer().run(false, true, new RegisterCtxHelpOperation(getShell(), fWizModel, fMainPage.getPluginText()));
56
		} catch (InvocationTargetException e) {
57
			PDEPlugin.logException(e);
58
			return false;
59
		} catch (InterruptedException e) {
60
			return false;
61
		}
62
		return true;
63
	}
64
65
	/**
66
	 * Main page of the wizard
67
	 * @since 3.4
68
	 */
69
	class RegisterCtxHelpWizardPage extends WizardPage {
70
71
		private Text fPluginText;
72
73
		protected RegisterCtxHelpWizardPage(String pageName) {
74
			super(pageName);
75
			setTitle(PDEUIMessages.RegisterCtxHelpWizard_2);
76
			setMessage(PDEUIMessages.RegisterCtxHelpWizard_3);
77
		}
78
79
		public void createControl(Composite parent) {
80
			Composite composite = new Composite(parent, SWT.NONE);
81
			composite.setLayout(new GridLayout(2, false));
82
			composite.setFont(parent.getFont());
83
			composite.setLayoutData(new GridData(GridData.FILL_BOTH));
84
85
			Label label = new Label(composite, SWT.NONE);
86
			label.setFont(composite.getFont());
87
			label.setLayoutData(new GridData());
88
			label.setText(PDEUIMessages.RegisterCtxHelpWizard_4);
89
90
			fPluginText = new Text(composite, SWT.SINGLE | SWT.BORDER);
91
			fPluginText.setFont(composite.getFont());
92
			fPluginText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
93
94
			Label label2 = new Label(composite, SWT.NONE);
95
			label2.setFont(composite.getFont());
96
			GridData data = new GridData();
97
			data.horizontalSpan = 2;
98
			label2.setLayoutData(data);
99
			label2.setText(PDEUIMessages.RegisterCtxHelpWizard_5);
100
101
			setControl(composite);
102
		}
103
104
		public String getPluginText() {
105
			return fPluginText.getText().trim();
106
		}
107
108
	}
109
110
}

Return to bug 224892