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 216019
Collapse All | Expand All

(-)plugin.properties (+2 lines)
Lines 70-75 Link Here
70
new.site.description=Create an Update Site project
70
new.site.description=Create an Update Site project
71
new.toc.name=Help Table of Contents
71
new.toc.name=Help Table of Contents
72
new.toc.description=Create a Table of Contents
72
new.toc.description=Create a Table of Contents
73
new.ctxhelp.name=Context Help
74
new.ctxhelp.description=Create a new Context Help xml file
73
75
74
PluginImportWizard.label=Plug-ins and Fragments
76
PluginImportWizard.label=Plug-ins and Fragments
75
PluginImportWizard.description=Create projects from plug-ins and fragments in the file system.
77
PluginImportWizard.description=Create projects from plug-ins and fragments in the file system.
(-)plugin.xml (+10 lines)
Lines 216-221 Link Here
216
            %new.toc.description
216
            %new.toc.description
217
         </description>
217
         </description>
218
      </wizard>
218
      </wizard>
219
      <wizard
220
            category="org.eclipse.pde.userAssistance"
221
            class="org.eclipse.pde.internal.ui.wizards.ctxhelp.NewCtxHelpWizard"
222
            icon="icons/obj16/toc_obj.gif"
223
            id="org.eclipse.pde.ui.NewContextHelpWizard"
224
            name="%new.ctxhelp.name">
225
         <description>
226
            %new.ctxhelp.description
227
         </description>
228
      </wizard>
219
   </extension>
229
   </extension>
220
   <extension
230
   <extension
221
         point="org.eclipse.ui.importWizards">
231
         point="org.eclipse.ui.importWizards">
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (+5 lines)
Lines 1007-1012 Link Here
1007
NewProductFileWizard_title=Product Configuration
1007
NewProductFileWizard_title=Product Configuration
1008
NewRestrictionDialog_title=New Restriction
1008
NewRestrictionDialog_title=New Restriction
1009
NewCategoryNameDialog_name=&Name:
1009
NewCategoryNameDialog_name=&Name:
1010
NewCtxHelpOperation_ExampleContextId=Context
1011
NewCtxHelpOperation_ExampleTopicLabel=Topic
1012
NewCtxHelpWizard_NewContextHelp=New Context Help
1013
NewCtxHelpWizardPage_contextHelpDescription=Create a new context help xml file.
1014
NewCtxHelpWizardPage_contextHelpTitle=Context Help
1010
1015
1011
PointSelectionPage_tab1=Extension Points
1016
PointSelectionPage_tab1=Extension Points
1012
PointSelectionPage_tab2=Extension Wizards
1017
PointSelectionPage_tab2=Extension Wizards
(-)src/org/eclipse/pde/internal/ui/IPDEUIConstants.java (-1 / +1 lines)
Lines 24-30 Link Here
24
	String SIMPLE_CHEAT_SHEET_EDITOR_ID = PLUGIN_ID + ".simpleCheatSheetEditor"; //$NON-NLS-1$
24
	String SIMPLE_CHEAT_SHEET_EDITOR_ID = PLUGIN_ID + ".simpleCheatSheetEditor"; //$NON-NLS-1$
25
	String COMPOSITE_CHEAT_SHEET_EDITOR_ID = PLUGIN_ID + ".compositeCheatSheetEditor"; //$NON-NLS-1$
25
	String COMPOSITE_CHEAT_SHEET_EDITOR_ID = PLUGIN_ID + ".compositeCheatSheetEditor"; //$NON-NLS-1$
26
	String TABLE_OF_CONTENTS_EDITOR_ID = PLUGIN_ID + ".tocEditor"; //$NON-NLS-1$
26
	String TABLE_OF_CONTENTS_EDITOR_ID = PLUGIN_ID + ".tocEditor"; //$NON-NLS-1$
27
	String CONTEXT_HELP_EDITOR_ID = PLUGIN_ID + ".helpContextEditor"; //$NON-NLS-1$
27
	String CONTEXT_HELP_EDITOR_ID = PLUGIN_ID + ".ctxHelpEditor"; //$NON-NLS-1$
28
	String TARGET_EDITOR_ID = PLUGIN_ID + ".targetEditor"; //$NON-NLS-1$
28
	String TARGET_EDITOR_ID = PLUGIN_ID + ".targetEditor"; //$NON-NLS-1$
29
	String PLUGINS_VIEW_ID = "org.eclipse.pde.ui.PluginsView"; //$NON-NLS-1$
29
	String PLUGINS_VIEW_ID = "org.eclipse.pde.ui.PluginsView"; //$NON-NLS-1$
30
	String DEPENDENCIES_VIEW_ID = "org.eclipse.pde.ui.DependenciesView"; //$NON-NLS-1$
30
	String DEPENDENCIES_VIEW_ID = "org.eclipse.pde.ui.DependenciesView"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+10 lines)
Lines 548-553 Link Here
548
548
549
	public static String NewCheatSheetFileWizard_0;
549
	public static String NewCheatSheetFileWizard_0;
550
550
551
	public static String NewCtxHelpOperation_ExampleContextId;
552
553
	public static String NewCtxHelpOperation_ExampleTopicLabel;
554
555
	public static String NewCtxHelpWizard_NewContextHelp;
556
557
	public static String NewCtxHelpWizardPage_contextHelpDescription;
558
559
	public static String NewCtxHelpWizardPage_contextHelpTitle;
560
551
	public static String NewLibraryPluginCreationPage_pdependencies;
561
	public static String NewLibraryPluginCreationPage_pdependencies;
552
562
553
	public static String OpenSchemaAction_errorMsgSchemaNotFound;
563
	public static String OpenSchemaAction_errorMsgSchemaNotFound;
(-)src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizardPage.java (+46 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
12
package org.eclipse.pde.internal.ui.wizards.ctxhelp;
13
14
import org.eclipse.jface.viewers.IStructuredSelection;
15
import org.eclipse.pde.internal.ui.PDEUIMessages;
16
import org.eclipse.pde.internal.ui.wizards.PDEWizardNewFileCreationPage;
17
import org.eclipse.swt.widgets.Composite;
18
19
/**
20
 * Wizard page to create a new context help xml file.
21
 * @since 3.4
22
 * @see NewCtxHelpWizard
23
 */
24
public class NewCtxHelpWizardPage extends PDEWizardNewFileCreationPage {
25
26
	private static String EXTENSION = "xml"; //$NON-NLS-1$
27
28
	public NewCtxHelpWizardPage(String pageName, IStructuredSelection selection) {
29
		super(pageName, selection);
30
		setTitle(PDEUIMessages.NewCtxHelpWizardPage_contextHelpTitle);
31
		setDescription(PDEUIMessages.NewCtxHelpWizardPage_contextHelpDescription);
32
		// Force the file extension to be 'xml'
33
		setFileExtension(EXTENSION);
34
	}
35
36
	protected void createAdvancedControls(Composite parent) {
37
		// We don't want any advanced controls showing up
38
	}
39
40
	public void createControl(Composite parent) {
41
		super.createControl(parent);
42
		// TODO Add help context
43
//		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.TOC_PAGE);
44
	}
45
46
}
(-)src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpOperation.java (+93 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.runtime.CoreException;
16
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.jface.viewers.ISelection;
18
import org.eclipse.jface.viewers.StructuredSelection;
19
import org.eclipse.pde.internal.core.text.ctxhelp.*;
20
import org.eclipse.pde.internal.core.util.CoreUtility;
21
import org.eclipse.pde.internal.ui.*;
22
import org.eclipse.swt.widgets.Display;
23
import org.eclipse.ui.*;
24
import org.eclipse.ui.actions.WorkspaceModifyOperation;
25
import org.eclipse.ui.ide.IDE;
26
import org.eclipse.ui.part.ISetSelectionTarget;
27
28
/**
29
 * Operation to create a new context help xml file, add example entries and open it
30
 * in the context help editor.
31
 * @since 3.4
32
 */
33
public class NewCtxHelpOperation extends WorkspaceModifyOperation {
34
35
	private IFile fFile;
36
37
	public NewCtxHelpOperation(IFile file) {
38
		fFile = file;
39
	}
40
41
	/* (non-Javadoc)
42
	 * @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
43
	 */
44
	protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
45
		CtxHelpModel model = new CtxHelpModel(CoreUtility.getTextDocument(fFile.getContents()), false);
46
		model.setUnderlyingResource(fFile);
47
		initializeModel(model);
48
		model.save();
49
		model.dispose();
50
		openFile();
51
		monitor.done();
52
	}
53
54
	/**
55
	 * Initialize the xml with example entries
56
	 * @param model model for the file
57
	 */
58
	private void initializeModel(CtxHelpModel model) {
59
		CtxHelpContext context = model.getFactory().createContext();
60
		context.setID(PDEUIMessages.NewCtxHelpOperation_ExampleContextId);
61
		model.getCtxHelpRoot().addChild(context);
62
		CtxHelpTopic topic = model.getFactory().createTopic();
63
		topic.setLabel(PDEUIMessages.NewCtxHelpOperation_ExampleTopicLabel);
64
		context.addChild(topic);
65
	}
66
67
	/**
68
	 * Asynchronously opens the created file in the context help editor.
69
	 */
70
	protected void openFile() {
71
		Display.getCurrent().asyncExec(new Runnable() {
72
			public void run() {
73
				IWorkbenchWindow ww = PDEPlugin.getActiveWorkbenchWindow();
74
				if (ww == null) {
75
					return;
76
				}
77
				IWorkbenchPage page = ww.getActivePage();
78
				if (page == null || !fFile.exists())
79
					return;
80
				IWorkbenchPart focusPart = page.getActivePart();
81
				if (focusPart instanceof ISetSelectionTarget) {
82
					ISelection selection = new StructuredSelection(fFile);
83
					((ISetSelectionTarget) focusPart).selectReveal(selection);
84
				}
85
				try {
86
					IDE.openEditor(page, fFile, IPDEUIConstants.CONTEXT_HELP_EDITOR_ID);
87
				} catch (PartInitException e) {
88
				}
89
			}
90
		});
91
	}
92
93
}
(-)src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizard.java (+76 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.jface.operation.IRunnableWithProgress;
16
import org.eclipse.jface.viewers.IStructuredSelection;
17
import org.eclipse.pde.internal.ui.*;
18
import org.eclipse.ui.IWorkbench;
19
import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;
20
21
/**
22
 * Wizard to create a new context help file.
23
 * @since 3.4
24
 */
25
public class NewCtxHelpWizard extends BasicNewFileResourceWizard {
26
27
	protected NewCtxHelpWizardPage fMainPage;
28
29
	/* (non-Javadoc)
30
	 * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#addPages()
31
	 */
32
	public void addPages() {
33
		fMainPage = new NewCtxHelpWizardPage("new context help", getSelection()); //$NON-NLS-1$
34
		addPage(fMainPage);
35
	}
36
37
	/* (non-Javadoc)
38
	 * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
39
	 */
40
	public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
41
		super.init(workbench, currentSelection);
42
		setWindowTitle(PDEUIMessages.NewCtxHelpWizard_NewContextHelp);
43
		setNeedsProgressMonitor(true);
44
	}
45
46
	/* (non-Javadoc)
47
	 * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#initializeDefaultPageImageDescriptor()
48
	 */
49
	protected void initializeDefaultPageImageDescriptor() {
50
		setDefaultPageImageDescriptor(PDEPluginImages.DESC_TARGET_WIZ);
51
	}
52
53
	/* (non-Javadoc)
54
	 * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#performFinish()
55
	 */
56
	public boolean performFinish() {
57
		try {
58
			getContainer().run(false, true, getOperation());
59
		} catch (InvocationTargetException e) {
60
			PDEPlugin.logException(e);
61
			return false;
62
		} catch (InterruptedException e) {
63
			return false;
64
		}
65
		return true;
66
	}
67
68
	/**
69
	 * @return the operation to execute on finish
70
	 */
71
	private IRunnableWithProgress getOperation() {
72
		IFile file = fMainPage.createNewFile();
73
		return new NewCtxHelpOperation(file);
74
	}
75
76
}

Return to bug 216019