Search in sources :

Example 1 with IWindowListener

use of org.eclipse.ui.IWindowListener in project gfm_viewer by satyagraha.

the class DIManagerTest method shouldStopNormally.

@Test
public void shouldStopNormally() {
    // given
    // when
    DIManager.start(workbench, bundleContext, packagePrefix, debugging);
    DIManager.stop();
    // then
    IWindowListener windowListener = windowListenerCaptor.getValue();
    assertThat(windowListener, notNullValue());
    verify(workbench, times(1)).removeWindowListener(eq(windowListener));
}
Also used : IWindowListener(org.eclipse.ui.IWindowListener) Test(org.junit.Test)

Example 2 with IWindowListener

use of org.eclipse.ui.IWindowListener in project gfm_viewer by satyagraha.

the class DIManagerTest method shouldInstantiateNewPluginScopeComponentWhenNewWindow.

@Test
public void shouldInstantiateNewPluginScopeComponentWhenNewWindow() throws Exception {
    // given
    // when
    DIManager.start(workbench, bundleContext, packagePrefix, debugging);
    InjectedPageClass injectedPageClassInstance1 = DIManager.getDefault().getInjector(Scope.PAGE).getInstance(InjectedPageClass.class);
    // given
    given(workbench.getActiveWorkbenchWindow()).willReturn(workbenchWindow2);
    // when
    IWindowListener windowListener = windowListenerCaptor.getValue();
    windowListener.windowOpened(workbenchWindow2);
    InjectedPageClass injectedPageClassInstance2 = DIManager.getDefault().getInjector(Scope.PAGE).getInstance(InjectedPageClass.class);
    // then
    assertThat(injectedPageClassInstance2, not(sameInstance(injectedPageClassInstance1)));
}
Also used : IWindowListener(org.eclipse.ui.IWindowListener) Test(org.junit.Test)

Example 3 with IWindowListener

use of org.eclipse.ui.IWindowListener in project gfm_viewer by satyagraha.

the class DIManagerTest method shouldStartNormally.

@Test
public void shouldStartNormally() {
    // given
    // when
    DIManager.start(workbench, bundleContext, packagePrefix, debugging);
    // then
    verify(workbench, times(1)).addWindowListener(any(IWindowListener.class));
    IWindowListener windowListener = windowListenerCaptor.getValue();
    assertThat(windowListener, notNullValue());
}
Also used : IWindowListener(org.eclipse.ui.IWindowListener) Test(org.junit.Test)

Aggregations

IWindowListener (org.eclipse.ui.IWindowListener)3 Test (org.junit.Test)3