Example usage for org.eclipse.jface.dialogs IDialogConstants BACK_LABEL

List of usage examples for org.eclipse.jface.dialogs IDialogConstants BACK_LABEL

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants BACK_LABEL.

Prototype

String BACK_LABEL

To view the source code for org.eclipse.jface.dialogs IDialogConstants BACK_LABEL.

Click Source Link

Document

The label for back buttons.

Usage

From source file:com.codesourcery.internal.installer.ui.WizardDialog.java

License:Open Source License

/**
 * Creates the Previous and Next buttons for this wizard dialog. Creates
 * standard (<code>SWT.PUSH</code>) buttons and registers for their
 * selection events. Note that the number of columns in the button bar
 * composite is incremented. These buttons are created specially to prevent
 * any space between them.//from  ww w  .  ja  va2  s. co  m
 * 
 * @param parent
 *            the parent button bar
 * @return a composite containing the new buttons
 */
private Composite createPreviousAndNextButtons(Composite parent) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // will be incremented by createButton
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);

    // make sure screen readers skip visual '<', '>' chars on buttons:
    final String backReaderText = IDialogConstants.BACK_LABEL.replace('<', ' ');
    backButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
        public void getName(AccessibleEvent e) {
            e.result = backReaderText;
        }
    });
    final String nextReaderText = IDialogConstants.NEXT_LABEL.replace('>', ' ');
    nextButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
        public void getName(AccessibleEvent e) {
            e.result = nextReaderText;
        }
    });
    return composite;
}

From source file:com.google.dart.tools.ui.internal.dialogs.MultiElementListSelectionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fBackButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    fNextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);
    fFinishButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.FINISH_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:es.cv.gvcase.ide.navigator.dialogs.NavigatorSearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    backButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    backButton.setEnabled(false);// w ww.  j a  va  2  s. c  o  m
    backButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ISelection sel = viewer.getSelection();
            if (!(sel instanceof StructuredSelection)) {
                return;
            }
            StructuredSelection ssel = (StructuredSelection) sel;

            int index = matchedObjects.lastIndexOf(ssel.getFirstElement());
            if (index == 0) {
                index = matchedObjects.size() - 1;
            }
            index--;
            if (index < 0) {
                index = 0;
            }
            StructuredSelection ss = new StructuredSelection(matchedObjects.get(index));
            viewer.setSelection(ss, true);
        }
    });

    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    nextButton.setEnabled(false);
    nextButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ISelection sel = viewer.getSelection();
            if (!(sel instanceof StructuredSelection)) {
                return;
            }
            StructuredSelection ssel = (StructuredSelection) sel;

            int index = matchedObjects.lastIndexOf(ssel.getFirstElement());
            if (index == matchedObjects.size() - 1) {
                index = -1;
            }
            index++;
            StructuredSelection ss = new StructuredSelection(matchedObjects.get(index));
            viewer.setSelection(ss, true);
        }
    });

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
}

From source file:eu.numberfour.n4js.ui.organize.imports.MultiElementListSelectionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fBackButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);

    // XXX: Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=279425
    boolean HAS_BUG_279425 = true;
    fNextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, !HAS_BUG_279425);
    fFinishButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.FINISH_LABEL, HAS_BUG_279425);

    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:kr.co.apexsoft.stella.modeler.explorer.dialog.ApexNavigatorSearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    backButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

    backButton.setEnabled(false);/*from   w w  w  .j  a v  a 2 s .co m*/
    nextButton.setEnabled(false);

    nextButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (currentIndex >= matchedObjects.size() - 1) {
                currentIndex = 0;
            } else {
                currentIndex++;
            }
            fireSetSelection(new StructuredSelection(matchedObjects.get(currentIndex)), true);
        }

    });

    backButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (currentIndex <= 0) {
                currentIndex = matchedObjects.size() - 1;
            } else {
                currentIndex--;
            }
            fireSetSelection(new StructuredSelection(matchedObjects.get(currentIndex)), true);
        }

    });
}

From source file:org.bonitasoft.studio.connectors.test.database.TestDatabaseConnectorOutputMode.java

License:Open Source License

private void checkEnalbledChoices() {
    assertFalse(/*from   www .  j  a v a 2 s . c om*/
            bot.checkBox(org.bonitasoft.studio.connectors.i18n.Messages.alwaysUseScriptingMode).isEnabled());
    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.graphicalMode).isEnabled());
    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.scriptMode).isEnabled());
    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.singleValue).isEnabled());
    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.oneRowNCol).isEnabled());
    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.nRowOneCol).isEnabled());
    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.nRowsNcolumns).isSelected());

    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals("tableResult",
            bot.textWithLabel(org.bonitasoft.studio.connectors.i18n.Messages.takeValueOf).getText());
    bot.button(IDialogConstants.BACK_LABEL).click();

    bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.singleValue).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals("col1",
            bot.textWithLabel(org.bonitasoft.studio.connectors.i18n.Messages.takeValueOf).getText());
    bot.button(IDialogConstants.BACK_LABEL).click();

    bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.oneRowNCol).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals("col1",
            bot.textWithLabel(org.bonitasoft.studio.connectors.i18n.Messages.takeValueOf).getText());
    bot.button(IDialogConstants.BACK_LABEL).click();

    bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.nRowOneCol).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals("col1",
            bot.textWithLabel(org.bonitasoft.studio.connectors.i18n.Messages.takeValueOf).getText());
    bot.button(IDialogConstants.BACK_LABEL).click();

    bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.scriptMode).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals("resultset", bot.textWithId(SWTBOT_ID_EXPRESSIONVIEWER_TEXT, 1).getText());
    bot.button(IDialogConstants.BACK_LABEL).click();

    bot.checkBox(org.bonitasoft.studio.connectors.i18n.Messages.alwaysUseScriptingMode).click();
    bot.button(IDialogConstants.BACK_LABEL).click();
    bot.styledText().setText(QUERY2);
    bot.button(IDialogConstants.NEXT_LABEL).click();

    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.scriptMode).isSelected());
    assertTrue(bot.checkBox(org.bonitasoft.studio.connectors.i18n.Messages.alwaysUseScriptingMode).isChecked());

    assertFalse(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.singleValue).isEnabled());
    assertFalse(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.oneRowNCol).isEnabled());
    assertFalse(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.nRowOneCol).isEnabled());
    assertFalse(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.nRowsNcolumns).isSelected());

    bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.graphicalMode).click();
    assertFalse(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.singleValue).isEnabled());
    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.oneRowNCol).isEnabled());
    assertFalse(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.nRowOneCol).isEnabled());
    assertTrue(bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.nRowsNcolumns).isSelected());
    assertFalse(
            bot.checkBox(org.bonitasoft.studio.connectors.i18n.Messages.alwaysUseScriptingMode).isEnabled());
    assertFalse(
            bot.checkBox(org.bonitasoft.studio.connectors.i18n.Messages.alwaysUseScriptingMode).isChecked());

    bot.radio(org.bonitasoft.studio.connectors.i18n.Messages.oneRowNCol).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertTrue(bot.text("col1").isVisible());
    assertTrue(bot.text("col2").isVisible());
    assertTrue(bot.text("col3").isVisible());
    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.activeEditor().save();
}

From source file:org.eclipse.edt.ide.rui.visualeditor.internal.util.Mnemonics.java

License:Open Source License

/**
 * Set if the mnemonics are for a wizard page
 * Wizard pages already have a few buttons with mnemonics set by Eclipse
 * We have to make sure we do not use the ones they use
 *//*ww  w . j a v  a2 s .  c  o m*/
public Mnemonics setOnWizardPage(boolean page) {
    if (page) {
        String[] labels = new String[] { IDialogConstants.BACK_LABEL, IDialogConstants.NEXT_LABEL,
                IDialogConstants.FINISH_LABEL };
        String used = getMnemonicsFromStrings(labels).toUpperCase();
        makeUsed(used);
    }
    return this;
}

From source file:org.eclipse.edt.ide.ui.internal.dialogs.MultiElementListSelectionDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    fBackButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    fNextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);
    fFinishButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.FINISH_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTest.java

License:Open Source License

 /**
 * Import wizard golden path test/*from  www  . j av a2 s.  c o  m*/
 * 
 * @throws Exception
 */
@Test
public void testImportWizard() throws Exception {
   deleteAllProjects();
   assertProjectExistence(PROJ1, false);
   SWTBotTree tree = getOrOpenView().bot().tree();
   SWTBotTreeItem item = myRepoViewUtil.getRootItem(tree, repositoryFile);
   String wizardTitle = NLS.bind(
         UIText.GitCreateProjectViaWizardWizard_WizardTitle,
         repositoryFile.getPath());
   // start wizard from root item
   item.select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("ImportProjectsCommand"));
   SWTBotShell shell = bot.shell(wizardTitle);
   bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
   // auto share
   bot.radio(UIText.GitSelectWizardPage_AutoShareButton).click();
   TableCollection selected = shell.bot().tree().selection();
   String wizardNode = selected.get(0, 0);
   // wizard directory should be working dir
   assertEquals(myRepoViewUtil.getWorkdirItem(tree, repositoryFile)
         .getText(), wizardNode);
   waitInUI();
   shell.close();
   // start wizard from .git
   myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
         Constants.DOT_GIT).select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("ImportProjectsCommand"));
   shell = bot.shell(wizardTitle);
   selected = shell.bot().tree().selection();
   wizardNode = selected.get(0, 0);
   // wizard directory should be .git
   assertEquals(Constants.DOT_GIT, wizardNode);
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   waitInUI();
   assertTrue(shell.bot().tree().getAllItems().length == 0);
   shell.bot().button(IDialogConstants.BACK_LABEL).click();
   // go to project with .project
   shell.bot().tree().getAllItems()[0].getNode(PROJ1).select();
   // next is 1
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   waitInUI();
   assertTrue(shell.bot().tree().getAllItems().length == 1);
   assertTrue(!shell.bot().button(IDialogConstants.FINISH_LABEL)
         .isEnabled());
   shell.bot().button(UIText.WizardProjectsImportPage_selectAll).click();
   assertTrue(shell.bot().button(IDialogConstants.FINISH_LABEL)
         .isEnabled());
   shell.bot().button(IDialogConstants.FINISH_LABEL).click();
   waitInUI();
   assertProjectExistence(PROJ1, true);
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTest.java

License:Open Source License

 @Test
public void testImportWizardGeneralProject() throws Exception {
   deleteAllProjects();/* ww  w  .  j a  va  2  s  .  c o m*/
   assertProjectExistence(PROJ2, false);
   SWTBotTree tree = getOrOpenView().bot().tree();
   String wizardTitle = NLS.bind(
         UIText.GitCreateProjectViaWizardWizard_WizardTitle,
         repositoryFile.getPath());
   // start wizard from PROJ2
   myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
         PROJ2).select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("ImportProjectsCommand"));
   SWTBotShell shell = bot.shell(wizardTitle);
   shell = bot.shell(wizardTitle);
   // try import existing project first
   bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
   // auto share
   bot.radio(UIText.GitSelectWizardPage_AutoShareButton).click();
   TableCollection selected = shell.bot().tree().selection();
   String wizardNode = selected.get(0, 0);
   // wizard directory should be PROJ2
   assertEquals(PROJ2, wizardNode);
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   waitInUI();
   assertTrue(shell.bot().tree().getAllItems().length == 0);
   shell.bot().button(IDialogConstants.BACK_LABEL).click();
   // import as general
   shell.bot().radio(UIText.GitSelectWizardPage_ImportAsGeneralButton).click();
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   assertEquals(PROJ2, shell.bot().textWithLabel(
         UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
   // switch to a sub directory and see if this is used
   shell.bot().button(IDialogConstants.BACK_LABEL).click();
   shell.bot().tree().getAllItems()[0].expand().getNode(PROJ2).expand()
         .getNode(FOLDER).select();
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   String name = shell.bot().textWithLabel(
         UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText();
   assertEquals(FOLDER, name);
   shell.bot().button(IDialogConstants.BACK_LABEL).click();
   // switch back to the root directory
   shell.bot().tree().getAllItems()[0].expand().getNode(PROJ2).select();
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   assertEquals(PROJ2, shell.bot().textWithLabel(
         UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());

   shell.bot().button(IDialogConstants.FINISH_LABEL).click();
   waitInUI();
   assertProjectExistence(PROJ2, true);
}