design report perspective - eclipse rcp - eclipse-rcp

i want to open the Design Report perspective from code (perhaps when I double click a report, the perspective should open) in a rcp eclipse application and I do not know where to start.
could anyone help me and tell where to begin, what are the first steps.
thank you very much

String perspId = "some.perspective.id";
IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IPerspectiveRegistry reg = PlatformUI.getWorkbench().getPerspectiveRegistry();
w.getActivePage().setPerspective(reg.findPerspectiveWithId(perspId));

Related

New eclipse workbench window always on top

I am developing an eclipse plugin.
My plugin works in say "XYZ" workbench window.
My plugin opens up a new workbench window say "ABC" using
PlatformUI.getWorkbench().openWorkbenchWindow(PERSPECTIVE_ID, null);
now , I want this window("ABC") to be always on top of previous window "XYZ", which in turn means, no one can use the window "XYZ" until some operations('Close', 'Ok', 'Cancel') happen on window "ABC" ......
Can someone help me with this, please ?
Thanks in advance !
You can't make Workbench Windows work like this.
You either have to use a dialog or deal with the fact that the other workbench windows can be used.

Eclipse RCP - limit help view to a single perspective

In my RCP application when I open Help view using PlatformUI.getWorkbench().getHelpSystem().displayContext() method it appears in all perspectives, not only the currently active. Is it possible to limit it only to the current perspective?
I don't think there is any support for this in the help system.
You could perhaps install an IPerspectiveListener (or IPerspectiveListener4) on the workbench page to listen for the changes to the perspective and manually close the help (the help is in a view called org.eclipse.help.ui.HelpView).

How to get resource object in RCP App

I use CNF to make a view like Project Explorer in my RCP app. I'm done showing new menu and its submenu when user right clicks on a project in the view.
But when user click on a submenu (for this case, a method library going to be created), I need to know which project object that user has right-clicked on.
My question is how can I do that? Please help me.
Thank you all,
Nautilus
I think the wiki page E4/EAS/Selection should provide a way to query the right selection.
In Eclipse 3.x, the org.eclipse.ui.ISelectionService allows workbench parts to query the active selection in addition to attaching listeners for monitoring selection changes.
(see this example)
In the e4 world, selection is propagated with the ESelectionService.
Thank VonC,
Now I got the resource object that user has right-clicked on by doing this:
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
CommonNavigator view = (CommonNavigator)page.findView("spe.ui.navigator.view");
selection = (IStructuredSelection) view.getSite().getSelectionProvider().getSelection();
But I'm really not happy completely with the solution. Note that I open a INewWizard after the action. In the INewWizard we have public void init(IWorkbench workbench, IStructuredSelection selection). I really want to use this method but I don't how to make it work.
Please, someone help me.
Thanks

How to access GWT designer view on eclipse

I havent yet found a way to view GWT designer mode. I have installed gwt sdk, gwt designer and window builder on eclipse 4.2. View my installation details:
I Can open a java file using window builder but cant see the source and design tabs at the bottom:
Somebody help me figure out how to access designer mode.
right click on the file and select open in designer
Right click on your uibinder file (ui.xml). Then select windowbuilder. You may need to click "other" and then select windowbuilder from the list.
Turns out its a bug and i was able to access designer mode by clicking switching between to a different layout under Google > Web Toolkit > Designer preferences
Thanks for providing answers guys :)

How to get from an EditPart to its Editor in Eclipse? (Eclipse plug-in development)

I am writing an eclipse plug-in that extends editor. Inside the editor I put some EditParts. From some of these edit parts I need a reference to their encapsulating editor (so that for example, when clicking an instance of MyEditPart, I want to programmatically close the editor).
Please advise on the API to get from an EditPart instance to the Editor it is in.
Thanks.
You can try:
IEditorPart editor = ((DefaultEditDomain) getViewer().getEditDomain()).getEditorPart();
from the EditPart.