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 122053 Details for
Bug 256231
[PHP Explorer] [regression] missing Open with>Other for php/phtml files in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fixing in DLTK code
patch_256231.txt (text/plain), 6.44 KB, created by
Q.S. Wang
on 2009-01-08 22:28:26 EST
(
hide
)
Description:
Fixing in DLTK code
Filename:
MIME Type:
Creator:
Q.S. Wang
Created:
2009-01-08 22:28:26 EST
Size:
6.44 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.dltk.ui >Index: src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java,v >retrieving revision 1.9 >diff -u -r1.9 OpenModelElementWithMenu.java >--- src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java 14 May 2008 04:23:02 -0000 1.9 >+++ src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java 9 Jan 2009 03:27:24 -0000 >@@ -24,6 +24,8 @@ > import org.eclipse.dltk.ui.IDLTKUILanguageToolkit; > import org.eclipse.jface.action.ContributionItem; > import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.window.Window; >+import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.widgets.Event; >@@ -35,7 +37,11 @@ > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.PartInitException; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.dialogs.EditorSelectionDialog; > import org.eclipse.ui.ide.IDE; >+import org.eclipse.ui.internal.WorkbenchPage; >+import org.eclipse.ui.internal.ide.DialogUtil; >+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; > import org.eclipse.ui.part.FileEditorInput; > > import com.ibm.icu.text.Collator; >@@ -194,7 +200,7 @@ > switch (event.type) { > case SWT.Selection: > if (menuItem.getSelection()) { >- openEditor(descriptor); >+ openEditor(descriptor,false); > } > break; > } >@@ -292,7 +298,48 @@ > // createMenuItem(menu, descriptor, preferredEditor); > // } > createDefaultMenuItem(menu, file); >- } >+ >+ // add Other... menu item >+ createOtherMenuItem(menu); >+ } >+ >+ >+ /** >+ * Creates the Other... menu item >+ * >+ * @param menu the menu to add the item to >+ */ >+ private void createOtherMenuItem(final Menu menu) { >+ final IFile fileResource = getFileResource(); >+ if (fileResource == null) { >+ return; >+ } >+ new MenuItem(menu, SWT.SEPARATOR); >+ final MenuItem menuItem = new MenuItem(menu, SWT.PUSH); >+ menuItem.setText(IDEWorkbenchMessages.OpenWithMenu_Other); >+ Listener listener = new Listener() { >+ public void handleEvent(Event event) { >+ switch (event.type) { >+ case SWT.Selection: >+ EditorSelectionDialog dialog = new EditorSelectionDialog( >+ menu.getShell()); >+ dialog >+ .setMessage(NLS >+ .bind( >+ IDEWorkbenchMessages.OpenWithMenu_OtherDialogDescription, >+ fileResource.getName())); >+ if (dialog.open() == Window.OK) { >+ IEditorDescriptor editor = dialog.getSelectedEditor(); >+ if (editor != null) { >+ openEditor(editor,editor.isOpenExternal()); >+ } >+ } >+ break; >+ } >+ } >+ }; >+ menuItem.addListener(SWT.Selection, listener); >+ } > > private IModelElement getModelElement() { > if (this.element instanceof IModelElement) { >@@ -322,33 +369,65 @@ > return true; > } > >+// /** >+// * Opens the given editor on the selected file. >+// * >+// * @param editor >+// * the editor descriptor, or null for the system editor >+// */ >+// private void openEditor(IEditorDescriptor editor) { >+// IFile file = getFileResource(); >+// if (file == null) { >+// return; >+// } >+// try { >+// String editorId = editor == null ? IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID >+// : editor.getId(); >+// ((IWorkbenchPage) page).openEditor(new FileEditorInput(file), >+// editorId, true, MATCH_BOTH); >+// // only remember the default editor if the open succeeds >+// IDE.setDefaultEditor(file, editorId); >+// } catch (PartInitException e) { >+// if (DLTKCore.DEBUG) { >+// e.printStackTrace(); >+// } >+// // DialogUtil.openError(page.getWorkbenchWindow().getShell(), >+// // ActionMessages.OpenWithMenu_dialogTitle, >+// // e.getMessage(), e); >+// } >+// } >+ > /** >- * Opens the given editor on the selected file. >- * >- * @param editor >- * the editor descriptor, or null for the system editor >- */ >- private void openEditor(IEditorDescriptor editor) { >- IFile file = getFileResource(); >- if (file == null) { >- return; >- } >- try { >- String editorId = editor == null ? IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID >- : editor.getId(); >- ((IWorkbenchPage) page).openEditor(new FileEditorInput(file), >- editorId, true, MATCH_BOTH); >- // only remember the default editor if the open succeeds >- IDE.setDefaultEditor(file, editorId); >- } catch (PartInitException e) { >- if (DLTKCore.DEBUG) { >- e.printStackTrace(); >- } >- // DialogUtil.openError(page.getWorkbenchWindow().getShell(), >- // ActionMessages.OpenWithMenu_dialogTitle, >- // e.getMessage(), e); >- } >- } >+ * Opens the given editor on the selected file. >+ * >+ * @param editorDescriptor the editor descriptor, or null for the system editor >+ * @param openUsingDescriptor use the descriptor's editor ID for opening if false (normal case), >+ * or use the descriptor itself if true (needed to fix bug 178235). >+ * >+ * @since 3.5 >+ */ >+ protected void openEditor(IEditorDescriptor editorDescriptor, boolean openUsingDescriptor) { >+ IFile file = getFileResource(); >+ if (file == null) { >+ return; >+ } >+ try { >+ if (openUsingDescriptor) { >+ ((WorkbenchPage) page).openEditorFromDescriptor(new FileEditorInput(file), editorDescriptor, true, null); >+ } else { >+ String editorId = editorDescriptor == null ? IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID >+ : editorDescriptor.getId(); >+ >+ ((WorkbenchPage) page).openEditor(new FileEditorInput(file), editorId, true, MATCH_BOTH); >+ // only remember the default editor if the open succeeds >+ IDE.setDefaultEditor(file, editorId); >+ } >+ } catch (PartInitException e) { >+ DialogUtil.openError(page.getWorkbenchWindow().getShell(), >+ IDEWorkbenchMessages.OpenWithMenu_dialogTitle, >+ e.getMessage(), e); >+ } >+ } > > /** > * Creates the menu item for clearing the current selection.
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
Flags:
alex.panchenko
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 256231
: 122053