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:net.sourceforge.taggerplugin.dialog.TagDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *//*from   w  w w  . ja v  a2 s .  c o m*/
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    nameTxt.setFocus();

    if (tag != null) {
        // set the edit data
        nameTxt.setText(tag.getName());
        descTxt.setText(tag.getDescription());
    }
}

From source file:net.sourceforge.texlipse.actions.InputQueryDialog.java

License:Open Source License

/**
 * Same kind of constructor as in InputDialog.
 * This class just doesn't create extra components.
 * //from w  w  w.  ja v a 2s  . c om
 * @param title dialog title
 * @param message dialog message
 * @param def default text for the textfield
 * @param vali validator for the text
 */
public InputQueryDialog(Shell shell, String title, String message, String def, IInputValidator vali) {
    super(shell, title, null, message, QUESTION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    initialText = def;
    input = def;
    validator = vali;
}

From source file:net.sourceforge.texlipse.actions.InputQueryDialog.java

License:Open Source License

/**
 * Convenience method to open a simple "enter text" dialog.
 * This version uses the workbench default "ok" and "cancel" labels
 * as button texts.//  ww  w  . j a va 2  s.c o m
 * 
 * @param title dialog title
 * @param message dialog message
 * @return query dialog
 */
public static InputQueryDialog createQuery(String title, String message) {
    return createQuery(title, message, IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL);
}

From source file:net.sourceforge.texlipse.properties.StringListFieldEditor.java

License:Open Source License

/**
 * Creates and returns a new item for the list.
 * This implementation opens a question dialog, where user can
 * enter a new item./*from   w  ww. j  a  v a  2 s .c  om*/
 * 
 * @return the string the user wanted to add, or null
 *         if the cancel button was pressed or the string was an empty one
 */
protected String getNewInputObject() {

    InputQueryDialog dialog = InputQueryDialog.createQuery("Enter string", "Please enter keyword",
            IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL);
    dialog.setValidator(this);

    int code = dialog.open();
    if (code == Window.OK) {

        String g = dialog.getInput();
        if (g != null && g.length() == 0) {
            return null;
        }

        return g;
    }
    return null;
}

From source file:net.sourceforge.texlipse.properties.TexlipseProperties.java

License:Open Source License

/**
 * Saves the project properties to a file.
 * //from w ww  .j av a 2  s  .  c  o m
 * @param project current project
 */
public static void saveProjectProperties(IProject project) {

    IFile settingsFile = project.getFile(LATEX_PROJECT_SETTINGS_FILE);

    // check if we can write to the properties file
    if (settingsFile.isReadOnly()) {
        IWorkbench workbench = PlatformUI.getWorkbench();
        workbench.getDisplay().asyncExec(new Runnable() {
            public void run() {
                IWorkbench workbench = PlatformUI.getWorkbench();
                // show an error message is the file is not writable
                MessageDialog dialog = new MessageDialog(workbench.getActiveWorkbenchWindow().getShell(),
                        TexlipsePlugin.getResourceString("projectSettingsReadOnlyTitle"), null,
                        TexlipsePlugin.getResourceString("projectSettingsReadOnly"), MessageDialog.ERROR,
                        new String[] { IDialogConstants.OK_LABEL }, 0);
                dialog.open();
            }
        });
        return;
    }

    Properties prop = new Properties();

    prop.setProperty(MAINFILE_PROPERTY, getProjectProperty(project, MAINFILE_PROPERTY));
    prop.setProperty(OUTPUTFILE_PROPERTY, getProjectProperty(project, OUTPUTFILE_PROPERTY));
    prop.setProperty(SOURCE_DIR_PROPERTY, getProjectProperty(project, SOURCE_DIR_PROPERTY));
    prop.setProperty(OUTPUT_DIR_PROPERTY, getProjectProperty(project, OUTPUT_DIR_PROPERTY));
    prop.setProperty(TEMP_DIR_PROPERTY, getProjectProperty(project, TEMP_DIR_PROPERTY));
    prop.setProperty(BIBREF_DIR_PROPERTY, getProjectProperty(project, BIBREF_DIR_PROPERTY));
    prop.setProperty(BUILDER_NUMBER, getProjectProperty(project, BUILDER_NUMBER));
    prop.setProperty(OUTPUT_FORMAT, getProjectProperty(project, OUTPUT_FORMAT));
    prop.setProperty(MARK_TEMP_DERIVED_PROPERTY, getProjectProperty(project, MARK_TEMP_DERIVED_PROPERTY));
    prop.setProperty(MARK_OUTPUT_DERIVED_PROPERTY, getProjectProperty(project, MARK_OUTPUT_DERIVED_PROPERTY));
    prop.setProperty(LANGUAGE_PROPERTY, getProjectProperty(project, LANGUAGE_PROPERTY));
    prop.setProperty(MAKEINDEX_STYLEFILE_PROPERTY, getProjectProperty(project, MAKEINDEX_STYLEFILE_PROPERTY));

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        prop.store(baos, "TeXlipse project settings");
    } catch (IOException e) {
    }

    NullProgressMonitor mon = new NullProgressMonitor();
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    try {

        if (settingsFile.exists()) {
            settingsFile.setContents(bais, true, false, mon);
        } else {
            settingsFile.create(bais, true, mon);
        }

    } catch (CoreException e) {
        TexlipsePlugin.log("Saving project property file", e);
    }
}

From source file:net.ssehub.easy.producer.ui.productline_editor.configuration.AnnotationsViewDialog.java

License:Apache License

/**
 * Creates only a OK button instead of the default behavior.
 * @param parent The button bar composite
 */// w ww . ja  v a  2s . c  o  m
@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create only OK button
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

From source file:net.timedoctor.internal.ui.UnparsedMessageDialog.java

License:Open Source License

public static void displayMessage(final Shell parent, final String message) {
    if (parent == null)
        throw new IllegalArgumentException("parent cannot be null");
    if (message == null)
        throw new IllegalArgumentException("message cannot be null");

    UnparsedMessageDialog dialog = new UnparsedMessageDialog(message, parent, "Unparsed lines", null,
            "These lines in the Trace file were not parsed", WARNING,
            new String[] { IDialogConstants.OK_LABEL, COPY_LABEL }, IDialogConstants.OK_ID);
    dialog.open();//  w  ww  .ja va2 s.c o m
    return;
}

From source file:net.tourbook.preferences.PrefPageTourTypes.java

License:Open Source License

private void onDeleteTourType() {

    final TourTypeColorDefinition selectedColorDefinition = getSelectedColorDefinition();
    final TourType selectedTourType = selectedColorDefinition.getTourType();

    // confirm deletion
    final String[] buttons = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };

    final MessageDialog dialog = new MessageDialog(this.getShell(),
            Messages.Pref_TourTypes_Dlg_delete_tour_type_title, null,
            NLS.bind(Messages.Pref_TourTypes_Dlg_delete_tour_type_msg, selectedTourType.getName()),
            MessageDialog.QUESTION, buttons, 1);

    if (dialog.open() != Window.OK) {
        setFocusToViewer();/*from ww w .  j av  a  2 s  .  c o m*/
        return;
    }

    // remove entity from the db
    if (deleteTourType(selectedTourType)) {

        // update model
        _dbTourTypes.remove(selectedTourType);

        _colorDefinitions.remove(selectedColorDefinition);

        // update UI
        _tourTypeViewer.remove(selectedColorDefinition);

        _isModified = true;
    }

    setFocusToViewer();
}

From source file:net.xmind.workbench.ui.internal.NewsletterSubscriptionDialog.java

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    text.setFocus();//from  w  ww  .  j a  v a2  s  .  c o  m
    if (value != null) {
        text.setText(value);
        text.selectAll();
    }
}

From source file:net.yatomiya.e4.ui.dialogs.TextMessageDialog.java

License:Open Source License

static String[] getButtonLabels(Type type) {
    String[] dialogButtonLabels;/* w  ww.  jav a  2s .c o m*/
    switch (type) {
    case NONE:
    case ERROR:
    case INFORMATION:
    case WARNING: {
        dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
        break;
    }
    case CONFIRM: {
        dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
        break;
    }
    case QUESTION: {
        dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
        break;
    }
    case QUESTION_WITH_CANCEL: {
        dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.CANCEL_LABEL };
        break;
    }
    default: {
        throw new IllegalArgumentException("Illegal value for kind in NMessageDialog.open()"); //$NON-NLS-1$
    }
    }
    return dialogButtonLabels;
}