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.symbian.smt.gui.smtwidgets.XmlFileSelectionDialog.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);

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

    // do this here because setting the m_text will set enablement on the ok
    // button//  w ww . jav a2 s. c  o  m
    inputText.setFocus();
    if (inputValue != null) {
        inputText.setText(inputValue);
        inputText.selectAll();
    }
}

From source file:com.testify.ecfeed.ui.dialogs.GeneratorSetupDialog.java

License:Open Source License

/**
 * Create contents of the button bar./* w  w w  .j av a 2s. com*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    fOkButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    if (fGenerateExecutableContent) {
        for (MethodParameterNode parameter : fMethod.getMethodParameters()) {
            EImplementationStatus parameterStatus = fStatusResolver.getImplementationStatus(parameter);
            if ((parameter.getChoices().isEmpty()
                    && (parameter.isExpected() == false || JavaUtils.isUserType(parameter.getType())))
                    || parameterStatus == EImplementationStatus.NOT_IMPLEMENTED) {
                setOkButton(false);
                break;
            }
        }
    } else {
        for (MethodParameterNode parameter : fMethod.getMethodParameters()) {
            if (parameter.getChoices().isEmpty()
                    && (parameter.isExpected() == false || JavaUtils.isUserType(parameter.getType()))) {
                setOkButton(false);
                break;
            }
        }
    }

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

From source file:com.testify.ecfeed.ui.wizards.NewEcFileWizard.java

License:Open Source License

public boolean performFinish() {
    IFile file = fPage.createNewFile();// w  w w  .  ja  v a2 s. c  om
    try {

        if (file.getContents().read() != -1) {
            MessageDialog dialog = new MessageDialog(getShell(), Messages.WIZARD_FILE_EXISTS_TITLE,
                    Display.getDefault().getSystemImage(SWT.ICON_QUESTION), Messages.WIZARD_FILE_EXISTS_MESSAGE,
                    MessageDialog.QUESTION_WITH_CANCEL,
                    new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL },
                    IDialogConstants.OK_ID);
            if (dialog.open() != IDialogConstants.OK_ID) {
                return false;
            }
        }

        final IPath newFileFullPath = fPage.getContainerFullPath().append(fPage.getFileName());
        String modelName = newFileFullPath.removeFileExtension().lastSegment();
        RootNode model = new RootNode(modelName != null ? modelName : Constants.DEFAULT_NEW_ECT_MODEL_NAME);
        ByteArrayOutputStream ostream = new ByteArrayOutputStream();
        new EctSerializer(ostream).serialize(model);
        ByteArrayInputStream istream = new ByteArrayInputStream(ostream.toByteArray());
        file.setContents(istream, true, true, null);

        //open new file in an ect editor
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

        page.openEditor(new FileEditorInput(file), Constants.ECT_EDITOR_ID);
    } catch (Exception e) {
        e.printStackTrace();
    }

    return true;
}

From source file:com.tocea.scertify.eclipse.scertifycode.ui.stats.views.internal.ScertifyMarkerFilterDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *///from ww w.j  a  v a2s.  c om

protected void createButtonsForButtonBar(Composite parent) {

    this.mBtnDefault = this.createButton(parent, IDialogConstants.BACK_ID,
            Messages.ScertifyMarkerFilterDialog_btnRestoreDefault, false);
    this.mBtnDefault.addSelectionListener(this.mController);

    // create OK and Cancel buttons by default
    this.createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    this.createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.toubassi.filebunker.ui.AboutDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, VIEW_LICENSE_ID, "View License", false);

    getButton(IDialogConstants.OK_ID).setFocus();
}

From source file:com.toubassi.jface.ObjectChooserDialog.java

License:Open Source License

public ObjectChooserDialog(Shell shell, Object[] objects, String title, String infoTitle, String description) {
    this(shell, objects, title, infoTitle, description, IDialogConstants.OK_LABEL);
}

From source file:com.vectrace.MercurialEclipse.dialogs.TransplantRejectsDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID,
            Messages.getString("TransplantRejectsDialog.tryAnotherTransplant"), false);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.insight.internal.ui.TcServerInsightSection.java

License:Open Source License

@Override
public void createSection(Composite parent) {
    super.createSection(parent);
    FormToolkit toolkit = getFormToolkit(parent.getDisplay());

    Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR
            | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE | ExpandableComposite.EXPANDED);
    section.setText("Overview");
    section.setDescription("Enable collection of performance metrics for deployed applications.");
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));

    Composite composite = toolkit.createComposite(section);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 8;//  w ww  . ja  v  a  2 s  .c om
    layout.marginWidth = 8;
    composite.setLayout(layout);
    toolkit.paintBordersFor(composite);
    section.setClient(composite);

    button = toolkit.createButton(composite, "Enable gathering of metrics", SWT.CHECK);
    button.addSelectionListener(new SelectionAdapter() {
        private boolean ignoreEvents;

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (ignoreEvents) {
                return;
            }
            if (button.getSelection() && server.getOriginal() != null
                    && !TcServerInsightUtil.isInsightCompatible(server.getOriginal())) {
                MessageDialog dialog = new MessageDialog(getShell(), "Enable Spring Insight", null,
                        "This version of Spring Insight is not compatible with tc Server instances that are installed on a path that contains spaces. Enabling Spring Insight may cause tc Server to fail to startup.\n\n"
                                + "Are you sure you want to enable Spring Insight?",
                        MessageDialog.ERROR,
                        new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 1);
                if (dialog.open() != 0) {
                    try {
                        ignoreEvents = true;
                        button.setSelection(false);
                    } finally {
                        ignoreEvents = false;
                    }
                    return;
                }
            }
            execute(new ModifyInsightVmArgsCommand(serverInstance, button.getSelection()));
        }
    });
    GridDataFactory.fillDefaults().span(2, 1).applyTo(button);

    initialize();
}

From source file:com.wakatime.eclipse.plugin.WakaTime.java

@Override
public void earlyStartup() {
    final IWorkbench workbench = PlatformUI.getWorkbench();

    // listen for save file events
    ICommandService commandService = (ICommandService) workbench.getService(ICommandService.class);
    executionListener = new CustomExecutionListener();
    commandService.addExecutionListener(executionListener);

    workbench.getDisplay().asyncExec(new Runnable() {
        public void run() {
            IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
            if (window == null)
                return;

            // prompt for apiKey if not set
            MenuHandler handler = new MenuHandler();
            DEBUG = handler.getDebug();//from ww w .j a  v  a 2s  . c  o m
            String apiKey = handler.getApiKey();
            if (apiKey == "") {
                handler.promptForApiKey(window);
            }

            Dependencies deps = new Dependencies();

            if (!deps.isPythonInstalled()) {
                deps.installPython();
                if (!deps.isPythonInstalled()) {
                    MessageDialog dialog = new MessageDialog(window.getShell(), "Warning!", null,
                            "WakaTime needs Python installed. Please install Python from python.org/downloads, then restart Eclipse.",
                            MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0);
                    dialog.open();
                }
            }
            if (!deps.isCLIInstalled()) {
                deps.installCLI();
            }

            if (window.getPartService() == null)
                return;

            // listen for caret movement
            if (window.getPartService().getActivePartReference() != null
                    && window.getPartService().getActivePartReference().getPage() != null
                    && window.getPartService().getActivePartReference().getPage().getActiveEditor() != null) {
                IEditorPart part = window.getPartService().getActivePartReference().getPage().getActiveEditor();
                if (!(part instanceof AbstractTextEditor))
                    return;
                ((StyledText) part.getAdapter(Control.class)).addCaretListener(new CustomCaretListener());
            }

            // listen for change of active file
            window.getPartService().addPartListener(editorListener);

            if (window.getPartService().getActivePart() == null)
                return;
            if (window.getPartService().getActivePart().getSite() == null)
                return;
            if (window.getPartService().getActivePart().getSite().getPage() == null)
                return;
            if (window.getPartService().getActivePart().getSite().getPage().getActiveEditor() == null)
                return;
            if (window.getPartService().getActivePart().getSite().getPage().getActiveEditor()
                    .getEditorInput() == null)
                return;

            // log file if one is opened by default
            IEditorInput input = window.getPartService().getActivePart().getSite().getPage().getActiveEditor()
                    .getEditorInput();
            if (input instanceof IURIEditorInput) {
                URI uri = ((IURIEditorInput) input).getURI();
                if (uri != null && uri.getPath() != null) {
                    String currentFile = uri.getPath();
                    long currentTime = System.currentTimeMillis() / 1000;
                    if (!currentFile.equals(WakaTime.getDefault().lastFile)
                            || WakaTime.getDefault().lastTime + WakaTime.FREQUENCY * 60 < currentTime) {
                        WakaTime.logFile(currentFile, WakaTime.getActiveProject(), false);
                        WakaTime.getDefault().lastFile = currentFile;
                        WakaTime.getDefault().lastTime = currentTime;
                    }
                }
            }

            WakaTime.log("Finished initializing WakaTime plugin (https://wakatime.com) v" + VERSION);
        }
    });
}

From source file:com.windowtester.eclipse.ui.dialogs.AbstractDetailsDialog.java

License:Open Source License

/**
 * Override superclass implementation to create OK and Details buttons
 * but no cancel button./* w  w w  . j  av  a 2s . co  m*/
 * 
 * @param parent the button bar
 */
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL,
            false);
}