views:

191

answers:

3

Hi all,

I'd like to add an editor to an RCP application. I need to leverage the advanced features of editor, such as keywords highlighting. But it seems that editor have to be associated with an IEditorInput, but I just do not need to persistence the text, store it in memory is OK for me. Is there any way to do that ? Thanks

-- Best Regards

Jeff Zhang

A: 

Why can't you create an implementation of IEditorInput that doesn't persist the text?

nanda
A: 

Becuase I have to use an IResource to create FileEditorInput, the is my code in ApplicationWorkbenchWindowAdvisor, but it doesn't work, any clues ?

@Override
    public void postWindowOpen() {
        super.postWindowOpen();

        IWorkbenchWindow window = PigGUIActivator.getDefault().getWorkbench()
                .getActiveWorkbenchWindow();
        IWorkbenchPage page = window.getActivePage();

        try {

            Resource resource = new Workspace().newResource(new Path
                    ("/pig.latin"), IResource.FILE);
            page.openEditor(new FileEditorInput((IFile) resource),
                            PigEditor.Id);
        } catch (PartInitException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
zjffdu