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:de.unistuttgart.ipvs.pmp.editor.ui.editors.ais.internals.dialogs.DateTimeDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:de.unistuttgart.ipvs.pmp.editor.ui.editors.ais.internals.dialogs.RequiredPrivacySettingChangeValueDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    /*/*from w w  w  .j  a v a  2 s .  c  o  m*/
     * Add the value to the dialog, or enable the empty value checkbox and
     * disable the text field
     */
    if (this.emptyValue) {
        this.checked.setSelection(true);
        this.valueText.setEnabled(false);
    } else if (this.value != null) {
        this.valueText.setFocus();
    }

    if (this.value != null) {
        this.valueText.setText(this.value);
    }
}

From source file:de.uni_jena.iaa.linktype.atomic.core.workspace.PickWorkspaceDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    // clone workspace needs a lot of checks
    Button clone = createButton(parent, IDialogConstants.IGNORE_ID, "Clone", false);
    clone.addListener(SWT.Selection, new Listener() {
        @Override/*from  ww  w  .j  a v  a2s .com*/
        public void handleEvent(Event arg0) {
            try {
                String txt = _workspacePathCombo.getText();
                File workspaceDirectory = new File(txt);
                if (!workspaceDirectory.exists()) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                            "The currently entered workspace path does not exist. Please enter a valid path.");
                    return;
                }

                if (!workspaceDirectory.canRead()) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                            "The currently entered workspace path is not readable. Please check file system permissions.");
                    return;
                }

                // check for workspace file (empty indicator that it's a workspace)
                File wsFile = new File(txt + File.separator + WS_IDENTIFIER);
                if (!wsFile.exists()) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                            "The currently entered workspace path does not contain a valid workspace.");
                    return;
                }

                DirectoryDialog dd = new DirectoryDialog(PickWorkspaceDialog.this.getShell());
                dd.setFilterPath(txt);
                String directory = dd.open();
                if (directory == null) {
                    return;
                }

                File targetDirectory = new File(directory);
                if (targetDirectory.getAbsolutePath().equals(workspaceDirectory.getAbsolutePath())) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                            "Source and target workspaces are the same");
                    return;
                }

                // recursive check, if new directory is a subdirectory of our workspace, that's a big no-no or we'll
                // create directories forever
                if (isTargetSubdirOfDir(workspaceDirectory, targetDirectory)) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                            "Target folder is a subdirectory of the current workspace");
                    return;
                }

                try {
                    copyFiles(workspaceDirectory, targetDirectory);
                } catch (Exception err) {
                    MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                            "There was an error cloning the workspace: " + err.getMessage());
                    return;
                }

                boolean setActive = MessageDialog.openConfirm(PickWorkspaceDialog.this.getShell(),
                        "Workspace Cloned",
                        "Would you like to set the newly cloned workspace to be the active one?");
                if (setActive) {
                    _workspacePathCombo.setText(directory);
                }
            } catch (Exception err) {
                MessageDialog.openError(PickWorkspaceDialog.this.getShell(), "Error",
                        "There was an internal error, please check the logs");
                err.printStackTrace();
            }
        }
    });
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:descent.internal.ui.refactoring.actions.RefactoringStarter.java

License:Open Source License

public void activate(Refactoring refactoring, RefactoringWizard wizard, Shell parent, String dialogTitle,
        boolean mustSaveEditors) throws JavaModelException {
    if (!canActivate(mustSaveEditors, parent))
        return;/* ww  w.j a va2s  . co m*/

    try {
        RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
        int result = op.run(parent, dialogTitle);
        fStatus = op.getInitialConditionCheckingStatus();
        if (result == IDialogConstants.CANCEL_ID
                || result == RefactoringWizardOpenOperation.INITIAL_CONDITION_CHECKING_FAILED)
            fSaveHelper.triggerBuild();
    } catch (InterruptedException e) {
        // do nothing. User action got cancelled
    }
}

From source file:dynamicrefactoring.interfaz.CustomProgressDialog.java

License:Open Source License

/**
 * Crea el botn de cancelacin.//from   ww w .j a v  a2  s. c  o m
 * 
 * @param parent el componente padre del botn.
 */
@Override
protected void createCancelButton(Composite parent) {
    super.createCancelButton(parent);

    if (this.getButton(IDialogConstants.CANCEL_ID) != null)
        this.getButton(IDialogConstants.CANCEL_ID).setText(ButtonTextProvider.getCancelText());
}

From source file:dynamicrefactoring.interfaz.dynamic.DynamicRefactoringWindow.java

License:Open Source License

/**
 * Aade los botones a la barra de botones de este dilogo.
 * /*from w w  w.  j a v a 2  s . c o m*/
 * @param parent
 *            el elemento compuesto de la barra de botones.
 * 
 * @see Dialog#createButtonsForButtonBar
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, Messages.DynamicRefactoringWindow_Run, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.DynamicRefactoringWindow_Close, false);
}

From source file:dynamicrefactoring.interfaz.SelectDynamicRefactoringWindow.java

License:Open Source License

/**
 * Crea el contenido de la barra de botones.
 * /*from   w ww .ja  v  a2  s  .c  o m*/
 * @param parent el componente padre de los botones aadidos.
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createOtherButtons(parent);
    createButton(parent, IDialogConstants.CANCEL_ID, ButtonTextProvider.getCancelText(), false);
}

From source file:dynamicrefactoring.interfaz.SelectForEditingWindow.java

License:Open Source License

/**
 * Notifica que el botn de este dilogo con el identificador especificado
 * ha sido pulsado./*from  ww  w  .  j av  a2  s .  c om*/
 * 
 * @param buttonId
 *            el identificador del botn que ha sido pulsado (vanse las
 *            constantes <code>IDialogConstants.*ID</code>).
 * 
 * @see Dialog#buttonPressed
 * @see IDialogConstants
 */
@Override
protected void buttonPressed(int buttonId) {

    if (buttonId != IDialogConstants.CANCEL_ID) {
        Table availableList = availableRefListViewer.getTable();
        if (availableList.getSelectionCount() == 1) {
            Object obj = availableList.getSelection()[0].getData();
            if (obj instanceof DynamicRefactoringDefinition) {

                this.close();

                DynamicRefactoringDefinition refactoring = (buttonId == IDialogConstants.CLIENT_ID)
                        ? getRefactoringCopy(obj)
                        : (DynamicRefactoringDefinition) obj;
                RefactoringWizard wizard = new RefactoringWizard(refactoring, refactCatalog);
                wizard.init(PlatformUI.getWorkbench(), null);

                WizardDialog dialog = new WizardDialog(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
                dialog.create();
                dialog.setPageSize(200, 200);
                dialog.updateSize();
                dialog.open();
            }
        }
    }

    super.buttonPressed(buttonId);
}

From source file:dynamicrefactoring.interfaz.SelectRefactoringWindow.java

License:Open Source License

/**
 * Crea el contenido de la barra de botones.
 * /*from w w w .j  a  v a 2s  .  co  m*/
 * @param parent contenedor de la barra de botones.
 * 
 * @see Dialog#createButtonsForButtonBar
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, Messages.SelectRefactoringWindow_Accept, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.SelectRefactoringWindow_Cancel, false);
}

From source file:dynamicrefactoring.interfaz.wizard.CustomWizardDialog.java

License:Open Source License

/**
 * Crea los botones del dilogo en que se muestra un asistente.
 * //from www.j av  a  2 s  . co m
 * @param parent el componente padre que contendr los botones.
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    if (super.getButton(IDialogConstants.FINISH_ID) != null)
        super.getButton(IDialogConstants.FINISH_ID).setText(ButtonTextProvider.getFinishText());

    if (super.getButton(IDialogConstants.CANCEL_ID) != null)
        super.getButton(IDialogConstants.CANCEL_ID).setText(ButtonTextProvider.getCancelText());

    if (super.getButton(IDialogConstants.BACK_ID) != null)
        super.getButton(IDialogConstants.BACK_ID).setText(ButtonTextProvider.getBackText());

    if (super.getButton(IDialogConstants.NEXT_ID) != null)
        super.getButton(IDialogConstants.NEXT_ID).setText(ButtonTextProvider.getNextText());
}