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.nokia.tools.screen.ui.wizards.OpenProjectDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    btnOpen = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OPEN_LABEL, true);
    btnOpen.setEnabled(false);//  w w w.  j av a2 s  . c o  m
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.nokia.tools.theme.s60.ui.dialogs.MakeKeysDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    btnGenerate = createButton(parent, IDialogConstants.OK_ID, WizardMessages.Make_Keys_btnGenerate_Text, true);
    btnGenerate.setEnabled(false);// w ww .  j a v a2 s .c  om
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.nokia.tools.ui.dialog.ResourceSelectionDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    refresh();/*from   w w  w  . jav  a2 s.  c  o  m*/
}

From source file:com.palantir.typescript.Builders.java

License:Apache License

/**
 * Prompts user to rebuild either the project or the whole workspace.
 *
 * @param shell/* w  ww .  j  a  va  2  s  .c  o  m*/
 *            parent shell
 * @param onlyProject
 *            the project to be rebuilt or null if the whole workpsace has to be rebuilt
 * @return true if user accepted the recompilation
 */
public static boolean promptRecompile(Shell shell, IProject onlyProject) {
    String title = Resources.BUNDLE.getString("preferences.compiler.rebuild.dialog.title");
    String message = Resources.BUNDLE.getString("preferences.compiler.rebuild.dialog.message");
    String[] buttonLabels = new String[] { IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL,
            IDialogConstants.YES_LABEL };
    MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, buttonLabels,
            2);
    int result = dialog.open();

    boolean process = false;
    if (result != 1) { // cancel
        process = true;

        // rebuild the workspace
        if (result == 2) {
            if (onlyProject != null) {
                Builders.rebuildProject(onlyProject);
            } else {
                Builders.rebuildWorkspace();
            }
        }
    }
    return process;
}

From source file:com.palantir.typescript.CompilerPreferencePage.java

License:Apache License

@Override
public boolean performOk() {
    final boolean process;

    // offer to rebuild the workspace if the compiler preferences were modified
    if (this.compilerPreferencesModified) {
        String title = Resources.BUNDLE.getString("preferences.compiler.rebuild.dialog.title");
        String message = Resources.BUNDLE.getString("preferences.compiler.rebuild.dialog.message");
        String[] buttonLabels = new String[] { IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL,
                IDialogConstants.YES_LABEL };
        MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION,
                buttonLabels, 2);/*from ww w  .jav  a  2  s .  co m*/
        int result = dialog.open();

        if (result == 1) { // cancel
            process = false;
        } else {
            // yes/no
            process = super.performOk();

            // rebuild the workspace
            if (result == 2) {
                String name = Resources.BUNDLE.getString("preferences.compiler.rebuild.job.name");
                Job job = new Job(name) {
                    @Override
                    protected IStatus run(IProgressMonitor monitor) {
                        IWorkspace workspace = ResourcesPlugin.getWorkspace();

                        try {
                            workspace.build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
                            workspace.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
                        } catch (CoreException e) {
                            return e.getStatus();
                        }

                        return Status.OK_STATUS;
                    }
                };
                job.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
                job.schedule();
            }
        }

        this.compilerPreferencesModified = false;
    } else {
        process = super.performOk();
    }

    return process;
}

From source file:com.persistent.winazureroles.CertificateDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button btnImport = createButton(parent, 2, Messages.importBtn, false);
    btnImport.addSelectionListener(new SelectionListener() {

        @Override// w  ww  .  jav a 2 s . c  o  m
        public void widgetSelected(SelectionEvent arg0) {
            importBtnListner();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
        }
    });

    Button btnCreate = createButton(parent, 3, Messages.newBtn, false);
    btnCreate.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            newBtnListener();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });

    Button btnNo = createButton(parent, 4, Messages.importBtn, false);
    btnNo.setVisible(false);

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    okButton = getButton(IDialogConstants.OK_ID);
    okButton.setEnabled(false);
}

From source file:com.persistent.winazureroles.WARComponents.java

License:Open Source License

/**
 * Listener method for remove button which
 * deletes the selected component.//from ww  w  .  ja va2 s  .  c  o m
 */
protected void removeBtnListener() {
    int selIndex = tblViewer.getTable().getSelectionIndex();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();
    WindowsAzureRoleComponent component = listComponents.get(selIndex);
    if (selIndex > -1) {
        try {
            /* First condition: Checks component is part of a JDK,
             * server configuration
             * Second condition: For not showing error message
             * "Disable Server JDK Configuration"
             * while removing server application
             * when server or JDK  is already disabled.
             */
            if (component.getIsPreconfigured() && (!(component.getType().equals(Messages.typeSrvApp)
                    && windowsAzureRole.getServerName() == null))) {
                PluginUtil.displayErrorDialog(getShell(), Messages.jdkDsblErrTtl, Messages.jdkDsblErrMsg);
            } else {
                boolean choice = MessageDialog.openQuestion(getShell(), Messages.cmpntRmvTtl,
                        Messages.cmpntRmvMsg);
                if (choice) {
                    String cmpntPath = String.format("%s%s%s%s%s",
                            root.getProject(waProjManager.getProjectName()).getLocation(), File.separator,
                            windowsAzureRole.getName(), Messages.approot, component.getDeployName());
                    File file = new File(cmpntPath);
                    // Check import source is equal to approot
                    if (component.getImportPath().isEmpty() && file.exists()) {
                        MessageDialog dialog = new MessageDialog(getShell(), Messages.cmpntSrcRmvTtl, null,
                                Messages.cmpntSrcRmvMsg, MessageDialog.QUESTION_WITH_CANCEL,
                                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                                        IDialogConstants.CANCEL_LABEL },
                                0);
                        switch (dialog.open()) {
                        case 0:
                            //yes
                            component.delete();
                            tblViewer.refresh();
                            fileToDel.add(file);
                            break;
                        case 1:
                            //no
                            component.delete();
                            tblViewer.refresh();
                            break;
                        case 2:
                            //cancel
                            break;
                        default:
                            break;
                        }
                    } else {
                        component.delete();
                        tblViewer.refresh();
                        fileToDel.add(file);
                    }
                }
            }
            if (tblComponents.getItemCount() == 0) {
                // table is empty i.e. number of rows = 0
                btnRemove.setEnabled(false);
                btnEdit.setEnabled(false);
            }
        } catch (WindowsAzureInvalidProjectOperationException e) {
            PluginUtil.displayErrorDialogAndLog(getShell(), Messages.cmpntSetErrTtl, Messages.cmpntRmvErrMsg,
                    e);
        }
    }
    updateMoveButtons();
}

From source file:com.predic8.plugin.membrane.dialogs.AddHeaderFieldDialog.java

License:Apache License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
}

From source file:com.python.pydev.ui.search.ReplaceDialog2.java

License:Open Source License

private int askForSkip(final IFile file) {

    String message = Messages.format(SearchMessages.ReadOnlyDialog_message, file.getFullPath().toOSString());
    String[] buttonLabels = null;
    boolean showSkip = countResources() > 1;
    if (showSkip) {
        String skipLabel = SearchMessages.ReadOnlyDialog_skipFile;
        String skipAllLabel = SearchMessages.ReadOnlyDialog_skipAll;
        buttonLabels = new String[] { skipLabel, skipAllLabel, IDialogConstants.CANCEL_LABEL };
    } else {// w  w w  .j  a v a2 s  . co m
        buttonLabels = new String[] { IDialogConstants.CANCEL_LABEL };

    }

    MessageDialog msd = new MessageDialog(getShell(), getShell().getText(), null, message, MessageDialog.ERROR,
            buttonLabels, 0);
    int rc = msd.open();
    switch (rc) {
    case 0:
        return showSkip ? SKIP_FILE : CANCEL;
    case 1:
        return SKIP_ALL;
    default:
        return CANCEL;
    }
}

From source file:com.rcpcompany.uibindings.tests.application.ApplicationWorkbenchAdvisor.java

License:Open Source License

@Override
public boolean preShutdown() {
    final IManager manager = IManager.Factory.getManager();
    final EditingDomain editingDomain = manager.getEditingDomain();
    int res = 1; // == NO
    if (editingDomain.getCommandStack().canUndo()) {
        final IWorkbenchWindow window = getWorkbenchConfigurer().getWorkbench().getActiveWorkbenchWindow();
        final MessageDialog dialog = new MessageDialog(window.getShell(), "Save Shop?", null,
                "Changes has been made to the shop. Save these?", MessageDialog.QUESTION, new String[] {
                        IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                0);// w ww . j  a va 2 s . c  om
        res = dialog.open();
        if (res == 0) {
            final ICommandService cs = (ICommandService) window.getService(ICommandService.class);
            final IHandlerService hs = (IHandlerService) window.getService(IHandlerService.class);

            try {
                final String c = manager.getCommandIDs().get(IWorkbenchCommandConstants.FILE_SAVE);
                final ParameterizedCommand command = cs.deserialize(c);
                hs.executeCommand(command, null);
            } catch (final Exception ex) {
                LogUtils.error(this, ex);
            }
        }
    }
    return res != 2;
}