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.ibm.domino.osgi.debug.actions.CreateNotesJavaApiProject.java

License:Open Source License

/**
 * The action has been activated. The argument of the
 * method represents the 'real' action sitting
 * in the workbench UI./*from  ww w.ja v a  2  s . c  om*/
 * @see IWorkbenchWindowActionDelegate#run
 */
public void run(IAction action) {
    if (exists(getBinDirectoryFromPreferenceStore())) {
        doCreateNotesJavaApiProject();
        return;
    }
    int status = new MessageDialog(window.getShell(), "Question", null,
            "Domino Bin directory not set, please click on the link to set it", MessageDialog.WARNING,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) {
        @Override
        protected Control createCustomArea(Composite parent) {
            Link link = new Link(parent, SWT.NONE);
            link.setFont(parent.getFont());
            link.setText("<A>Domino Debug Plugin Preferences....</A>");
            link.addSelectionListener(new SelectionListener() {
                /*
                 * (non-Javadoc)
                 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
                 */
                public void widgetSelected(SelectionEvent e) {
                    doLinkActivated();
                }

                /*
                 * Open the appropriate preference page
                 */
                private void doLinkActivated() {
                    String id = "com.ibm.domino.osgi.debug.preferences.DominoOSGiDebugPreferencePage";
                    PreferencesUtil.createPreferenceDialogOn(window.getShell(), id, new String[] { id }, null)
                            .open();

                    updateButtons();
                }

                public void widgetDefaultSelected(SelectionEvent e) {
                    doLinkActivated();
                }
            });
            return link;
        }

        private void updateButtons() {
            getButton(0).setEnabled(exists(getBinDirectoryFromPreferenceStore()));
        }

        protected Control createContents(Composite parent) {
            Control ctrl = super.createContents(parent);
            updateButtons();
            return ctrl;
        };
    }.open();
    if (status == MessageDialog.OK) {
        doCreateNotesJavaApiProject();
    }

}

From source file:com.ibm.domino.osgi.debug.actions.CreateNotesJavaApiProject.java

License:Open Source License

private void doCreateNotesJavaApiProject() {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    final IProject project = root.getProject(JAVA_API_PROJECT_NAME);
    if (project.exists()) {
        boolean bContinue = MessageDialog.openQuestion(window.getShell(), "Debug plug-in for Domino OSGi",
                MessageFormat.format("Project {0} already exists. Would you like to update it?",
                        JAVA_API_PROJECT_NAME));
        if (!bContinue) {
            return;
        }/*from www .j  av a  2s  .  c o  m*/
    }

    String binDirectory = Activator.getDefault().getPreferenceStore()
            .getString(PreferenceConstants.PREF_DOMINO_BIN_DIR);
    if (binDirectory == null || binDirectory.length() == 0) {
        int ret = new MessageDialog(window.getShell(), "Question", null,
                "Domino Bin directory not set, please click on the link to set it", MessageDialog.WARNING,
                new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) {
            /*
             * (non-Javadoc)
             * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected Control createCustomArea(Composite parent) {
                Link link = new Link(parent, SWT.NONE);
                link.setFont(parent.getFont());
                link.setText("<A>Domino Debug Plugin Preferences....</A>");
                link.addSelectionListener(new SelectionListener() {
                    public void widgetSelected(SelectionEvent e) {
                        doLinkActivated();
                    }

                    private void doLinkActivated() {
                        String id = "com.ibm.domino.osgi.debug.preferences.DominoOSGiDebugPreferencePage";
                        PreferencesUtil
                                .createPreferenceDialogOn(window.getShell(), id, new String[] { id }, null)
                                .open();
                    }

                    public void widgetDefaultSelected(SelectionEvent e) {
                        doLinkActivated();
                    }
                });
                return link;
            }
        }.open();

        if (ret == 1) {
            return;
        }
    }

    binDirectory = Activator.getDefault().getPreferenceStore()
            .getString(PreferenceConstants.PREF_DOMINO_BIN_DIR);
    if (binDirectory == null || binDirectory.length() == 0) {
        MessageDialog.openError(window.getShell(), "Error", "Domino Bin directory not set");
        return;
    }

    try {
        final String sBinDir = binDirectory;
        new ProgressMonitorDialog(window.getShell()).run(true, true, new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    if (!project.exists()) {
                        project.create(monitor);
                    }
                    project.open(monitor);

                    IProjectDescription description = project.getDescription();
                    String[] natures = description.getNatureIds();
                    String[] newNatures = new String[natures.length + 2];
                    System.arraycopy(natures, 0, newNatures, 0, natures.length);
                    newNatures[natures.length] = JavaCore.NATURE_ID;
                    newNatures[natures.length + 1] = "org.eclipse.pde.PluginNature";
                    description.setNatureIds(newNatures);
                    project.setDescription(description, monitor);
                    //Copy the resources under res
                    copyOneLevel(project, monitor, "res", "");

                    //Copy notes.jar
                    File notesJar = new File(sBinDir + "/jvm/lib/ext/Notes.jar");
                    if (!notesJar.exists() || !notesJar.isFile()) {
                        MessageDialog.openError(window.getShell(), "Error",
                                MessageFormat.format("{0} does not exist", notesJar.getAbsolutePath()));
                        return;
                    }

                    copyFile(notesJar, project.getFile("Notes.jar"), monitor);

                } catch (Throwable t) {
                    throw new InvocationTargetException(t);
                }
            }
        });
    } catch (Throwable t) {
        MessageDialog.openError(window.getShell(), "error", t.getMessage());
        t.printStackTrace();
    }
}

From source file:com.ibm.etools.mft.samples.scribble.ScribbleConnectionDialog.java

License:Open Source License

/**
 * If initialized with a ScribbleConnectionInfo, show only a Cancel button. 
 * //from ww  w  .j  a  v a 2s  .  c  o m
 * @see org.eclipse.jface.dialogs.Dialog
 */

protected void createButtonsForButtonBar(Composite parent) {
    if (connectionInfo == null) {
        super.createButtonsForButtonBar(parent);
    } else {
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
    }
}

From source file:com.ibm.research.tagging.core.ui.dialogs.QuickTagDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    //do this here because setting the text will set enablement on the ok button
    fTagsText.getTextControl().setFocus();
}

From source file:com.ibm.research.tagging.java.dialogs.SynchronizeWaypointsDialog.java

License:Open Source License

/**
 * Creates a new RefreshTagsDialog dialog.
 * /*from w ww  . ja  va  2 s.c  o  m*/
 * @param window the window to create it in
 * @param selection the currently selected projects (may be empty)
 */
public SynchronizeWaypointsDialog(IWorkbenchWindow window, IProject[] selection) {
    super(window.getShell(), "Synchronize @tag database...", null, getQuestion(), QUESTION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);

    this.fSelection = selection;
    if (this.fSelection == null) {
        this.fSelection = new Object[0];
    }
    setShellStyle(SWT.RESIZE | getShellStyle());

    //setDefaultImage();
}

From source file:com.ibm.research.tours.fx.dialogs.SelectPerspectiveDialog.java

License:Open Source License

/**
 * Adds buttons to this dialog's button bar.
 * <p>//from  w  w  w.jav a2 s.co m
 * The default implementation of this framework method adds standard ok and
 * cancel buttons using the <code>createButton</code> framework method.
 * Subclasses may override.
 * </p>
 * 
 * @param parent the button bar composite
 */
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    updateButtons();
}

From source file:com.ibm.research.tours.fx.dialogs.TagPowerpointDialog.java

License:Open Source License

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

    getButton(IDialogConstants.OK_ID).setEnabled(false);

    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    refreshStatus();/* w  w w . j  a  va  2  s.c om*/
}

From source file:com.ibm.xsp.extlib.designer.bluemix.action.DeployAction.java

License:Open Source License

public static void deployWithQuestion() {
    if (ToolbarAction.project != null) {
        ManifestMultiPageEditor editor = BluemixUtil.getManifestEditor(ToolbarAction.project);
        if (editor != null) {
            if (editor.isDirty()) {
                MessageDialog dg = new MessageDialog(null, _DEPLOY_TXT, null,
                        "Do you want to save the Manifest before deployment?", // $NLX-DeployAction.DoyouwanttosavetheManifest-1$
                        MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
                                IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                        0);// w ww . j av a2 s . c  om

                switch (dg.open()) {
                case 0:
                    //yes
                    editor.doSave(null);
                    break;
                case 1:
                    //no
                    break;
                case 2:
                    //cancel
                    return;
                }
            }
        }

        // Check for a valid configuration
        BluemixConfig config = ConfigManager.getInstance().getConfig(ToolbarAction.project);
        if (config.isValid(true)) {
            // Check the Server configuration
            if (BluemixUtil.isServerConfigured()) {
                // All good - Deploy !!!
                DeployJob job = new DeployJob(config, ToolbarAction.project);
                job.start();
            } else {
                // Server configuration problem
                BluemixUtil.displayConfigureServerDialog();
            }
        } else {
            if (config.isValid(false)) {
                // Something is wrong with the Manifest
                if (ManifestUtil.doesManifestExist(config)) {
                    // Corrupt
                    String msg = "The Manifest for this application is invalid. Cannot deploy."; // $NLX-DeployAction.TheManifestforthisapplicationisin-1$
                    MessageDialog.openError(null, _DEPLOY_TXT, msg);
                } else {
                    // Missing
                    String msg = "The Manifest for this application is missing. Do you want to open the Configuration Wizard?"; // $NLX-DeployAction.TheManifestforthisapplicationismi-1$
                    if (MessageDialog.openQuestion(null, _DEPLOY_TXT, msg)) {
                        ConfigBluemixWizard.launch();
                    }
                }
            } else {
                // App has not been configured or the bluemix.properties file is missing or corrupt
                String msg = "This application is not configured for deployment. Do you want to open the Configuration Wizard?"; // $NLX-DeployAction.Thisapplicationisnotconfiguredfor-1$
                if (MessageDialog.openQuestion(null, _DEPLOY_TXT, msg)) {
                    ConfigBluemixWizard.launch();
                }
            }
        }
    } else {
        MessageDialog.openError(null, _DEPLOY_TXT,
                "No application has been selected or the selected application is not open."); // $NLX-DeployAction.Noapplicationhasbeenselectedorthe-1$
    }
}

From source file:com.ibm.xsp.extlib.designer.tooling.utils.WizardUtils.java

License:Open Source License

public static boolean findStandardDefAndAddDependency(final String uri, final String tagName,
        final DesignerProject project, final String errorMsg, final String proceedMsg) {
    FacesDefinition def = null;/*from   w  w  w. j  a v a2  s.  c om*/
    FacesRegistry localReg = project.getFacesRegistry();
    if (localReg != null) {
        def = localReg.findDef(uri, tagName);
        if (def != null) {
            return true;
        }
    }

    FacesRegistry globalReg = StandardRegistryMaintainer.getStandardRegistry();
    if (globalReg != null) {
        def = globalReg.findDef(uri, tagName);
        if (def != null) {
            if (ExtLibToolingUtil.isPropertiesOpenInEditor(project)) {
                LWPDMessageDialog msg = new LWPDMessageDialog(null, ProductUtil.getProductName(), null,
                        errorMsg, LWPDMessageDialog.WARNING, new String[] { IDialogConstants.CLOSE_LABEL }, 0);
                msg.open();
                return false;
            }

            String id = RegistryUtil.getProject(def).getId();
            if (!StringUtil.equals("com.ibm.xsp.extlib.library", id)) { // $NON-NLS-1$
                LWPDMessageDialog msg = new LWPDMessageDialog(null, ProductUtil.getProductName(), null,
                        proceedMsg, LWPDMessageDialog.INFORMATION,
                        new String[] { IDialogConstants.PROCEED_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
                if (msg.open() != LWPDMessageDialog.OK) {
                    return false;
                }
            }
            // third party lib - need to update the current db to depend on this lib!!
            XSPProperties props = new XSPProperties((IDominoDesignerProject) project);
            props.appendDependencies(id);
            props.save();
        }
    }
    return true;
}

From source file:com.ifedorenko.p2browser.dialogs.RepositoryLocationDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    button.setEnabled(false);//www. java2  s. c o  m
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}