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

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

Introduction

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

Prototype

String CANCEL_LABEL

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

Click Source Link

Document

The label for cancel buttons.

Usage

From source file:com.arm.cmsis.pack.installer.CpPackInstaller.java

License:Open Source License

protected int timeoutQuestion(String pdscUrl) {
    Display.getDefault().syncExec(() -> {
        MessageDialog dialog = new MessageDialog(null, Messages.CpPackInstaller_Timout, null,
                NLS.bind(Messages.CpPackInstaller_TimeoutMessage, pdscUrl, TIME_OUT / 1000),
                MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL,
                        IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                0);//from   www.ja  v a  2s .c  om
        wait = dialog.open();
    });
    return wait;
}

From source file:com.arm.cmsis.pack.installer.jobs.CpPackUnpackJob.java

License:Open Source License

private boolean myRun(IProgressMonitor monitor) {
    SubMonitor progress = SubMonitor.convert(monitor, 100);

    File sourceFile = new File(fSourceFilePath);
    monitor.setTaskName(Messages.CpPackUnpackJob_Unpacking + sourceFile.toString());

    if (fDestPath.toFile().exists()) {
        final String messageString = NLS.bind(Messages.CpPackUnpackJob_PathAlreadyExists,
                fDestPath.toOSString());
        Display.getDefault().syncExec(new Runnable() {
            @Override//from  www.  j a v a2  s  . co m
            public void run() {
                final MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(),
                        Messages.CpPackUnpackJob_OverwriteQuery, null, messageString, MessageDialog.QUESTION,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                                IDialogConstants.CANCEL_LABEL },
                        0);
                returnCode = dialog.open();
            }
        });

        if (returnCode == IDialogConstants.OK_ID) {
            Utils.deleteFolderRecursive(fDestPath.toFile());
        } else {
            fResult.setSuccess(false);
            fResult.setErrorString(Messages.CpPackJob_CancelledByUser);
            return false;
        }
    }

    if (!sourceFile.exists()) {
        fResult.setSuccess(false);
        fResult.setErrorString(sourceFile.toString() + Messages.CpPackUnpackJob_SourceFileCannotBeFound);
        return true;
    }

    try {
        if (!fPackInstaller.unzip(sourceFile, fDestPath, progress.newChild(95))) {
            fResult.setSuccess(false);
            fResult.setErrorString(Messages.CpPackJob_CancelledByUser);
            Utils.deleteFolderRecursive(fDestPath.toFile());
            return false;
        }
        if (fPack != null) { // unpack job
            fPack.setPackState(PackState.INSTALLED);
            fPack.setFileName(fDestPath.append(fPack.getPackFamilyId() + CmsisConstants.EXT_PDSC).toString());
            fResult.setPack(fPack);
            fResult.setSuccess(true);
            return true;
        }
        Collection<String> files = new LinkedList<>();
        Utils.findPdscFiles(fDestPath.toFile(), files, 1);
        if (files.isEmpty()) {
            Utils.deleteFolderRecursive(fDestPath.toFile());
            fResult.setSuccess(false);
            fResult.setErrorString(Messages.CpPackUnpackJob_PdscFileNotFoundInFolder + fDestPath.toOSString());
            return true;
        }

        String file = files.iterator().next();
        ICpXmlParser parser = CpPlugIn.getPackManager().getParser();
        fPack = (ICpPack) parser.parseFile(file);
        if (fPack != null) {
            ICpItem urlItem = fPack.getFirstChild(CmsisConstants.URL);
            if (urlItem == null || !Utils.isValidURL(urlItem.getText())) {
                fPack.setPackState(PackState.GENERATED);
            } else {
                fPack.setPackState(PackState.INSTALLED);
            }
            fResult.setPack(fPack);
            fResult.setSuccess(true);
            return true;
        }
        Utils.deleteFolderRecursive(fDestPath.toFile());
        StringBuilder sb = new StringBuilder(Messages.CpPackUnpackJob_FailToParsePdscFile + file);
        for (String es : parser.getErrorStrings()) {
            sb.append(System.lineSeparator());
            sb.append(es);
        }
        fResult.setErrorString(sb.toString());
        fResult.setSuccess(false);
        return true;
    } catch (IOException e) {
        fResult.setSuccess(false);
        fResult.setErrorString(Messages.CpPackUnpackJob_FailedToUnzipFile + sourceFile.toString());
        Utils.deleteFolderRecursive(fDestPath.toFile());
        return true;
    }
}

From source file:com.arm.cmsis.pack.installer.OverwriteQuery.java

License:Open Source License

@Override
public String queryOverwrite(String pathString) {
    Path path = new Path(pathString);

    String messageString;// w  w  w.j ava2s  .  c  o  m
    //Break the message up if there is a file name and a directory
    //and there are at least 2 segments.
    if (path.getFileExtension() == null || path.segmentCount() < 2) {
        messageString = NLS.bind(Messages.OverwriteQuery_ExistsQuestion, pathString);
    } else {
        messageString = NLS.bind(Messages.OverwriteQuery_OverwriteNameAndPathQuestion, path.lastSegment(),
                path.removeLastSegments(1).toOSString());
    }

    final MessageDialog dialog = new MessageDialog(shell, Messages.OverwriteQuery_Question, null, messageString,
            MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0) {
        @Override
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
    //run in syncExec because callback is from an operation,
    //which is probably not running in the UI thread.
    shell.getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
            dialog.open();
        }
    });
    return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}

From source file:com.asakusafw.shafu.internal.ui.dialogs.PropertyEntryInputDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    this.buttonOk = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    if (defaultKey == null) {
        textKey.setFocus();/*from w  w w.  j  av  a  2 s  . co  m*/
        buttonOk.setEnabled(false);
    } else {
        if (defaultKey.isEmpty()) {
            textKey.setFocus();
        } else {
            textValue.setFocus();
            textValue.selectAll();
        }
        validate();
    }
}

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

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.//from   w  w w .  ja va  2s  .  co m
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
}

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

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*from w  w  w  . ja  va  2s  .co  m*/
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, DETACH, "Detach all", false);
    createButton(parent, CLOSE, "Close all", false);
    createButton(parent, KILL, "Kill all", false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
}

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

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.//from w w w  . j  a  v  a  2s  .  com
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    if (m_mode != ClientMode.CONTROLLING) {
        createButton(parent, DETACH, "Stop monitor", false);
    } else {
        if (!m_promptActive) {
            createButton(parent, DETACH, "Release control", false);
            createButton(parent, CLOSE, "Stop execution", false);
        }
        createButton(parent, KILL, "Kill execution", false);
    }
    Button cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
    cancel.setFocus();
}

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

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*  w  ww.j a v  a  2s .  co m*/
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
}

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

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.// w  w  w  . j av a 2s.c om
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

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

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*from w  ww .j  a  va2 s.co m*/
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    getButton(IDialogConstants.OK_ID).setEnabled(false);
}