Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-dev] Plug-in that Handles Specific File Types at Startup

Hi there,
 
I'm looking to implement an Eclipse Plug-in (an extension of the JDT Plug-in) which has what may be a somewhat unusual behavior/use case.
 
In a nutshell, I would like my users to be able to click a link in a web application, which would download an XML file, and cause Eclipse to be automatically launched -- via file association in the OS I'm thinking.
 
On startup, Eclipse would activate my Plug-in and somehow pass it the downloaded file (or a reference to it).  The Plug-in would use the metadata in the XML file to automatically initialize an appropriate project within the Workspace and ultimately leave the user in a "ready-to-work" state.
 
My specific questions are as follows:
 
1. Is there any generic Eclipse Platform mechanism of having the Workbench (and possibly a particular Plug-in and Workspace) registered with the host OS as the default handler for a given file extension/MIME type?
 
2. Is there a way for a Plug-in to be activated on startup and be given some arguments from the Eclipse command-line or access to a file specified on the command-line.  And can the Plugin then process this file to perform some startup/lifecyle tasks, such as creating a project?
 
a) Would registering a "faceless" (no UI) Editor (using the org.eclipse.ui.editors extension point) associated with specific file extensions be a possible solution?
 
b) Is it possible to implement such a silent & faceless Editor to process files transparently?  Can I do so by extending EditorPart, or is there another means?
 
c) Is it possible to launch an Editor to process a resource outside the scope of a project (i.e., where the project does not yet exist and where the file is not part of a project)?
 
3. Once the project is initialized, how do I manipulate the Workbench views in order to leave the user in a "ready to work" state.  By this I mean, perform tasks such as activate and give focus to the Java Editor on a given file and expand the Navigator on a particular node in the project/workspace.
 
Whew!  Sorry for the long post.  I've read through the Plug-in Developer Guide and related Javadoc but haven't quite found satisfactory answers.  Any help or suggestions anyone could provide would be greatly appreciated.  Thanks very much.
 
 
Sasha Haghani.

Back to the top