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

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

Introduction

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

Prototype

String OK_LABEL

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

Click Source Link

Document

The label for OK buttons.

Usage

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  a 2  s.c o 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.ifedorenko.m2e.sourcelookup.ui.internal.SourceLookupInfoDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, 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);/*from  ww w. j  av a2  s  .c o  m*/
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.iw.plugins.spindle.ui.properties.ProjectPropertyPage.java

License:Mozilla Public License

private void doOk(IProgressMonitor monitor) throws CoreException {
    // store the values as properties
    IResource resource = (IResource) getElement();

    // resource.setPersistentProperty(
    // new QualifiedName("", PROJECT_TYPE_PROPERTY),
    // new Integer(TapestryProject.APPLICATION_PROJECT_TYPE).toString());

    resource.setPersistentProperty(new QualifiedName("", CONTEXT_ROOT_PROPERTY), fWebContextRoot.getText());

    resource.setPersistentProperty(new QualifiedName("", VALIDATE_WEBXML_PROPERTY),
            Boolean.toString(fValidateWebXML.getSelection()));

    final IProject workspaceProject = (IProject) (this.getElement().getAdapter(IProject.class));
    IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
        public void run(IProgressMonitor monitor) throws CoreException {
            if (fIsTapestryProjectCheck.getSelection()) {

                String projectName = workspaceProject.getProject().getName();
                String temp = fWebContextRoot.getText();
                createFolderIfRequired(projectName + temp);
                fNewProjectMetadata.setWebContext(temp);
                fNewProjectMetadata.setValidateWebXML(fValidateWebXML.getSelection());
                fNewProjectMetadata.saveProperties(monitor);
                IJavaProject jproject = getJavaProject();
                TapestryProject prj = getTapestryProject();
                if (prj == null) {
                    TapestryProject.addTapestryNature(jproject, true);
                } else {
                    prj.clearMetadata();
                }/* ww w .  j  av a2s .c  o  m*/
                try {
                    if (jproject
                            .findType(TapestryCore.getString("TapestryComponentSpec.specInterface")) == null) {
                        MessageDialog dialog = new MessageDialog(getShell(), "Tapestry jars missing", null,
                                "Add the Tapestry jars to the classpath?", MessageDialog.INFORMATION,
                                new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
                        // OK is the default
                        int result = dialog.open();
                        if (result == 0) {
                            List entries = Arrays.asList(jproject.getRawClasspath());
                            ArrayList useEntries = new ArrayList(entries);
                            useEntries.add(JavaCore.newContainerEntry(new Path(TapestryCore.CORE_CONTAINER)));
                            jproject.setRawClasspath(
                                    (IClasspathEntry[]) useEntries.toArray(new IClasspathEntry[entries.size()]),
                                    monitor);
                        }
                    }
                } catch (JavaModelException e) {
                    UIPlugin.log(e);
                }

            } else {
                TapestryProject.removeTapestryNature(getJavaProject());
            }

            if (fIsTapestryProjectCheck.getSelection()) {
                IProject project = getJavaProject().getProject();
                project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
            }
        }

    };

    UIPlugin.getWorkspace().run(runnable, monitor);
}

From source file:com.jaspersoft.studio.jface.dialogs.DataAdapterErrorDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Details buttons
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createDetailsButton(parent);/*  w ww  . j  a va2 s . co  m*/
}

From source file:com.laex.cg2d.entityeditor.ui.AnimationPropertyChangeDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//from ww w  . ja  v a2 s.co m
 * 
 * @param parent
 *          the parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.laex.cg2d.screeneditor.handlers.EditShapeIDDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//  w  ww.  jav  a 2s. c  o  m
 * 
 * @param parent
 *          the parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    getButton(OK).setEnabled(false);
}

From source file:com.laex.cg2d.screeneditor.handlers.ImportScreenContentsDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from   www.  j av  a  2 s.  c  o  m*/
 * 
 * @param parent
 *          the parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    validateAll();
}

From source file:com.maccasoft.composer.InstrumentEditor.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.numColumns = 0;// w w w  .ja  va  2 s  .c o m
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = 0;
    layout.marginTop = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
            IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    Button button = createButton(composite, -1, "Get Spin Data");
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            StringBuilder sb = new StringBuilder();
            sb.append("DAT\n\n");

            sb.append(name.getText().replace(' ', '_'));
            sb.append("\n");

            for (Command cmd : list) {
                if (!cmd.isDisabled()) {
                    sb.append("    " + cmd.toSpinString() + "\n");
                }
            }

            TextDialog dlg = new TextDialog(getShell());
            dlg.setString(sb.toString());
            dlg.open();
        }
    });

    button = createButton(composite, -1, "Get C Data");
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            StringBuilder sb = new StringBuilder();
            sb.append(String.format("uint32_t %s[] = {\n", name.getText().replace(' ', '_')));

            for (Command cmd : list) {
                if (!cmd.isDisabled()) {
                    sb.append("    " + cmd.toCString() + ",\n");
                }
            }

            sb.append("};\n");

            TextDialog dlg = new TextDialog(getShell());
            dlg.setString(sb.toString());
            dlg.open();
        }
    });

    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    layout.numColumns++;

    button = createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL);
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            okPressed();
            setReturnCode(OK);
            close();
        }
    });
    getShell().setDefaultButton(button);

    button = createButton(composite, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL);
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            close();
        }
    });

    return composite;
}

From source file:com.mentor.nucleus.bp.core.ui.dialogs.ScrolledTextDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (optionalText != null) {
        ((GridLayout) parent.getLayout()).numColumns++;
        optionalButton = new Button(parent, SWT.CHECK);
        optionalButton.setText(optionalText);
        optionalButton.setFont(JFaceResources.getDialogFont());
        optionalButton.setSelection(false);
        setButtonLayoutData(optionalButton);
    }// w  w w. jav a 2  s. co m
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    if (allowCancel) {
        createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    }
}