Example usage for org.eclipse.jface.wizard WizardDialog close

List of usage examples for org.eclipse.jface.wizard WizardDialog close

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard WizardDialog close.

Prototype

@Override
    public boolean close() 

Source Link

Usage

From source file:com.google.gdt.eclipse.gph.install.P2InstallerWizardPage.java

License:Open Source License

protected void performInstall() {
    if (performFinish()) {
        if (getContainer() instanceof WizardDialog) {
            WizardDialog dialog = (WizardDialog) getContainer();

            dialog.close();
        }//  w w w  .ja  v  a 2s. c om
    }
}

From source file:com.mentor.nucleus.bp.core.test.AssignRemoveEventsGenerics.java

License:Open Source License

public void testAssignEventToTransition() {
    test_id = "1";
    openISC();// w ww  .ja  v  a2 s . co m
    GraphicalEditor ce = ((ModelEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
            .getActiveEditor()).getGraphicalEditor();
    Shape_c shp = CanvasTestUtils.getModelStateShape(modelRoot, "Test State 1");
    GraphicalElement_c ge = GraphicalElement_c.getOneGD_GEOnR2(shp);
    Connector_c con = Connector_c.getOneGD_CONOnR20(Graphedge_c
            .getOneDIM_EDOnR320(Graphconnector_c.getManyDIM_CONsOnR311(Graphelement_c.getOneDIM_GEOnR23(ge))));
    GraphicalElement_c geCon = GraphicalElement_c.getOneGD_GEOnR2(con);
    Cl_c.Clearselection();
    selection.addToSelection(geCon.getRepresents());
    GenericPackageAssignEventOnSM_TXNAction aea = new GenericPackageAssignEventOnSM_TXNAction();
    Action a = new Action() {
    };
    aea.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) Selection.getInstance().getSelection();
    WizardDialog wd = aea.SM_TXN_GenericPackageAssignEvent(structuredSelection);
    GenericPackageAssignEventOnSM_TXNWizardPage1 aep = (GenericPackageAssignEventOnSM_TXNWizardPage1) wd
            .getCurrentPage();
    int itemCount = aep.EventCombo.getItemCount();
    assertEquals(3, itemCount);
    aep.onPageEntry();
    IWizard w = aep.getWizard();
    w.performFinish();
    wd.close();
    // test to see that event just assigned does not exist in combo list
    aea = new GenericPackageAssignEventOnSM_TXNAction();
    a = new Action() {
    };
    aea.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    wd = aea.SM_TXN_GenericPackageAssignEvent(structuredSelection);
    aep = (GenericPackageAssignEventOnSM_TXNWizardPage1) wd.getCurrentPage();
    assertEquals((itemCount - 1), aep.EventCombo.getItemCount());
    aep.getWizard().performCancel();
    doDiagram(ce);
    validateStateSEMEInstances("Test State 1");
}

From source file:com.mentor.nucleus.bp.core.test.AssignRemoveEventsGenerics.java

License:Open Source License

public void testIssue699Scenario() {
    //      _- Delete new state transition 
    //      _R Transition is deleted
    //      _- Remove event from another transition 
    //      _- Select Assign Event 
    //      _R Both events are available for assignment 
    //      _- Select the event from deleted transition
    //      _- Click Finish 
    //      _R The assign event wizard is closed
    //      _R The label is changed to the correct value
    test_id = "3";
    openISC();/*w w  w  .j a v  a 2 s  . c om*/
    GraphicalEditor ce = ((ModelEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
            .getActiveEditor()).getGraphicalEditor();
    Shape_c shp = CanvasTestUtils.getModelStateShape(modelRoot, "Test State 9");
    GraphicalElement_c ge = GraphicalElement_c.getOneGD_GEOnR2(shp);
    Connector_c con = Connector_c.getOneGD_CONOnR20(Graphedge_c
            .getOneDIM_EDOnR320(Graphconnector_c.getManyDIM_CONsOnR311(Graphelement_c.getOneDIM_GEOnR23(ge))));
    GraphicalElement_c geCon = GraphicalElement_c.getOneGD_GEOnR2(con);
    Cl_c.Clearselection();
    selection.addToSelection(geCon.getRepresents());
    DeleteAction da = new DeleteAction(CorePlugin.getImageDescriptor("delete_edit.gif"));
    da.run();
    doDiagram(ce);

    test_id = "4";
    shp = CanvasTestUtils.getModelStateShape(modelRoot, "Test State 1");
    ge = GraphicalElement_c.getOneGD_GEOnR2(shp);
    con = Connector_c.getOneGD_CONOnR20(Graphedge_c
            .getOneDIM_EDOnR320(Graphconnector_c.getManyDIM_CONsOnR311(Graphelement_c.getOneDIM_GEOnR23(ge))));
    geCon = GraphicalElement_c.getOneGD_GEOnR2(con);
    Cl_c.Clearselection();
    selection.addToSelection(geCon.getRepresents());
    RemoveEventOnSM_TXNAction rea = new RemoveEventOnSM_TXNAction();
    Action a = new Action() {
    };
    rea.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    rea.run(a);
    doDiagram(ce);

    CanvasTestUtils ctu = new CanvasTestUtils();
    StateMachineState_c sms = StateMachineState_c.StateMachineStateInstance(modelRoot,
            ctu.new findModelStateByName("Test State 6"));
    Transition_c tran = Transition_c.getOneSM_TXNOnR506(sms);
    assertTrue(tran.Actionfilter("event", "exists generic pkg"));
    assertFalse(tran.Actionfilter("event", "assigned"));

    test_id = "5";
    GenericPackageAssignEventOnSM_TXNAction aea = new GenericPackageAssignEventOnSM_TXNAction();
    a = new Action() {
    };
    aea.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) selection.getSelection();
    WizardDialog wd = aea.SM_TXN_GenericPackageAssignEvent(structuredSelection);
    GenericPackageAssignEventOnSM_TXNWizardPage1 aep = (GenericPackageAssignEventOnSM_TXNWizardPage1) wd
            .getCurrentPage();
    aep.onPageEntry();
    IWizard w = aep.getWizard();
    w.performFinish();
    wd.close();
    doDiagram(ce);

}

From source file:com.mentor.nucleus.bp.core.test.AssignRemoveEventsGenerics.java

License:Open Source License

public void testReplaceEventOnTransition() {
    test_id = "6";
    openISC();//from  w w  w .ja  va  2  s  . c om
    GraphicalEditor ce = ((ModelEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
            .getActiveEditor()).getGraphicalEditor();
    Shape_c shp = CanvasTestUtils.getModelStateShape(modelRoot, "Test State 1");
    GraphicalElement_c ge = GraphicalElement_c.getOneGD_GEOnR2(shp);
    Connector_c con = Connector_c.getOneGD_CONOnR20(Graphedge_c
            .getOneDIM_EDOnR320(Graphconnector_c.getManyDIM_CONsOnR311(Graphelement_c.getOneDIM_GEOnR23(ge))));
    GraphicalElement_c geCon = GraphicalElement_c.getOneGD_GEOnR2(con);
    Cl_c.Clearselection();
    selection.addToSelection(geCon.getRepresents());
    GenericPackageAssignEventOnSM_TXNAction aea = new GenericPackageAssignEventOnSM_TXNAction();
    Action a = new Action() {
    };
    aea.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) Selection.getInstance().getSelection();
    WizardDialog wd = aea.SM_TXN_GenericPackageAssignEvent(structuredSelection);
    GenericPackageAssignEventOnSM_TXNWizardPage1 aep = (GenericPackageAssignEventOnSM_TXNWizardPage1) wd
            .getCurrentPage();
    int itemCount = aep.EventCombo.getItemCount();
    assertEquals(2, itemCount);
    aep.onPageEntry();
    IWizard w = aep.getWizard();
    w.performFinish();
    // test to see that event just assigned does not exist in combo list
    aea = new GenericPackageAssignEventOnSM_TXNAction();
    a = new Action() {
    };
    aea.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    wd = aea.SM_TXN_GenericPackageAssignEvent(structuredSelection);
    aep = (GenericPackageAssignEventOnSM_TXNWizardPage1) wd.getCurrentPage();
    assertEquals(itemCount, aep.EventCombo.getItemCount());
    aep.getWizard().performCancel();
    wd.close();
    validateStateSEMEInstances("Test State 1");
    doDiagram(ce);
}

From source file:com.mentor.nucleus.bp.core.test.AttributeMenuItemTestGenerics.java

License:Open Source License

private Action addToId(String[] possible_ids) {
    Action a = new Action() {
    };/* w  w  w  .  ja  va2  s .c  om*/
    AddToIdentifierOnO_ATTRAction atia = new AddToIdentifierOnO_ATTRAction();
    atia.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) Selection.getInstance().getSelection();
    WizardDialog wd = atia.O_ATTR_AddToIdentifier(structuredSelection);
    AddToIdentifierOnO_ATTRWizardPage1 page = (AddToIdentifierOnO_ATTRWizardPage1) wd.getCurrentPage();
    page.IdentifierCombo.select(0);
    String[] items = page.IdentifierCombo.getItems();
    assertEquals(possible_ids.length, items.length);
    for (int i = 0; i < possible_ids.length; ++i) {
        assertEquals(possible_ids[i], items[i]);
    }
    IWizard w = page.getWizard();
    w.performFinish();
    wd.close();
    return a;
}

From source file:com.mentor.nucleus.bp.core.test.AttributeMenuItemTestGenerics.java

License:Open Source License

private void removefromId(String[] possible_ids) {
    RemoveFromIdentifierOnO_ATTRAction rfia = new RemoveFromIdentifierOnO_ATTRAction();
    Action a = new Action() {
    };//  ww w .j a va 2  s  .com
    rfia.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) Selection.getInstance().getSelection();
    WizardDialog wd = rfia.O_ATTR_RemoveFromIdentifier(structuredSelection);
    RemoveFromIdentifierOnO_ATTRWizardPage1 page = (RemoveFromIdentifierOnO_ATTRWizardPage1) wd
            .getCurrentPage();
    page.IdentifierCombo.select(0);
    String[] items = page.IdentifierCombo.getItems();
    assertEquals(possible_ids.length, items.length);
    for (int i = 0; i < possible_ids.length; ++i) {
        assertEquals(possible_ids[i], items[i]);
    }

    IWizard w = page.getWizard();
    wd.close();
    w.performFinish();
}

From source file:com.mentor.nucleus.bp.core.test.AttributeMenuItemTestGenerics.java

License:Open Source License

public void testFormalizeAfterMoveDown() {

    openTestPKGDiagram("Attribute Tests");
    ModelClass_c mc = ModelClass_c.ModelClassInstance(modelRoot,
            new ModelClass_by_name_c("testFormalizeAfterMoveDown"));
    Attribute_c top = Attribute_c.getOneO_ATTROnR102(mc, new Attribute_by_name_c("TestAttrFormalizerMoveDown"));
    Shape_c shp = CanvasTestUtils.getModelClassShape(modelRoot, "testFormalizeAfterMoveDown");
    Cl_c.Clearselection();/*from  www.  ja v  a  2s  .  c  o  m*/
    selection.addToSelection(top);
    Action a = new Action() {
    };
    MoveDownOnO_ATTRAction mda = new MoveDownOnO_ATTRAction();
    mda.run(a);
    GraphicalElement_c ge = GraphicalElement_c.getOneGD_GEOnR2(shp);
    Connector_c con = Connector_c.getOneGD_CONOnR20(Graphedge_c
            .getOneDIM_EDOnR320(Graphconnector_c.getManyDIM_CONsOnR311(Graphelement_c.getOneDIM_GEOnR23(ge))));
    GraphicalElement_c ge2 = GraphicalElement_c.getOneGD_GEOnR2(con);
    Cl_c.Clearselection();
    selection.addToSelection(ge2.getRepresents());
    BinaryFormalizeOnR_RELAction fa = new BinaryFormalizeOnR_RELAction();
    fa.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) Selection.getInstance().getSelection();
    WizardDialog wd = fa.R_REL_BinaryFormalize(structuredSelection);
    BinaryFormalizeOnR_RELWizardPage1 page1 = (BinaryFormalizeOnR_RELWizardPage1) wd.getCurrentPage();
    BinaryFormalizeOnR_RELWizardPage2 page2 = (BinaryFormalizeOnR_RELWizardPage2) page1.getNextPage();
    String strings[] = page1.Non_formalizerCombo.getItems();
    for (int i = 0; i < strings.length; ++i) {
        if (strings[i].equals("testFormalizeAfterMoveDown")) {
            page1.Non_formalizerCombo.select(i);
        }
    }
    page1.updateSelectedNon_formalizer();
    page2.onPageEntry();
    page1.onPageEntry();
    IWizard w = page1.getWizard();
    boolean exceptionCaught = false;
    try {
        w.performFinish();
    } catch (Exception e) {
        exceptionCaught = true;
    }
    wd.close();
    assertFalse(exceptionCaught);
    performTest("27");
}

From source file:com.mentor.nucleus.bp.core.test.AttributeMenuItemTestGenerics.java

License:Open Source License

public void testFormalizeAfterMoveUp() {

    openTestPKGDiagram("Attribute Tests");
    ModelClass_c mc = ModelClass_c.ModelClassInstance(modelRoot,
            new ModelClass_by_name_c("testFormalizeAfterMoveUp"));
    Attribute_c top = Attribute_c.getOneO_ATTROnR102(mc, new Attribute_by_name_c("TestAttrFormalizerMoveUp"));
    Shape_c shp = CanvasTestUtils.getModelClassShape(modelRoot, "testFormalizeAfterMoveUp");
    Cl_c.Clearselection();//w ww.j  ava  2  s .  co m
    selection.addToSelection(top);
    Action a = new Action() {
    };
    MoveUpOnO_ATTRAction mua = new MoveUpOnO_ATTRAction();
    mua.run(a);
    GraphicalElement_c ge = GraphicalElement_c.getOneGD_GEOnR2(shp);
    Connector_c con = Connector_c.getOneGD_CONOnR20(Graphedge_c
            .getOneDIM_EDOnR320(Graphconnector_c.getManyDIM_CONsOnR311(Graphelement_c.getOneDIM_GEOnR23(ge))));
    GraphicalElement_c ge2 = GraphicalElement_c.getOneGD_GEOnR2(con);
    Cl_c.Clearselection();
    selection.addToSelection(ge2.getRepresents());
    BinaryFormalizeOnR_RELAction fa = new BinaryFormalizeOnR_RELAction();
    fa.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) Selection.getInstance().getSelection();
    WizardDialog wd = fa.R_REL_BinaryFormalize(structuredSelection);
    BinaryFormalizeOnR_RELWizardPage1 page1 = (BinaryFormalizeOnR_RELWizardPage1) wd.getCurrentPage();
    BinaryFormalizeOnR_RELWizardPage2 page2 = (BinaryFormalizeOnR_RELWizardPage2) page1.getNextPage();
    String strings[] = page1.Non_formalizerCombo.getItems();
    for (int i = 0; i < strings.length; ++i) {
        if (strings[i].equals("testFormalizeAfterMoveUp")) {
            page1.Non_formalizerCombo.select(i);
        }
    }
    page1.updateSelectedNon_formalizer();
    page2.onPageEntry();
    page1.onPageEntry();
    IWizard w = page1.getWizard();
    boolean exceptionCaught = false;
    try {
        w.performFinish();
    } catch (Exception e) {
        exceptionCaught = true;
    }
    wd.close();
    assertFalse(exceptionCaught);
    performTest("28");
}

From source file:com.mentor.nucleus.bp.core.test.CombineSplitReferentialsTestGenerics.java

License:Open Source License

public void testTwoReferentialAttributesWithSameBaseTypes() {
    openTestPKGDiagram("TestCombineSplitReferentials");
    ModelClass_c mc = ModelClass_c.ModelClassInstance(modelRoot, new ModelClass_by_name_c("testTwoRefAttr"));
    Attribute_c[] ref_attrs = Attribute_c.getManyO_ATTRsOnR102(mc);
    Attribute_c ref_attr1 = ref_attrs[0];
    assertTrue(ref_attr1.Actionfilter("can", "combine"));
    assertFalse(ref_attr1.Actionfilter("can", "split"));

    Cl_c.Clearselection();//from  w ww .j a va  2 s  .com
    selection.addToSelection(ref_attr1);

    Action a = new Action() {
    };
    CombineWithOnO_ATTRAction cwooa = new CombineWithOnO_ATTRAction();
    cwooa.setActivePart(a,
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) selection.getSelection();
    WizardDialog wd = cwooa.O_ATTR_CombineWith(structuredSelection);
    CombineWithOnO_ATTRWizardPage1 page = (CombineWithOnO_ATTRWizardPage1) wd.getCurrentPage();
    String[] items = page.Combine_withCombo.getItems();
    assertEquals(1, items.length);
    assertEquals("attr1 (R9)", items[0]);
    page.Combine_withCombo.select(0);
    IWizard w = page.getWizard();
    w.performFinish();
    wd.close();
    performTest("4");

}

From source file:com.mentor.nucleus.bp.core.test.CombineSplitReferentialsTestGenerics.java

License:Open Source License

public void testSelectCombinedReferentialAttributes() {
    openTestPKGDiagram("TestCombineSplitReferentials");
    ModelClass_c mc = ModelClass_c.ModelClassInstance(modelRoot, new ModelClass_by_name_c("testTwoRefAttr"));
    Attribute_c[] ref_attrs = Attribute_c.getManyO_ATTRsOnR102(mc);
    Attribute_c ref_attr1 = ref_attrs[0];
    assertFalse(ref_attr1.Actionfilter("can", "combine"));
    assertTrue(ref_attr1.Actionfilter("can", "split"));

    Cl_c.Clearselection();//w w w .  j a  v  a  2 s . c  om
    selection.addToSelection(ref_attr1);

    Action a = new Action() {
    };
    SplitOnO_ATTRAction sooa = new SplitOnO_ATTRAction();
    sooa.setActivePart(a, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart());
    IStructuredSelection structuredSelection = (IStructuredSelection) selection.getSelection();
    WizardDialog wd = sooa.O_ATTR_Split(structuredSelection);
    SplitOnO_ATTRWizardPage1 page = (SplitOnO_ATTRWizardPage1) wd.getCurrentPage();
    String[] items = page.Split_fromCombo.getItems();
    assertEquals(2, items.length);
    assertEquals("e.attr1(R8)", items[0]);
    assertEquals("testOneRefAttr.attr1(R9)", items[1]);
    page.Split_fromCombo.select(0);
    IWizard w = page.getWizard();
    w.performFinish();
    wd.close();
    performTest("5");

}