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 156991 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]
Wokbench patch updated
patch file open 6.txt (text/plain), 11.48 KB, created by
Oleg Besedin
on 2010-01-22 15:09:20 EST
(
hide
)
Description:
Wokbench patch updated
Filename:
MIME Type:
Creator:
Oleg Besedin
Created:
2010-01-22 15:09:20 EST
Size:
11.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java,v >retrieving revision 1.71 >diff -u -r1.71 IDEWorkbenchMessages.java >--- src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java 10 Dec 2009 11:21:22 -0000 1.71 >+++ src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java 22 Jan 2010 20:06:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2009 IBM Corporation and others. >+ * Copyright (c) 2005, 2010 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 >@@ -868,6 +868,10 @@ > public static String UnsupportedVM_message; > > public static String IDEWorkbenchActivityHelper_jobName; >+ >+ public static String OpenDelayedFileAction_title; >+ public static String OpenDelayedFileAction_message_errorOnOpen; >+ public static String OpenDelayedFileAction_message_fileNotFound; > > static { > // load message values from bundle file >Index: src/org/eclipse/ui/internal/ide/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/messages.properties,v >retrieving revision 1.182 >diff -u -r1.182 messages.properties >--- src/org/eclipse/ui/internal/ide/messages.properties 10 Dec 2009 16:55:18 -0000 1.182 >+++ src/org/eclipse/ui/internal/ide/messages.properties 22 Jan 2010 20:06:25 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2009 IBM Corporation and others. >+# Copyright (c) 2000, 2010 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 >@@ -881,4 +881,9 @@ > SystemSettingsChange_no = No > > UnsupportedVM_message=GCJ has been detected as the current Java virtual machine. Use of GCJ is untested and unsupported. Please consult the documentation for more information. >-IDEWorkbenchActivityHelper_jobName=Update Capability Enablement for Natures >\ No newline at end of file >+IDEWorkbenchActivityHelper_jobName=Update Capability Enablement for Natures >+ >+OpenDelayedFileAction_title = Open File >+OpenDelayedFileAction_message_errorOnOpen = The file ''{0}'' could not be opened.\nSee log for details. >+OpenDelayedFileAction_message_fileNotFound= The file ''{0}'' could not be found. >+ >#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 22 Jan 2010 20:06:26 -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/DelayedEventsProcessor.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/ide/application/DelayedEventsProcessor.java >diff -N src/org/eclipse/ui/internal/ide/application/DelayedEventsProcessor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/ide/application/DelayedEventsProcessor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,115 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 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.ui.internal.ide.application; >+ >+import java.util.ArrayList; >+ >+import org.eclipse.core.filesystem.EFS; >+import org.eclipse.core.filesystem.IFileInfo; >+import org.eclipse.core.filesystem.IFileStore; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.jface.dialogs.MessageDialog; >+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.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.ide.IDEWorkbenchMessages; >+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; >+ >+/** >+ * Helper class used to process delayed events. >+ * Events currently supported: >+ * <ul> >+ * <li>SWT.OpenDoc</li> >+ * </ul> >+ * @since 3.3 >+ */ >+public class DelayedEventsProcessor implements Listener { >+ >+ private ArrayList filesToOpen = new ArrayList(1); >+ >+ /** >+ * Constructor. >+ * @param display display used as a source of event >+ */ >+ public DelayedEventsProcessor(Display display) { >+ display.addListener(SWT.OpenDoc, this); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) >+ */ >+ public void handleEvent(Event event) { >+ final String path = event.text; >+ if (path == null) >+ return; >+ // If we start supporting events that can arrive on a non-UI thread, the following >+ // line will need to be in a "synchronized" block: >+ filesToOpen.add(path); >+ } >+ >+ /** >+ * Process delayed events. >+ * @param display display associated with the workbench >+ */ >+ public void catchUp(Display display) { >+ if (filesToOpen.isEmpty()) >+ return; >+ >+ // If we start supporting events that can arrive on a non-UI thread, the following >+ // lines will need to be in a "synchronized" block: >+ String[] filePaths = new String[filesToOpen.size()]; >+ filesToOpen.toArray(filePaths); >+ filesToOpen.clear(); >+ >+ for(int i = 0; i < filePaths.length; i++) { >+ openFile(display, filePaths[i]); >+ } >+ } >+ >+ private void openFile(Display display, final String path) { >+ 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.OpenDelayedFileAction_message_errorOnOpen, >+ fileStore.getName()); >+ IDEWorkbenchPlugin.log(msg, e.getStatus()); >+ MessageDialog.open(MessageDialog.ERROR, window.getShell(), >+ IDEWorkbenchMessages.OpenDelayedFileAction_title, >+ msg, SWT.SHEET); >+ } >+ } else { >+ String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_fileNotFound, path); >+ MessageDialog.open(MessageDialog.ERROR, window.getShell(), >+ IDEWorkbenchMessages.OpenDelayedFileAction_title, >+ msg, SWT.SHEET); >+ } >+ } >+ }); >+ } >+ >+} >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 22 Jan 2010 20:06:26 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2008 IBM Corporation and others. >+ * Copyright (c) 2003, 2010 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 >@@ -86,6 +86,8 @@ > */ > public Object start(IApplicationContext appContext) throws Exception { > Display display = createDisplay(); >+ // processor must be created before we start event loop >+ DelayedEventsProcessor processor = new DelayedEventsProcessor(display); > > try { > >@@ -111,7 +113,7 @@ > // the workbench globally so that all UI plug-ins can find it using > // PlatformUI.getWorkbench() or AbstractUIPlugin.getWorkbench() > int returnCode = PlatformUI.createAndRunWorkbench(display, >- new IDEWorkbenchAdvisor()); >+ new IDEWorkbenchAdvisor(processor)); > > // the workbench doesn't support relaunch yet (bug 61809) so > // for now restart is used, and exit data properties are checked >Index: src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java,v >retrieving revision 1.24 >diff -u -r1.24 IDEWorkbenchAdvisor.java >--- src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java 13 Oct 2009 09:28:11 -0000 1.24 >+++ src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java 22 Jan 2010 20:06:26 -0000 >@@ -144,6 +144,11 @@ > private AbstractStatusHandler ideWorkbenchErrorHandler; > > /** >+ * Helper class used to process delayed events. >+ */ >+ private DelayedEventsProcessor delayedEventsProcessor; >+ >+ /** > * Creates a new workbench advisor instance. > */ > public IDEWorkbenchAdvisor() { >@@ -154,6 +159,15 @@ > workbenchAdvisor = this; > } > >+ /** >+ * Creates a new workbench advisor instance supporting delayed file open. >+ * @param processor helper class used to process delayed events >+ */ >+ public IDEWorkbenchAdvisor(DelayedEventsProcessor processor) { >+ this(); >+ this.delayedEventsProcessor = processor; >+ } >+ > /* > * (non-Javadoc) > * >@@ -852,4 +866,13 @@ > } > return ideWorkbenchErrorHandler; > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.application.WorkbenchAdvisor#eventLoopIdle(org.eclipse.swt.widgets.Display) >+ */ >+ public void eventLoopIdle(Display display) { >+ if (delayedEventsProcessor != null) >+ delayedEventsProcessor.catchUp(display); >+ super.eventLoopIdle(display); >+ } > }
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