Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Perspective Placeholder
Perspective Placeholder [message #1725163] Tue, 01 March 2016 10:28 Go to next message
Nin Pa is currently offline Nin PaFriend
Messages: 36
Registered: September 2013
Member
Hi,

I want to use a placeholder in a perspective so that I can dynamically add and remove views to / from it, accessing it from other classes. How is it possible?

It is possible to create a placeholder in a folder like this:

IFolderLayout folder = layout.createFolder("myview", IPageLayout.LEFT, 0.25f, editorArea);
folder.addPlaceholder("MyView:*");

Now i want to access it from the outside to add / remove views.

Additionally I want these dynamically added views to not be closeable.
Any ideas?

Thanks in advance!

[Updated on: Tue, 01 March 2016 10:33]

Report message to a moderator

Re: Perspective Placeholder [message #1728782 is a reply to message #1725163] Thu, 07 April 2016 10:43 Go to previous messageGo to next message
Sebastian Habenicht is currently offline Sebastian HabenichtFriend
Messages: 42
Registered: January 2013
Member
Hi,

this might be a way to do it: Create an IFolderLayout with the respective placeholder (just like you already suggested); make sure that the compound view id set to the placeholder matches with the ids of all views you want to show in the perspective. Then implement something like this somewhere:

try {

	// show the perspective in the active page
	final IWorkbenchPage page = PlatformUI.getWorkbench().showPerspective(MyPerspective.ID, window);

	// get references to all views currently visible on the page after the perspective has been opened
	final IViewReference[] viewRefs = page.getViewReferences();
	if (viewRefs != null) {

		// hide all views
		for (final IViewReference viewRef : viewRefs) {
			page.hideView(viewRef);
		}
	}
	
	//finally show the requested view
	page.showView(MyView.ID);
	
} catch (final WorkbenchException e) {
	// handle exception
}


As for not closable views: I am sorry, cannot help you with that one. Google returns quite a lot entries when searching for "eclipse view not closeable" - some approaches sound promising, just check it out.

Regards,
Sebastian
Re: Perspective Placeholder [message #1728788 is a reply to message #1728782] Thu, 07 April 2016 11:50 Go to previous message
Sebastian Habenicht is currently offline Sebastian HabenichtFriend
Messages: 42
Registered: January 2013
Member
Hi again,

concerning not closable views: I just tried one thing that I found in the google results...

I added a specific view initially to the perspective using the org.eclipse.ui.perspectiveExtensions extension point. In the extension element details of the perspective extension's sub entry 'view' you can set the closable flag to false. This opens the view without the close action in its tab (the context menu action is disabled as well).

Opening that view programmatically seems to respect this setting for this specific view in this specific perspective since the close button is never shown in its tab in this perspective.

Hope, this helps you.

Regards,
Sebastian

[Updated on: Thu, 07 April 2016 11:51]

Report message to a moderator

Previous Topic:[ANN] RAP 3.0 SR2 is available
Next Topic:[DND] RAP 3.0 SR1 Drag Modifiers
Goto Forum:
  


Current Time: Thu Mar 28 19:54:15 GMT 2024

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

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

Back to the top