Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Opening a MultiPageEditorPart on a specific page
Opening a MultiPageEditorPart on a specific page [message #689456] Mon, 27 June 2011 16:49 Go to next message
Christophe Fondacci is currently offline Christophe FondacciFriend
Messages: 95
Registered: July 2009
Location: Paris
Member
Hello,

I am trying to open a multi page editor part on a specific page depending on a IEditorInput.

Actually, I think this is the exact same thing which is done by the PDE editor, when opening a build.properties file opens the PDE editor on the build page and opening a MANIFEST.MF opens the exact same editor and focuses on the overview page.

In my situation, I have several elements from a navigator (a custom navigator, not resource-based). These elements need to be opened in the exact same editor but corresponds to different page of this editor.

I would like the following behaviour :
* Opening element A opens the editor my.editor.id on element A page 1
* Opening element B, child of A, opens the editor my.editor.id on on element A page 2. If editor is already open on element A, it simply focus on page 2

Do I need to implement everything manually ? That is to say opening the editor, checking whether it is a MultiPageEditorPart, if so I could cast and find the corresponding editor manually.

Thank you for your help & time,
Christophe
http://www.nextep-softwares.com
Re: Opening a MultiPageEditorPart on a specific page [message #693749 is a reply to message #689456] Thu, 07 July 2011 06:54 Go to previous message
Christophe Fondacci is currently offline Christophe FondacciFriend
Messages: 95
Registered: July 2009
Location: Paris
Member
For anyone interested, I managed to implement this properly using features provided by the FormEditor (rather than MultiPageEditor aspect) :
try {
	final IEditorPart editor = activePage.openEditor(getEditorInput(model), getEditorId());
	if (editor instanceof FormEditor) {
		final FormEditor formEditor = (FormEditor) editor;
		formEditor.setActivePage(IUIService.PAGE_ID_PREFIX + model.getType().getId(), model);
	}
} catch (PartInitException e) {
	throw new ErrorException(e);
}


The idea here is to be able to build the page identifier of the editor from the input you have (here, the model object) and to invoke the setActivePage(pageId, formInput) method. Then, your IFormPart need to be responsive to the setFormInput to implement viewer selection of the given input.

The result is that the editor will open, appropriate page will be focused and selection will be made in the page's viewer (for example a master / details block).

Hope this could help anyone,
Christophe
http://www.nextep-softwares.com
Previous Topic:org.eclipse.ui.navigator.CommonNavigator
Next Topic:RCP via Web-Start i18n
Goto Forum:
  


Current Time: Sat Apr 20 12:52:19 GMT 2024

Powered by FUDForum. Page generated in 0.03736 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top