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

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

Introduction

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

Prototype

String CLOSE_LABEL

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

Click Source Link

Document

The label for close buttons.

Usage

From source file:com.github.sdbg.debug.ui.internal.dialogs.ManageLaunchesDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // Close//from   w w  w .  j av  a2 s  .  c o m
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false);

    // Apply
    createButton(parent, IDialogConstants.CLIENT_ID, "Apply", false);
    getButton(IDialogConstants.CLIENT_ID).addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            handleApplyButton();
        }
    });

    // Run
    createButton(parent, IDialogConstants.OK_ID, Messages.ManageLaunchesDialog_launchRun, true);

    updateButtons();
}

From source file:com.google.dart.tools.ui.internal.text.dart.ContentAssistProcessor.java

License:Open Source License

/**
 * Informs the user about the fact that there are no enabled categories in the default content
 * assist set and shows a link to the preferences.
 *///from w  w  w  . ja va  2 s .c om
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = DartToolsPlugin.getActiveWorkbenchShell();
        String title = DartTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = DartTextMessages.ContentAssistProcessor_all_disabled_message;
        // see PreferencePage#createControl for the 'defaults' label
        final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$
        final String linkMessage = Messages.format(
                DartTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final int settingsId = IDialogConstants.CLIENT_ID + 11;
        final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
                shell, title, null /*
                                   * default image
                                   */, message, MessageDialog.WARNING,
                new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
            /*
             * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar
             * (org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected void createButtonsForButtonBar(Composite parent) {
                Button[] buttons = new Button[2];
                buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
                buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
                        true);
                setButtons(buttons);
            }

            /*
             * @see com.google.dart.tools.ui.dialogs.OptionalMessageDialog#createCustomArea
             * (org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected Control createCustomArea(Composite composite) {
                // wrap link and checkbox in one composite without space
                Composite parent = new Composite(composite, SWT.NONE);
                GridLayout layout = new GridLayout();
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.verticalSpacing = 0;
                parent.setLayout(layout);

                Composite linkComposite = new Composite(parent, SWT.NONE);
                layout = new GridLayout();
                layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
                layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
                linkComposite.setLayout(layout);

                Link link = new Link(linkComposite, SWT.NONE);
                link.setText(linkMessage);
                link.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        setReturnCode(settingsId);
                        close();
                    }
                });
                GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
                gridData.widthHint = this.getMinimumMessageWidth();
                link.setLayoutData(gridData);

                // create checkbox and "don't show this message" prompt
                super.createCustomArea(parent);

                return parent;
            }
        };
        int returnValue = dialog.open();
        if (restoreId == returnValue || settingsId == returnValue) {
            if (restoreId == returnValue) {
                IPreferenceStore store = DartToolsPlugin.getDefault().getPreferenceStore();
                store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
                store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            }
            if (settingsId == returnValue) {
                PreferencesUtil.createPreferenceDialogOn(shell,
                        "com.google.dart.tools.ui.internal.preferences.CodeAssistPreferenceAdvanced", null, //$NON-NLS-1$
                        null).open();
            }
            CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault();
            registry.reload();
            return true;
        }
    }
    return false;
}

From source file:com.google.gapid.views.WelcomeDialog.java

License:Apache License

public static void showWelcomeDialog(Shell shell, Models models, Widgets widgets) {
    new DialogBase(shell, widgets.theme) {
        private Button showWelcome;

        @Override//  ww w .jav  a 2  s .  c  om
        public String getTitle() {
            return Messages.WELCOME_TITLE;
        }

        @Override
        protected Control createDialogArea(Composite parent) {
            Composite area = (Composite) super.createDialogArea(parent);

            Composite container = createComposite(area, new GridLayout(1, false));
            container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

            createLabel(container, "", widgets.theme.dialogLogo())
                    .setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));

            Label title = createLabel(container, Messages.WELCOME_TEXT);
            title.setFont(widgets.theme.bigBoldFont());
            title.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));

            Label version = createLabel(container, "Version " + GAPID_VERSION.toFriendlyString());
            version.setForeground(widgets.theme.welcomeVersionColor());
            version.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));

            createLink(container, "<a>Open Trace...</a>", e -> {
                close(true);
                showOpenTraceDialog(shell, models);
            });
            String[] files = models.settings.getRecent();
            if (files.length > 0) {
                createLink(container, "<a>Open Recent...</a>", e -> {
                    Menu popup = new Menu(container);
                    for (String file : models.settings.recentFiles) {
                        createMenuItem(popup, file, 0, ev -> {
                            close(true);
                            models.capture.loadCapture(new File(file));
                        });
                    }
                    popup.addListener(SWT.Hide, ev -> scheduleIfNotDisposed(popup, popup::dispose));

                    popup.setLocation(container.toDisplay(bottomLeft(((Link) e.widget).getBounds())));
                    popup.setVisible(true);
                });
            }
            createLink(container, "<a>Capture Trace...</a>", e -> {
                close(true);
                showTracingDialog(shell, models, widgets);
            });
            createLink(container, "<a>Help...</a>", e -> showHelp());

            showWelcome = Widgets.createCheckbox(container, "Show on startup",
                    !models.settings.skipWelcomeScreen);
            return area;
        }

        @Override
        protected void createButtonsForButtonBar(Composite parent) {
            createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
        }

        @Override
        protected void buttonPressed(int buttonId) {
            close(buttonId == IDialogConstants.CLOSE_ID);
        }

        private void close(boolean saveState) {
            if (saveState) {
                models.settings.skipWelcomeScreen = !showWelcome.getSelection();
            }
            close();
        }
    }.open();
}

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;//w  ww . java  2s  . co  m
    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.maccasoft.composer.AboutDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
}

From source file:com.microsoft.tfs.client.common.ui.controls.vc.FindLabelDialog.java

License:Open Source License

public FindLabelDialog(final Shell parentShell, final TFSRepository repository,
        final String teamProjectServerPath) {
    super(parentShell);
    this.repository = repository;
    this.teamProjectServerPath = teamProjectServerPath;

    setOptionIncludeDefaultButtons(false);

    addButtonDescription(IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, false);

    addExtendedButtonDescription(BUTTON_EDIT_ID, Messages.getString("FindLabelDialog.Edit"), false); //$NON-NLS-1$
    addExtendedButtonDescription(BUTTON_DELETE_ID, Messages.getString("FindLabelDialog.Delete"), false); //$NON-NLS-1$
}

From source file:com.microsoft.tfs.client.common.ui.dialogs.connect.ServerListDialog.java

License:Open Source License

public ServerListDialog(final Shell parentShell, final ServerList serverList) {
    super(parentShell);

    Check.notNull(serverList, "serverList"); //$NON-NLS-1$
    this.serverList = serverList;

    setOptionIncludeDefaultButtons(false);
    addButtonDescription(IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
}

From source file:com.microsoft.tfs.client.common.ui.dialogs.vc.FindChangesetDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    if (closeOnlyMode) {
        addButtonDescription(IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, true);
    } else {/*from   www.ja  v  a  2  s  .  c  o m*/
        addButtonDescription(IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
        addButtonDescription(IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    }

    super.createButtonsForButtonBar(parent);
}

From source file:com.microsoft.tfs.client.common.ui.dialogs.vc.ShelvesetDetailsDialog.java

License:Open Source License

public ShelvesetDetailsDialog(final Shell parentShell, final Shelveset shelveset,
        final TFSRepository repository, final boolean allowUnshelve) {
    super(parentShell);
    this.shelveset = shelveset;
    this.repository = repository;
    dateFormat = DateHelper.getDefaultDateTimeFormat();
    this.allowUnshelve = allowUnshelve;

    setOptionIncludeDefaultButtons(false);

    if (allowUnshelve) {
        addButtonDescription(IDialogConstants.OK_ID,
                Messages.getString("ShelvesetDetailsDialog.UnshelveButtonText"), //$NON-NLS-1$
                true);/*w ww  .  j a va  2 s .c o  m*/
        addButtonDescription(IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    } else {
        addButtonDescription(IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, true);
    }
}

From source file:com.microsoft.tfs.client.common.ui.dialogs.workspaces.WorkspacesDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    if (workspaceRequired) {
        final Button okButton = createButton(parent, IDialogConstants.OK_ID,
                Messages.getString("WorkspacesDialog.UseWorkspaceButtonText"), //$NON-NLS-1$
                true);//from w  w  w  .j  a  v a 2 s .c  om
        createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false);
        new ButtonValidatorBinding(okButton).bind(control);
    } else {
        createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
    }
}