Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Juno RC4 - Problem with JUnit Plugin Tests
Juno RC4 - Problem with JUnit Plugin Tests [message #887834] Sun, 17 June 2012 04:05 Go to next message
Bernard SARTER is currently offline Bernard SARTER
Messages: 75
Registered: August 2011
Location: Paris, France
Member
Hello,

I have a RCP app and Junit plugin tests developed for Indigo and I'm trying to migrate to Juno.

For the RCP app, it's Ok.
For the JUnit tests, I have a problem, if inside a test I try to call:

PlatformUI.getWorkbench().showPerspective("myPerspective",PlatformUI.getWorkbench().getActiveWorkbenchWindow());

nothing happens, ie myPerspective is not displayed automatically.

More generally, the window that is displayed when I run my JUnit Plugin test does NOT contain the menu bar, the status bar, the quick view area, ... it contains only the content (the views) of my default perspective.

I tried to dedug, and I confirm that the code of my preWindowOpen() is executed by the JUnit test, but that the window which is created just after does NOT contain the corresponding bars.
I do NOT have this problem when I start the RCP app normally ...

@Override
public void preWindowOpen() {
	IWorkbenchWindowConfigurer configurer = getWindowConfigurer();

    configurer.setTitle(myApp");
    configurer.setInitialSize(new Point(1024, 768));
    configurer.setShowCoolBar(true);
    configurer.setShowPerspectiveBar(true);
    configurer.setShowProgressIndicator(true);
    configurer.setShowFastViewBars(true);
    configurer.setShowMenuBar(true);
    IPreferenceStore apiStore = PlatformUI.getPreferenceStore();
    apiStore.setValue(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR,
				"TOP_RIGHT");
    configurer.setShowStatusLine(true);
}


Any suggestion welcome ...

Best regards,
Bernard.
Re: Juno RC4 - Problem with JUnit Plugin Tests [message #951295 is a reply to message #887834] Sat, 20 October 2012 11:55 Go to previous message
Bernard SARTER is currently offline Bernard SARTER
Messages: 75
Registered: August 2011
Location: Paris, France
Member

Okay, I found the solution (or at least a suitable workaround) here: http://stackoverflow.com/questions/11523187/switch-perspective-in-a-rcp-application-since-eclipse-juno:

IWorkbenchWindow window = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry();
IWorkbenchPage page = window.getActivePage();
        
page.setPerspective(registry.findPerspectiveWithId(myPerspective.ID));
Previous Topic:MenuContribution for org.eclipse.ui.internal.CloseOthersHandler
Next Topic:Error while installing a signed eclipse plugin
Goto Forum:
  


Current Time: Thu Aug 21 10:18:16 EDT 2014

Powered by FUDForum. Page generated in 0.06708 seconds