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

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

Introduction

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

Prototype

int CANCEL_ID

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

Click Source Link

Document

Button id for a "Cancel" button (value 1).

Usage

From source file:com.nokia.carbide.cpp.uiq.components.addViewPageDialog.AddViewPageDialog.java

License:Open Source License

/**
 * Create contents of the button bar/*  w  ww. j  a  va  2 s . c  om*/
 * @param parent
 */
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    if (error) {
        okButton.setEnabled(false);
    } else {
        okButton.setEnabled(true);
    }
}

From source file:com.nokia.carbide.cpp.uiq.ui.vieweditor.ActionsLayoutsDialog.java

License:Open Source License

/**
 * Create contents of the button bar//w  w w . j  a v a2s.  c om
 * @param parent
 */
protected void createButtonsForButtonBar(Composite parent) {
    System.currentTimeMillis();
    button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    if (error) {
        button.setEnabled(false);
    }
}

From source file:com.nokia.carbide.cpp.uiq.ui.vieweditor.ActionsUIConfigDialog.java

License:Open Source License

/**
 * Create contents of the button bar//www .j a  v  a  2 s .c o m
 * @param parent
 */
protected void createButtonsForButtonBar(Composite parent) {
    System.currentTimeMillis();
    button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    if (error) {
        button.setEnabled(false);
    } else {
        button.setEnabled(true);
    }

}

From source file:com.nokia.carbide.cpp.uiq.ui.vieweditor.LayoutsDialog.java

License:Open Source License

/**
 * Create contents of the button bar//from  www . j a  va2 s  .  com
 * @param parent
 */
protected void createButtonsForButtonBar(Composite parent) {
    System.currentTimeMillis();
    button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    if (error) {
        button.setEnabled(false);
    } else {
        button.setEnabled(true);
    }
}

From source file:com.nokia.carbide.internal.updater.ui.ProjectUpdateDialog.java

License:Open Source License

/**
 * Create contents of the button bar (change OK to Update)
 * @param parent//from  w  w w . j av  a 2 s.c o m
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button ok = createButton(parent, IDialogConstants.OK_ID,
            Messages.getString("ProjectUpdateDialog.UpdateButtonTitle"), true); //$NON-NLS-1$
    ok.setToolTipText(Messages.getString("ProjectUpdateDialog.OkButtonTooltip")); //$NON-NLS-1$
    Button skip = createButton(parent, IDialogConstants.NEXT_ID,
            Messages.getString("ProjectUpdateDialog.SkipButtonTitle"), false); //$NON-NLS-1$
    skip.setToolTipText(Messages.getString("ProjectUpdateDialog.SkipButtonTooltip")); //$NON-NLS-1$
    Button cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    cancel.setToolTipText(Messages.getString("ProjectUpdateDialog.CancelButtonTooltip")); //$NON-NLS-1$
    updateEnabled();
}

From source file:com.nokia.carbide.search.system.internal.ui.text.ReplaceDialog2.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.CANCEL_ID) {
        super.buttonPressed(buttonId);
        return;/*from w ww. ja  va2s. c  om*/
    }

    final String replaceText = fTextField.getText();
    statusMessage(false, ""); //$NON-NLS-1$
    try {
        switch (buttonId) {
        case SKIP:
            skip();
            break;
        case SKIP_FILE:
            skipFile();
            break;
        case REPLACE:
            run(new ReplaceOperation() {
                protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
                    replace(pm, replaceText);
                }
            }, (IFileStore) getCurrentMarker().getElement());
            gotoCurrentMarker();
            break;
        case REPLACE_ALL_IN_FILE:
            run(new ReplaceOperation() {
                protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
                    replaceInFile(pm, replaceText);
                }
            }, (IFileStore) getCurrentMarker().getElement());
            gotoCurrentMarker();
            break;
        case REPLACE_ALL:
            run(new ReplaceOperation() {
                protected void doReplace(IProgressMonitor pm) throws BadLocationException, CoreException {
                    replaceAll(pm, replaceText);
                }
            }, null);
            gotoCurrentMarker();
            break;
        default: {
        }
        }
    } catch (InvocationTargetException e) {
        Throwable targetException = e.getTargetException();
        if (targetException instanceof PatternSyntaxException) {
            String format = SearchMessages.ReplaceDialog2_regexError_format;
            String message = MessageFormat.format(format,
                    new Object[] { targetException.getLocalizedMessage() });
            statusMessage(true, message);
        } else {
            String message = Messages.format(SearchMessages.ReplaceDialog_error_unable_to_replace,
                    ((IFileStore) getCurrentMarker().getElement()).getName());
            ExceptionHandler.handle(e, getParentShell(), getDialogTitle(), message);
        }
    } catch (InterruptedException e) {
        // means operation canceled
    } finally {
        if (!canReplace())
            close();
        else {
            enableButtons();
        }
    }
}

From source file:com.nokia.carbide.search.system.internal.ui.util.ExtendedDialogWindow.java

License:Open Source License

/**
 * Add buttons to the dialog's button bar.
 *
 * Subclasses may override./*from  w ww. j av a2  s  .  c o  m*/
 *
 * @param parent the button bar composite
 */
protected void createButtonsForButtonBar(Composite parent) {
    fCancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.nokia.carbide.search.system.internal.ui.util.ExtendedDialogWindow.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.CANCEL_ID:
        if (fActiveRunningOperations == 0)
            close();//  ww w  .  ja  v a  2 s . c o  m
        break;
    default:
        if (performAction(buttonId))
            close();
    }
}

From source file:com.nokia.carbide.search.system2.internal.ui.SearchHistorySelectionDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OPEN_LABEL, true);
    createButton(parent, IDialogConstants.OPEN_ID,
            SearchMessages.SearchHistorySelectionDialog_open_in_new_button, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.nokia.carbide.templatewizard.processes.CopyFiles.java

License:Open Source License

private void handleExistingFiles(List<FileInfo> infos, final List<IFile> existingFiles,
        List<FileInfo> fileInfosToCopy) {
    boolean overwrite = true;
    String autoOverwrite = projectParameter.getAttributeValue(OVERWRITE_ATTRIBUTE);
    if (autoOverwrite == null && !WorkbenchUtils.isJUnitRunning()) { // should ask
        final int[] result = { IDialogConstants.CANCEL_ID };
        Display.getDefault().syncExec(new Runnable() {
            public void run() {
                Shell shell = WorkbenchUtils.getActiveShell();
                String title = Messages.getString("CopyFiles.FilesExistTitle"); //$NON-NLS-1$
                String message = Messages.getString("CopyFiles.OverwriteFilesQuestion"); //$NON-NLS-1$
                FilesListDialog dialog = new FilesListDialog(shell, existingFiles, title, message);
                dialog.setAltButtonLabels(IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL);
                result[0] = dialog.open();
            }/*from w ww.jav  a  2s .  c om*/
        });
        overwrite = result[0] == IDialogConstants.OK_ID;
    } else if (autoOverwrite != null) {
        overwrite = Boolean.parseBoolean(autoOverwrite);
    }

    if (!overwrite) {
        fileInfosToCopy.clear();
        for (FileInfo fileInfo : infos) {
            if (!FileUtils.exists(fileInfo.targetFile))
                fileInfosToCopy.add(fileInfo);
        }
    }
}