Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 87688 Details for
Bug 216019
New File Wizard for Context Help File
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for review
216019NewContextHelpFileWizard.patch (text/plain), 13.90 KB, created by
Curtis Windatt
on 2008-01-23 14:27:45 EST
(
hide
)
Description:
Patch for review
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2008-01-23 14:27:45 EST
Size:
13.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/plugin.properties,v >retrieving revision 1.209 >diff -u -r1.209 plugin.properties >--- plugin.properties 21 Jan 2008 17:38:13 -0000 1.209 >+++ plugin.properties 23 Jan 2008 19:21:38 -0000 >@@ -70,6 +70,8 @@ > new.site.description=Create an Update Site project > new.toc.name=Help Table of Contents > new.toc.description=Create a Table of Contents >+new.ctxhelp.name=Context Help >+new.ctxhelp.description=Create a new Context Help xml file > > PluginImportWizard.label=Plug-ins and Fragments > PluginImportWizard.description=Create projects from plug-ins and fragments in the file system. >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/plugin.xml,v >retrieving revision 1.436 >diff -u -r1.436 plugin.xml >--- plugin.xml 21 Jan 2008 17:38:13 -0000 1.436 >+++ plugin.xml 23 Jan 2008 19:21:39 -0000 >@@ -216,6 +216,16 @@ > %new.toc.description > </description> > </wizard> >+ <wizard >+ category="org.eclipse.pde.userAssistance" >+ class="org.eclipse.pde.internal.ui.wizards.ctxhelp.NewCtxHelpWizard" >+ icon="icons/obj16/toc_obj.gif" >+ id="org.eclipse.pde.ui.NewContextHelpWizard" >+ name="%new.ctxhelp.name"> >+ <description> >+ %new.ctxhelp.description >+ </description> >+ </wizard> > </extension> > <extension > point="org.eclipse.ui.importWizards"> >Index: src/org/eclipse/pde/internal/ui/pderesources.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties,v >retrieving revision 1.959 >diff -u -r1.959 pderesources.properties >--- src/org/eclipse/pde/internal/ui/pderesources.properties 21 Jan 2008 17:38:12 -0000 1.959 >+++ src/org/eclipse/pde/internal/ui/pderesources.properties 23 Jan 2008 19:21:42 -0000 >@@ -1007,6 +1007,11 @@ > NewProductFileWizard_title=Product Configuration > NewRestrictionDialog_title=New Restriction > NewCategoryNameDialog_name=&Name: >+NewCtxHelpOperation_ExampleContextId=Context >+NewCtxHelpOperation_ExampleTopicLabel=Topic >+NewCtxHelpWizard_NewContextHelp=New Context Help >+NewCtxHelpWizardPage_contextHelpDescription=Create a new context help xml file. >+NewCtxHelpWizardPage_contextHelpTitle=Context Help > > PointSelectionPage_tab1=Extension Points > PointSelectionPage_tab2=Extension Wizards >Index: src/org/eclipse/pde/internal/ui/IPDEUIConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/IPDEUIConstants.java,v >retrieving revision 1.31 >diff -u -r1.31 IPDEUIConstants.java >--- src/org/eclipse/pde/internal/ui/IPDEUIConstants.java 21 Jan 2008 17:38:12 -0000 1.31 >+++ src/org/eclipse/pde/internal/ui/IPDEUIConstants.java 23 Jan 2008 19:21:39 -0000 >@@ -24,7 +24,7 @@ > String SIMPLE_CHEAT_SHEET_EDITOR_ID = PLUGIN_ID + ".simpleCheatSheetEditor"; //$NON-NLS-1$ > String COMPOSITE_CHEAT_SHEET_EDITOR_ID = PLUGIN_ID + ".compositeCheatSheetEditor"; //$NON-NLS-1$ > String TABLE_OF_CONTENTS_EDITOR_ID = PLUGIN_ID + ".tocEditor"; //$NON-NLS-1$ >- String CONTEXT_HELP_EDITOR_ID = PLUGIN_ID + ".helpContextEditor"; //$NON-NLS-1$ >+ String CONTEXT_HELP_EDITOR_ID = PLUGIN_ID + ".ctxHelpEditor"; //$NON-NLS-1$ > String TARGET_EDITOR_ID = PLUGIN_ID + ".targetEditor"; //$NON-NLS-1$ > String PLUGINS_VIEW_ID = "org.eclipse.pde.ui.PluginsView"; //$NON-NLS-1$ > String DEPENDENCIES_VIEW_ID = "org.eclipse.pde.ui.DependenciesView"; //$NON-NLS-1$ >Index: src/org/eclipse/pde/internal/ui/PDEUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java,v >retrieving revision 1.353 >diff -u -r1.353 PDEUIMessages.java >--- src/org/eclipse/pde/internal/ui/PDEUIMessages.java 21 Jan 2008 17:38:12 -0000 1.353 >+++ src/org/eclipse/pde/internal/ui/PDEUIMessages.java 23 Jan 2008 19:21:40 -0000 >@@ -548,6 +548,16 @@ > > public static String NewCheatSheetFileWizard_0; > >+ public static String NewCtxHelpOperation_ExampleContextId; >+ >+ public static String NewCtxHelpOperation_ExampleTopicLabel; >+ >+ public static String NewCtxHelpWizard_NewContextHelp; >+ >+ public static String NewCtxHelpWizardPage_contextHelpDescription; >+ >+ public static String NewCtxHelpWizardPage_contextHelpTitle; >+ > public static String NewLibraryPluginCreationPage_pdependencies; > > public static String OpenSchemaAction_errorMsgSchemaNotFound; >Index: src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizardPage.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizardPage.java >diff -N src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,46 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.pde.internal.ui.wizards.ctxhelp; >+ >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.pde.internal.ui.PDEUIMessages; >+import org.eclipse.pde.internal.ui.wizards.PDEWizardNewFileCreationPage; >+import org.eclipse.swt.widgets.Composite; >+ >+/** >+ * Wizard page to create a new context help xml file. >+ * @since 3.4 >+ * @see NewCtxHelpWizard >+ */ >+public class NewCtxHelpWizardPage extends PDEWizardNewFileCreationPage { >+ >+ private static String EXTENSION = "xml"; //$NON-NLS-1$ >+ >+ public NewCtxHelpWizardPage(String pageName, IStructuredSelection selection) { >+ super(pageName, selection); >+ setTitle(PDEUIMessages.NewCtxHelpWizardPage_contextHelpTitle); >+ setDescription(PDEUIMessages.NewCtxHelpWizardPage_contextHelpDescription); >+ // Force the file extension to be 'xml' >+ setFileExtension(EXTENSION); >+ } >+ >+ protected void createAdvancedControls(Composite parent) { >+ // We don't want any advanced controls showing up >+ } >+ >+ public void createControl(Composite parent) { >+ super.createControl(parent); >+ // TODO Add help context >+// PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.TOC_PAGE); >+ } >+ >+} >Index: src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpOperation.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpOperation.java >diff -N src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpOperation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpOperation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,93 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.wizards.ctxhelp; >+ >+import java.lang.reflect.InvocationTargetException; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.pde.internal.core.text.ctxhelp.*; >+import org.eclipse.pde.internal.core.util.CoreUtility; >+import org.eclipse.pde.internal.ui.*; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.ui.*; >+import org.eclipse.ui.actions.WorkspaceModifyOperation; >+import org.eclipse.ui.ide.IDE; >+import org.eclipse.ui.part.ISetSelectionTarget; >+ >+/** >+ * Operation to create a new context help xml file, add example entries and open it >+ * in the context help editor. >+ * @since 3.4 >+ */ >+public class NewCtxHelpOperation extends WorkspaceModifyOperation { >+ >+ private IFile fFile; >+ >+ public NewCtxHelpOperation(IFile file) { >+ fFile = file; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { >+ CtxHelpModel model = new CtxHelpModel(CoreUtility.getTextDocument(fFile.getContents()), false); >+ model.setUnderlyingResource(fFile); >+ initializeModel(model); >+ model.save(); >+ model.dispose(); >+ openFile(); >+ monitor.done(); >+ } >+ >+ /** >+ * Initialize the xml with example entries >+ * @param model model for the file >+ */ >+ private void initializeModel(CtxHelpModel model) { >+ CtxHelpContext context = model.getFactory().createContext(); >+ context.setID(PDEUIMessages.NewCtxHelpOperation_ExampleContextId); >+ model.getCtxHelpRoot().addChild(context); >+ CtxHelpTopic topic = model.getFactory().createTopic(); >+ topic.setLabel(PDEUIMessages.NewCtxHelpOperation_ExampleTopicLabel); >+ context.addChild(topic); >+ } >+ >+ /** >+ * Asynchronously opens the created file in the context help editor. >+ */ >+ protected void openFile() { >+ Display.getCurrent().asyncExec(new Runnable() { >+ public void run() { >+ IWorkbenchWindow ww = PDEPlugin.getActiveWorkbenchWindow(); >+ if (ww == null) { >+ return; >+ } >+ IWorkbenchPage page = ww.getActivePage(); >+ if (page == null || !fFile.exists()) >+ return; >+ IWorkbenchPart focusPart = page.getActivePart(); >+ if (focusPart instanceof ISetSelectionTarget) { >+ ISelection selection = new StructuredSelection(fFile); >+ ((ISetSelectionTarget) focusPart).selectReveal(selection); >+ } >+ try { >+ IDE.openEditor(page, fFile, IPDEUIConstants.CONTEXT_HELP_EDITOR_ID); >+ } catch (PartInitException e) { >+ } >+ } >+ }); >+ } >+ >+} >Index: src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizard.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizard.java >diff -N src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizard.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/wizards/ctxhelp/NewCtxHelpWizard.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,76 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.wizards.ctxhelp; >+ >+import java.lang.reflect.InvocationTargetException; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.pde.internal.ui.*; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard; >+ >+/** >+ * Wizard to create a new context help file. >+ * @since 3.4 >+ */ >+public class NewCtxHelpWizard extends BasicNewFileResourceWizard { >+ >+ protected NewCtxHelpWizardPage fMainPage; >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#addPages() >+ */ >+ public void addPages() { >+ fMainPage = new NewCtxHelpWizardPage("new context help", getSelection()); //$NON-NLS-1$ >+ addPage(fMainPage); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection) >+ */ >+ public void init(IWorkbench workbench, IStructuredSelection currentSelection) { >+ super.init(workbench, currentSelection); >+ setWindowTitle(PDEUIMessages.NewCtxHelpWizard_NewContextHelp); >+ setNeedsProgressMonitor(true); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#initializeDefaultPageImageDescriptor() >+ */ >+ protected void initializeDefaultPageImageDescriptor() { >+ setDefaultPageImageDescriptor(PDEPluginImages.DESC_TARGET_WIZ); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard#performFinish() >+ */ >+ public boolean performFinish() { >+ try { >+ getContainer().run(false, true, getOperation()); >+ } catch (InvocationTargetException e) { >+ PDEPlugin.logException(e); >+ return false; >+ } catch (InterruptedException e) { >+ return false; >+ } >+ return true; >+ } >+ >+ /** >+ * @return the operation to execute on finish >+ */ >+ private IRunnableWithProgress getOperation() { >+ IFile file = fMainPage.createNewFile(); >+ return new NewCtxHelpOperation(file); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 216019
: 87688 |
87690