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.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();
                }//from w w  w. j a  v  a2  s  .co  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.jetbrains.mylyn.yt.ui.YouTrackRepositoryQueryPage.java

License:Open Source License

protected void createButtons(final Composite composite) {
    if (getContainer() instanceof QueryWizardDialog) {
        // refresh and clear buttons are provided by the dialog
        return;//from  w w w .  j a  v a  2 s  . c o m
    }
    if (needsRefresh) {
        refreshButton = new Button(composite, SWT.PUSH);
        refreshButton.setText(Messages.AbstractRepositoryQueryPage2__Refresh_From_Repository);
        refreshButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                if (getTaskRepository() != null) {
                    refreshConfiguration(true);
                } else {
                    MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
                            Messages.AbstractRepositoryQueryPage2_Update_Attributes_Failed,
                            Messages.AbstractRepositoryQueryPage2_No_repository_available_please_add_one_using_the_Task_Repositories_view);
                }
            }
        });
    }
    if (needsClear) {
        Button clearButton = new Button(composite, SWT.PUSH);
        clearButton.setText(Messages.AbstractRepositoryQueryPage2_Clear_Fields);
        clearButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                doClearControls();
            }
        });
    }
    final ProgressMonitorPart progressMonitorPart = new ProgressMonitorPart(composite, null);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
            .applyTo(progressMonitorPart);
    progressMonitorPart.setVisible(false);
    progressContainer = new ProgressContainer(composite.getShell(), progressMonitorPart) {
        @Override
        protected void restoreUiState(java.util.Map<Object, Object> state) {
            cancelButton.setVisible(false);
            CommonUiUtil.setEnabled(innerComposite, true);
            for (Control control : composite.getChildren()) {
                if (control instanceof ProgressMonitorPart) {
                    break;
                }
                control.setEnabled(true);
            }
        }

        @Override
        protected void saveUiState(java.util.Map<Object, Object> savedState) {
            CommonUiUtil.setEnabled(innerComposite, false);
            for (Control control : composite.getChildren()) {
                if (control instanceof ProgressMonitorPart) {
                    break;
                }
                control.setEnabled(false);
            }
            cancelButton.setEnabled(true);
            cancelButton.setVisible(true);
        }
    };

    cancelButton = new Button(composite, SWT.PUSH);
    cancelButton.setText(IDialogConstants.CANCEL_LABEL);
    cancelButton.setVisible(false);
    progressContainer.setCancelButton(cancelButton);
}

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

License:Open Source License

/**
 * Create contents of the button bar./*from ww w .j a va 2 s  . c o 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 w  w. j  a  va 2  s.  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.//w ww.j a va  2  s . co 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.laex.cg2d.screeneditor.views.AddLayerDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//from www  . j  a va2 s. com
 * 
 * @param parent
 *          the parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, "Add", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

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;/* ww w. j  a va  2s  .  c om*/
    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  ww  .j a v  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);
    }
}

From source file:com.microsoft.azuretools.azureexplorer.forms.createrediscache.CreateRedisCacheForm.java

License:Open Source License

/**
 * Create contents of the button bar./*from  w w  w  .  ja  v  a2 s  .  c  o  m*/
 * 
 * @param 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);
    btnOK = getButton(IDialogConstants.OK_ID);
    btnOK.setEnabled(false);
}

From source file:com.microsoft.azuretools.core.ui.SrvPriCreationStatusDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from w  w w  . ja v a2s.com*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button button = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.OK_LABEL, true);
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            onOk();
        }
    });
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}