User Tools

Site Tools


blog:eclipse_editors_for_arbitrary_types

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
blog:eclipse_editors_for_arbitrary_types [2008/04/26 21:54]
djo created
blog:eclipse_editors_for_arbitrary_types [2014/10/17 22:08] (current)
Line 1: Line 1:
 +====== Eclipse Editors for Arbitrary Types ======
 +
 +Sometimes you can't use an Eclipse view to edit something in an RCP application;​ there are just times you need to be able to open multiple instances of your //editor//. Or maybe you need your editable //thing// to be able to interoperate with Eclipse'​s resources framework. For example, suppose you're implementing a web browser plug-in for Eclipse. You definitely would like the user to be able to open multiple web browser tabs. But how would you actually code this
 +up?
 +
 +On EclipsePowered,​ Paul Moore offers the following suggestion::​
 +
 +<​code>​
 +    Setting it up
 +
 +       1. Define an IEditorInput class
 +          This is used to pass information to the editor about what its supposed
 +          to be //editing// (a file name, a web page,…)
 +       2. Define an EditorPart class. This is like a view but the main
 +          difference is that it has an init method that takes as its second
 +          param an IEditorInput,​ this is your #1 object and it tells you what
 +          you are suppsoed to be editing
 +       3. Put the editor in the plugin manifest in the
 +          org.eclipse.ui.editors extension point
 +
 +    Now to use it
 +
 +       1. Create an instance of your IEditorInput
 +       2. Call IWorkBenchPage.openEditor
 +
 +          Pass in the editor input object you just made and the full id of the
 +          editor
 +
 +    Your EditorPart will get created and its init method will be
 +    called. Then the createPartControl will be run (just like a view).
 +</​code>​
 +
 +~~LINKBACK~~
 +~~DISCUSSION:​closed~~
  
blog/eclipse_editors_for_arbitrary_types.txt · Last modified: 2014/10/17 22:08 (external edit)