Example usage for org.eclipse.jface.wizard IWizard performCancel

List of usage examples for org.eclipse.jface.wizard IWizard performCancel

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard IWizard performCancel.

Prototype

boolean performCancel();

Source Link

Document

Performs any actions appropriate in response to the user having pressed the Cancel button, or refuse if canceling now is not permitted.

Usage

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

License:Open Source License

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

    Cl_c.Clearselection();/*w  w  w. ja va  2 s .c o m*/
    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 (R11)", items[0]);
    page.Combine_withCombo.select(0);
    IWizard w = page.getWizard();
    w.performCancel();
    wd.close();
    performTest("6");
}

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

License:Open Source License

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

    Cl_c.Clearselection();//from w  ww  . j  a  v  a2s  .c  o m
    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("f.attr2(R18)", items[0]);
    assertEquals("testNonRefAttr.attr2(R19)", items[1]);
    page.Split_fromCombo.select(0);
    IWizard w = page.getWizard();
    w.performCancel();
    wd.close();
    performTest("7");

}

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

License:Open Source License

/**
 * Asserts that E is present (or absent, depending on the given
 * parameter) in the given combo being shown in the given wizard.
 * If absence is checked for, the dialog is cancelled. 
 *///from ww  w. j ava  2  s.c o  m
private void checkForPresenceOrAbsenceOfEInList(Combo combo, boolean checkForPresence, IWizard wizard) {
    // check that event E is (or isn't, according to the given switch) 
    // one of the available choices
    final String eLabel = "KEY_A1: E";
    int index = combo.indexOf(eLabel);
    assertTrue("Event E is " + (checkForPresence ? "not " : "") + "available for selection.",
            checkForPresence ? index != -1 : index == -1);

    // if absence is being checked for 
    if (!checkForPresence) {
        // cancel the dialog, since we know there will be nothing to select
        wizard.performCancel();
    }

    // otherwise
    else {
        // select E in the combo, in case the caller is going to finish
        // the wizard
        combo.select(index);
    }
}

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

License:Open Source License

/**
 * Asserts that the event of the given label is present (or absent,
 * depending on the given parameter) in the given combo being shown in the
 * given wizard. If absence is checked for, the dialog is cancelled.
 *//* w  ww .j  a  v a  2 s. c o m*/
private static void checkForPresenceOrAbsenceOfEventInList(String eventLabel, Combo combo,
        boolean checkForPresence, IWizard wizard) {
    // check that the event of the given label is (or isn't, 
    // according to the given switch) one of the available choices
    int index = combo.indexOf(eventLabel);
    TestCase.assertTrue(
            "Event " + eventLabel + " is " + (checkForPresence ? "not " : "") + "available for selection.",
            checkForPresence ? index != -1 : index == -1);

    // if absence is being checked for
    if (!checkForPresence) {
        // cancel the dialog, since we know there will be nothing to select
        wizard.performCancel();
    }

    // otherwise
    else {
        // select the event of the given label in the combo, in case the 
        // caller is going to finish the wizard
        combo.select(index);
    }
}

From source file:net.rim.ejde.internal.ui.wizards.templates.NewBBTemplateWizard.java

License:Open Source License

public boolean performCancel() {
    BBFieldData data = (BBFieldData) getData();
    IWizard masterWizard = data.getMasterWizard();
    return masterWizard.performCancel();
}

From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java

License:Open Source License

public boolean doCancel() {
    final IWizard wizard = getWizard();

    if (wizard == null)
        return false;

    if (wizard.performCancel()) {
        setWizard(null, IWizardContainerListener.REASON_CANCELED);
        return true;
    }/*from www. j  av a 2  s. c om*/

    return false;
}

From source file:org.xtuml.bp.core.test.CombineSplitReferentialsTestGenerics.java

License:Open Source License

private void doCombineDialog(Attribute_c attr, String[] expectedAttrs, int selectedItem, boolean doFinish) {
    Cl_c.Clearselection();//from   w w w  .  ja v  a 2  s . c om
    selection.addToSelection(attr);

    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(expectedAttrs.length, items.length);
    for (int i = 0; i < expectedAttrs.length; ++i) {
        assertEquals(expectedAttrs[i], items[i]);
    }
    page.Combine_withCombo.select(selectedItem);
    IWizard w = page.getWizard();
    if (doFinish) {
        w.performFinish();
    } else {
        w.performCancel();
    }
    wd.close();
}