[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Launching an editor programmatically

I am just starting to write a simple RCP application for administering login details held in a database. I have a view listing the logins and I'd like to launch a form based editor on double-click of an item in the list. The view is working fine. I've set up a double-click listener/action in the view - code for the action is....

doubleClickAction = new Action() {
           public void run() {
               ISelection selection = viewer.getSelection();
               ImsUser user = (ImsUser) ((IStructuredSelection) selection)
                       .getFirstElement();
               try {
                   PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                           .getActivePage().openEditor(
                                   new UserEditorInput(user.getUserId()),
                                   TestEditor.ID);
               } catch (PartInitException e) {
                   e.printStackTrace();
               }
           }

I also have an editor (which I've replaced with a test one for now) and an IEditorInput (UserEditorInput) which just stores the database ID of the record I'm wanting to edit to pass into the editor. Here's the top of the TestEditor...


public class TestEditor extends EditorPart {

   public static final String ID = "editors.testEditor";


..and here's the relevant bits from plugin.xml....


<extension
point="org.eclipse.ui.editors">
<editor
class="com.lledrsolutions.btcv.adminconsole.editors.UserEditor"
contributorClass="com.lledrsolutions.btcv.adminconsole.editors.UserEditorContributor"
default="false"
extensions="*"
id="com.lledrsolutions.btcv.adminconsole.editors.userEditor"
name="User Editor"/>
<editor
class="com.lledrsolutions.btcv.adminconsole.editors.TestEditor"
default="false"
id="editors.testEditor"
name="Test Editor"/>
</extension>



So, I've checked all the class names and IDs are correct but I'm getting...

org.eclipse.ui.PartInitException: Unable to open editor, unknown editor ID: editors.testEditor

..from the action in my View every time. So, I have two questions;

1. When working with editing database records, is this the right way to go (i.e. list/table View for searching records, Editor for editing a single record)?

2. If it is the right way to go, then what could be wrong here? I've spent a lot of time searching this site for this and generally it's always down to IDs being incorrect - I'm sure I've got this right (see above to prove me wrong!) so is there any other reason Eclipse wouldn't be able to find the Editor?