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 156681 Details for
Bug 4922
[EditorMgmt] Need ability to open a file in eclipse from the command line
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
rough cut, untested
patch-4922.txt (text/plain), 4.81 KB, created by
Boris Bokowski
on 2010-01-20 12:59:49 EST
(
hide
)
Description:
rough cut, untested
Filename:
MIME Type:
Creator:
Boris Bokowski
Created:
2010-01-20 12:59:49 EST
Size:
4.81 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide.application >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF,v >retrieving revision 1.14 >diff -u -r1.14 MANIFEST.MF >--- META-INF/MANIFEST.MF 1 Sep 2009 04:32:22 -0000 1.14 >+++ META-INF/MANIFEST.MF 20 Jan 2010 17:48:54 -0000 >@@ -12,7 +12,8 @@ > org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", > org.eclipse.ui;bundle-version="[3.5.0,4.0.0)", > org.eclipse.ui.navigator.resources;bundle-version="[3.4.0,4.0.0)", >- org.eclipse.core.net;bundle-version="[1.0.0,2.0.0)" >+ org.eclipse.core.net;bundle-version="[1.0.0,2.0.0)", >+ org.eclipse.core.filesystem;bundle-version="1.3.0" > Export-Package: org.eclipse.ui.internal.ide.application;x-internal:=true, > org.eclipse.ui.internal.ide.application.dialogs;x-internal:=true > Import-Package: com.ibm.icu.text >Index: src/org/eclipse/ui/internal/ide/application/IDEApplication.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java,v >retrieving revision 1.7 >diff -u -r1.7 IDEApplication.java >--- src/org/eclipse/ui/internal/ide/application/IDEApplication.java 3 Jun 2008 17:56:02 -0000 1.7 >+++ src/org/eclipse/ui/internal/ide/application/IDEApplication.java 20 Jan 2010 17:48:54 -0000 >@@ -19,9 +19,13 @@ > import java.net.URL; > import java.util.Properties; > >+import org.eclipse.core.filesystem.EFS; >+import org.eclipse.core.filesystem.IFileInfo; >+import org.eclipse.core.filesystem.IFileStore; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IExecutableExtension; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; > import org.eclipse.equinox.app.IApplication; >@@ -32,10 +36,16 @@ > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Listener; > import org.eclipse.swt.widgets.MessageBox; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PartInitException; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.ide.IDE; > import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.internal.ide.ChooseWorkspaceData; > import org.eclipse.ui.internal.ide.ChooseWorkspaceDialog; >@@ -85,8 +95,10 @@ > * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext context) > */ > public Object start(IApplicationContext appContext) throws Exception { >- Display display = createDisplay(); >+ final Display display = createDisplay(); > >+ hookOpenDocListener(display); >+ > try { > > // look and see if there's a splash shell we can parent off of >@@ -134,6 +146,53 @@ > } > } > >+ /** >+ * @param display >+ */ >+ protected void hookOpenDocListener(final Display display) { >+ display.addListener(SWT.OpenDoc, new Listener() { >+ public void handleEvent(Event event) { >+ final String path = event.text; >+ if (path == null) { >+ return; >+ } >+ display.asyncExec(new Runnable() { >+ public void run() { >+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); >+ if (window == null) { >+ return; >+ } >+ IFileStore fileStore = EFS.getLocalFileSystem() >+ .getStore(new Path(path)); >+ IFileInfo fetchInfo = fileStore.fetchInfo(); >+ if (!fetchInfo.isDirectory() && fetchInfo.exists()) { >+ IWorkbenchPage page = window.getActivePage(); >+ try { >+ IDE.openEditorOnFileStore(page, fileStore); >+ } catch (PartInitException e) { >+ String msg = NLS >+ .bind( >+ IDEWorkbenchMessages.OpenLocalFileAction_message_errorOnOpen, >+ fileStore.getName()); >+ IDEWorkbenchPlugin.log(msg, e.getStatus()); >+ MessageDialog >+ .open( >+ MessageDialog.ERROR, >+ window.getShell(), >+ IDEWorkbenchMessages.OpenLocalFileAction_title, >+ msg, SWT.SHEET); >+ } >+ } else { >+ String msgFmt = IDEWorkbenchMessages.OpenLocalFileAction_message_fileNotFound; >+ String msg = NLS.bind(msgFmt, path); >+ MessageDialog.open(MessageDialog.ERROR, window.getShell(), IDEWorkbenchMessages.OpenLocalFileAction_title, msg, SWT.SHEET); >+ } >+ } >+ }); >+ } >+ }); >+ } >+ > /** > * Creates the display used by the application. > *
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 4922
:
83454
|
104405
|
104406
|
106356
|
106360
|
156681
|
156974
|
156991