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

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

Introduction

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

Prototype

int BACK_ID

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

Click Source Link

Document

Button id for a "Back" button (value 14).

Usage

From source file:com.astra.ses.spell.gui.dialogs.DictionaryEditorDialog.java

License:Open Source License

/***************************************************************************
 * //from  w w  w. j  a v a 2  s  .  c  o m
 **************************************************************************/
public void update() {
    if (m_canMergeFiles) {
        m_mergeSelButton
                .setEnabled(!m_fileContainer.getVariables().isEmpty() && !m_fileTable.getSelection().isEmpty());
        m_mergeAllButton.setEnabled(!m_fileContainer.getVariables().isEmpty());
        m_chkOverwrite.setEnabled(!m_fileContainer.getVariables().isEmpty());
        m_chkMergeNew.setEnabled(!m_fileContainer.getVariables().isEmpty());
    }
    getButton(IDialogConstants.OK_ID).setEnabled(m_container.hasChanges());
    getButton(IDialogConstants.BACK_ID).setEnabled(m_container.hasChanges());
}

From source file:com.astra.ses.spell.gui.dialogs.DictionaryEditorDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.//from   www. j ava2 s  .  c  om
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (!m_readOnly) {
        createButton(parent, IDialogConstants.BACK_ID, "Revert Changes", false);
        createButton(parent, IDialogConstants.OK_ID, "Apply and Close", false);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        getButton(IDialogConstants.BACK_ID).setEnabled(false);
    }
    createButton(parent, IDialogConstants.CANCEL_ID, "Close", true);
}

From source file:com.astra.ses.spell.gui.dialogs.DictionaryEditorDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * //from w w w . j av a 2  s .  co  m
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        if (m_container.hasChanges()) {
            boolean mergeNew = false;
            // The button can be null for dialogs without file import
            if (m_chkMergeNew != null) {
                m_chkMergeNew.getSelection();
            }
            UpdateDataContainerJob job = new UpdateDataContainerJob(m_procId, m_container, mergeNew);
            CommandHelper.executeInProgress(job, true, true);
            m_varTable.refresh();
            if (job.result == CommandResult.FAILED) {
                MessageDialog.openError(getShell(), "Update Error",
                        "Failed to update changes to dictionary:\n" + job.error);
                return;
            }
        }
    } else if (buttonId == IDialogConstants.BACK_ID) {
        doRevert();
        return;
    } else if (buttonId == IDialogConstants.CANCEL_ID) {
        if (m_container.hasChanges()) {
            if (!MessageDialog.openConfirm(getShell(), "Changes made",
                    "There are changes made to the data container variables.\n\n"
                            + "If you close the dialog, these changes will be lost. "))
                return;
        }
        if (!m_fileContainer.getVariables().isEmpty()) {
            if (!MessageDialog.openConfirm(getShell(), "File loaded",
                    "There are NO changes made to the data container variables, but an input file was loaded.\n\n"
                            + "If you close the dialog, no changes will be applied. Are you sure to close?"))
                return;
        }
    }
    close();
}

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

License:Open Source License

@Override
public void showPage(IWizardPage page) {
    // Set new page
    super.showPage(page);

    // Set page active
    if (page instanceof IInstallWizardPage) {
        try {/*from   w w w .  ja  va  2  s  .c o  m*/
            ((IInstallWizardPage) getCurrentPage()).setActive(getInstallWizard().getInstallData());
        } catch (Exception e) {
            Installer.log(e);
        }
    }

    IWizardPage[] pages = getInstallWizard().getPages();
    // If final page, update buttons so that only
    // OK is enabled.
    if ((pages.length > 0) && (page == pages[pages.length - 1])) {
        Button button = getButton(IDialogConstants.BACK_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.NEXT_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.CANCEL_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        getButton(IDialogConstants.FINISH_ID).setText(IDialogConstants.OK_LABEL);
    }
}

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

License:Open Source License

public void setButtonsEnabled(boolean enable) {
    // Restore enabled state
    if (enable) {
        Button button = getButton(IDialogConstants.CANCEL_ID);
        if (button != null) {
            button.setEnabled(true);//from ww  w .j  ava2  s . c om
        }
        updateButtons();
    }
    // Disable
    else {
        Button button = getButton(IDialogConstants.BACK_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.NEXT_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.CANCEL_ID);
        if (button != null) {
            button.setEnabled(false);
        }
        button = getButton(IDialogConstants.FINISH_ID);
        if (button != null) {
            button.setEnabled(false);
        }
    }
}

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

License:Open Source License

protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.HELP_ID: {
        helpPressed();//from www .  ja va2  s  . c o m
        break;
    }
    case IDialogConstants.BACK_ID: {
        backPressed();
        break;
    }
    case IDialogConstants.NEXT_ID: {
        nextPressed();
        break;
    }
    case IDialogConstants.FINISH_ID: {
        finishPressed();
        break;
    }
    // The Cancel button has a listener which calls cancelPressed
    // directly
    }
}

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./*w  w  w.j  ava 2 s  .  c o  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 buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.BACK_ID) {
        turnPage(false);//from w  w w  .  j  a v a 2s.  co m
    } else if (buttonId == IDialogConstants.NEXT_ID) {
        turnPage(true);
    } else {
        super.buttonPressed(buttonId);
    }
}

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:com.nokia.s60tools.memspy.ui.wizards.MemSpyWizardDialog.java

License:Open Source License

public void enableBackCancelButtons(boolean enable) {
    getButton(IDialogConstants.BACK_ID).setEnabled(enable);
    getButton(IDialogConstants.CANCEL_ID).setEnabled(enable);

}