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

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

Introduction

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

Prototype

@Override
    public IWizardPage getCurrentPage() 

Source Link

Usage

From source file:ac.soton.fmusim.components.diagram.edit.parts.FMUComponentVariablesCompartmentEditPart.java

License:Open Source License

/**
 * @generated NOT/*from   w  ww.java 2s.c  o m*/
 */
@Override
public void performRequest(Request req) {
    if (req.getType() == RequestConstants.REQ_OPEN) {
        Object element = this.getParent();

        //Get FMUComponent's FMU File's path
        if (element instanceof FMUComponentEditPart) {
            FMUComponentEditPart editpart = (FMUComponentEditPart) element;
            FMUComponent original = (FMUComponent) editpart.resolveSemanticElement();
            ComponentsPaletteFactory cpf = new ComponentsPaletteFactory();

            EditDomain ed = editpart.getViewer().getEditDomain();

            FMUComponent comp = EcoreUtil.copy(original);

            cpf.fillPalette(ed.getPaletteViewer().getPaletteRoot(), comp);

            String path = comp.getPath();

            //Retrieve FMUComponent's ports
            List<FMUVariable> internals = new ArrayList<FMUVariable>();
            List<FMUVariable> inports = new ArrayList<FMUVariable>();
            List<FMUVariable> outports = new ArrayList<FMUVariable>();

            for (int i = 0; i < comp.getInputs().size(); i++) {
                inports.add(new FMUVariable(comp.getInputs().get(i).getName().toString()));
            }
            for (int j = 0; j < comp.getOutputs().size(); j++) {
                outports.add(new FMUVariable(comp.getOutputs().get(j).getName().toString()));
            }
            for (int k = 0; k < comp.getVariables().size(); k++) {
                internals.add(new FMUVariable(comp.getVariables().get(k).getName().toString()));
            }

            FMUVariable[] FMUInternals = internals.toArray(new FMUVariable[internals.size()]);
            FMUVariable[] FMUInports = inports.toArray(new FMUVariable[inports.size()]);
            FMUVariable[] FMUOutports = outports.toArray(new FMUVariable[outports.size()]);

            List<FMUVariable[]> checkedLists = new ArrayList<FMUVariable[]>();
            checkedLists.add(FMUInternals);
            checkedLists.add(FMUInports);
            checkedLists.add(FMUOutports);

            //Open WizardStart at page 2
            if (path != null) {
                WizardStart ws = new WizardStart();
                ws.setFilePath(path);
                WizardDialog dial = new WizardDialog(new Shell(), ws);
                dial.create();
                DisplayFMUInfo dfi = (DisplayFMUInfo) dial.getCurrentPage().getNextPage();
                dfi.setChecker(checkedLists);
                dial.showPage(dfi);
                dial.open();
            }
        }
    }
}

From source file:com.centurylink.mdw.plugin.designer.properties.editor.ParameterizedCombo.java

License:Apache License

@SuppressWarnings("restriction")
private WorkflowAsset createParamAsset(String[] paramTypes) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    org.eclipse.ui.internal.dialogs.NewWizard wizard = new org.eclipse.ui.internal.dialogs.NewWizard();
    wizard.setCategoryId("mdw.designer.asset");
    wizard.init(workbench, new StructuredSelection(new Object[] { workflowElement.getPackage() }));

    IDialogSettings workbenchSettings = org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.getDefault()
            .getDialogSettings();//from   w ww . j  ava2s.c  o  m
    IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");
    if (wizardSettings == null)
        wizardSettings = workbenchSettings.addNewSection("NewWizardAction");
    wizardSettings.put("NewWizardSelectionPage.STORE_SELECTED_ID", getWizardId(paramTypes));
    wizard.setDialogSettings(wizardSettings);
    wizard.setForcePreviousAndNextButtons(true);

    WizardDialog dialog = new WizardDialog(null, wizard);
    dialog.create();
    dialog.open();

    IWizardPage wizardPage = dialog.getCurrentPage();
    if (wizardPage instanceof WorkflowAssetPage)
        return ((WorkflowAssetPage) wizardPage).getWorkflowAsset();
    else
        return null;
}

From source file:com.centurylink.mdw.plugin.designer.properties.editor.WorkflowAssetEditor.java

License:Apache License

@SuppressWarnings("restriction")
private WorkflowElement createWorkflowAsset() {
    if (isProcess()) {
        WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
        actionHandler.create(WorkflowProcess.class, getElement().getPackage());
        return null;
    } else {//from  ww w.  j  a  v a2 s .c om
        IWorkbench workbench = PlatformUI.getWorkbench();
        org.eclipse.ui.internal.dialogs.NewWizard wizard = new org.eclipse.ui.internal.dialogs.NewWizard();
        wizard.setCategoryId("mdw.designer.asset");
        wizard.init(workbench, new StructuredSelection(new Object[] { getElement().getPackage() }));

        IDialogSettings workbenchSettings = org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.getDefault()
                .getDialogSettings();
        IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");
        if (wizardSettings == null)
            wizardSettings = workbenchSettings.addNewSection("NewWizardAction");
        wizardSettings.put("NewWizardSelectionPage.STORE_SELECTED_ID", getWizardId());
        wizard.setDialogSettings(wizardSettings);
        wizard.setForcePreviousAndNextButtons(true);
        if (isTaskTemplate() && getElement() instanceof Activity) {
            Activity activity = (Activity) getElement();
            if (activity.isAutoFormManualTask())
                wizardSettings.put(TaskTemplate.TASK_TYPE, TaskTemplate.AUTOFORM);
            else
                wizardSettings.put(TaskTemplate.TASK_TYPE, TaskTemplate.CUSTOM);
        }

        WizardDialog dialog = new WizardDialog(null, wizard);
        dialog.create();
        dialog.open();

        IWizardPage wizardPage = dialog.getCurrentPage();
        if (wizardPage instanceof WorkflowAssetPage)
            return ((WorkflowAssetPage) wizardPage).getWorkflowAsset();
    }

    return null;
}

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

License:Open Source License

public void testAssignEventToTransition() {
    test_id = "1";
    openISC();/*w  w  w  . ja  v  a 2 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 av 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();/*  w  ww  . j a 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(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() {
    };//from  w ww  . ja v  a  2  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

public void testRemoveFromIdentifier() {
    openTestPKGDiagram("Attribute Tests");

    ModelClass_c mc = ModelClass_c.ModelClassInstance(modelRoot, new ModelClass_by_name_c("testOneAttribute"));
    Attribute_c attr = Attribute_c.getOneO_ATTROnR102(mc, new Attribute_by_name_c("one"));
    assertFalse(attr.Actionfilter("id", "not all"));
    assertTrue(attr.Actionfilter("id", "some"));
    Cl_c.Clearselection();/*from w ww  . j av  a  2s  .  co  m*/
    selection.addToSelection(attr);
    removefromId(new String[] { "*1", "*2", "*3" });
    performTest("12");
    assertTrue(attr.Actionfilter("id", "not all"));
    assertTrue(attr.Actionfilter("id", "some"));

    removefromId(new String[] { "*2", "*3" });
    performTest("13");
    assertTrue(attr.Actionfilter("id", "not all"));
    assertTrue(attr.Actionfilter("id", "some"));

    removefromId(new String[] { "*3" });
    performTest("14");
    assertTrue(attr.Actionfilter("id", "not all"));
    assertFalse(attr.Actionfilter("id", "some"));

    Action a = new Action() {
    };
    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();
    String[] items = page.IdentifierCombo.getItems();
    assertEquals(3, items.length);
    assertEquals("*1", items[0]);
    assertEquals("*2", items[1]);
    assertEquals("*3", items[2]);

}

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() {
    };/*from   w  w w.j  a va2  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.  jav  a2  s .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");
}