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:de.innot.avreclipse.ui.dialogs.ChangeMCUDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    fOKButton = createButton(parent, OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:de.kolditz.common.ui.dialog.ErrorDialog.java

License:Open Source License

public ErrorDialog(Shell parentShell, String message, Throwable throwable) {
    /*//  w  w  w  . j a v a 2s  .com
    super(parentShell, e.getClass().getSimpleName(), parentShell != null ? parentShell.getDisplay().getSystemImage(
        SWT.ICON_ERROR) : Display.getDefault().getSystemImage(SWT.ICON_ERROR), message, ERROR,
        new String[] { IDialogConstants.OK_LABEL }, 0);
        */
    super(parentShell, throwable.getClass().getSimpleName(), null, message, ERROR,
            new String[] { IDialogConstants.OK_LABEL }, 0);
    this.throwable = throwable;
}

From source file:de.ovgu.featureide.fm.ui.editors.featuremodel.operations.DeleteAllOperation.java

License:Open Source License

@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {

    featureList = new LinkedList<Feature>();
    containedFeatureList = new LinkedList<Feature>();
    LinkedList<Feature> list = new LinkedList<Feature>();
    list.add(feature);/*from  ww  w.  j a va  2s.c om*/
    getFeaturesToDelete(list);

    if (containedFeatureList.isEmpty()) {
        for (Feature feat : featureList) {
            AbstractFeatureModelOperation op = new FeatureDeleteOperation(featureModel, feat);
            executeOperation(op);
            operations.add(op);
        }
    } else {
        final String containedFeatures = containedFeatureList.toString();
        MessageDialog dialog = new MessageDialog(new Shell(), " Delete Error ", FEATURE_SYMBOL,
                "The following features are contained in constraints:" + '\n'
                        + containedFeatures.substring(1, containedFeatures.length() - 1) + '\n' + '\n'
                        + "Unable to delete this features until all relevant constraints are removed.",
                MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);

        dialog.open();
    }
    return Status.OK_STATUS;
}

From source file:de.ovgu.featureide.fm.ui.editors.featuremodel.operations.DeleteOperation.java

License:Open Source License

/**
 * Opens an error dialog displaying the {@link Feature}s which could not be replaced by alternatives.
 * @param notDeletable The not deletable features
 *///from   www .  j  a  v a  2s. co  m
private void openErrorDialog(List<Feature> notDeletable) {
    String notDeletedFeatures = null;
    for (Feature f : notDeletable) {
        if (notDeletedFeatures == null) {
            notDeletedFeatures = "\"" + f.getName() + "\"";
        } else {
            notDeletedFeatures += ", \"" + f.getName() + "\"";
        }
    }

    MessageDialog dialog = new MessageDialog(new Shell(), " Delete Error ", FEATURE_SYMBOL,
            ((notDeletable.size() != 1) ? "The following features are contained in constraints:"
                    : "The following feature is contained in constraints:")
                    + "\n" + notDeletedFeatures + "\n"
                    + ((notDeletable.size() != 1)
                            ? "Select only one feature in order to replace it with an equivalent one."
                            : "It can not be replaced with an equivalent one."),
            MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);
    dialog.open();
}

From source file:de.ovgu.featureide.fm.ui.editors.featuremodel.operations.ElementDeleteOperation.java

License:Open Source License

/**
 * Opens an error dialog displaying the {@link Feature}s which could not be replaced by alternatives.
 * //from  w  w  w. ja  v  a 2 s  .  c o  m
 * @param notDeletable The not deletable features
 */
private void openErrorDialog(List<IFeature> notDeletable) {
    String notDeletedFeatures = null;
    for (IFeature f : notDeletable) {
        if (notDeletedFeatures == null) {
            notDeletedFeatures = "\"" + f.getName() + "\"";
        } else {
            notDeletedFeatures += ", \"" + f.getName() + "\"";
        }
    }

    MessageDialog dialog = new MessageDialog(new Shell(), DELETE_ERROR, FEATURE_SYMBOL,
            ((notDeletable.size() != 1) ? "The following features are contained in constraints:"
                    : "The following feature is contained in constraints:")
                    + "\n" + notDeletedFeatures + "\n"
                    + ((notDeletable.size() != 1)
                            ? SELECT_ONLY_ONE_FEATURE_IN_ORDER_TO_REPLACE_IT_WITH_AN_EQUIVALENT_ONE_
                            : IT_CAN_NOT_BE_REPLACED_WITH_AN_EQUIVALENT_ONE_),
            MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);
    dialog.open();
}

From source file:de.ovgu.featureide.fm.ui.editors.featuremodel.operations.FeatureTreeDeleteOperation.java

License:Open Source License

@Override
protected void createSingleOperations() {
    featureList = new LinkedList<IFeature>();
    containedFeatureList = new LinkedList<IFeature>();
    LinkedList<IFeature> list = new LinkedList<IFeature>();
    list.add(feature);/*from   w w  w  .  ja  v  a 2s .  c om*/
    getFeaturesToDelete(list);

    if (containedFeatureList.isEmpty()) {
        for (IFeature feat : featureList) {
            AbstractFeatureModelOperation op = new DeleteFeatureOperation(featureModel, feat);
            operations.add(op);
        }
    } else {
        final String containedFeatures = containedFeatureList.toString();
        MessageDialog dialog = new MessageDialog(new Shell(), DELETE_ERROR, FEATURE_SYMBOL,
                "The following features are contained in constraints:" + '\n'
                        + containedFeatures.substring(1, containedFeatures.length() - 1) + '\n' + '\n'
                        + UNABLE_TO_DELETE_THIS_FEATURES_UNTIL_ALL_RELEVANT_CONSTRAINTS_ARE_REMOVED_,
                MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);

        dialog.open();
    }
}

From source file:de.ovgu.featureide.fm.ui.GraphicsExporter.java

License:Open Source License

public static boolean exportAs(GraphicalViewerImpl viewer, File file) {
    boolean succ = false;

    if (file.getAbsolutePath().endsWith(".svg")) {
        ScalableFreeformRootEditPart part = (ScalableFreeformRootEditPart) viewer.getEditPartRegistry()
                .get(LayerManager.ID);/* w  w w  .  ja  v  a2  s .  c om*/
        IFigure rootFigure = part.getFigure();
        Bundle bundleExportSVG = null;
        for (Bundle b : InternalPlatform.getDefault().getBundleContext().getBundles()) {
            if (b.getSymbolicName().equals("nl.utwente.ce.imageexport.svg")) {
                bundleExportSVG = b;
                break;
            }
        }

        // check if gef-imageexport is existing and activated!
        if (bundleExportSVG != null) {
            try {
                org.osgi.framework.BundleActivator act = ((org.osgi.framework.BundleActivator) bundleExportSVG
                        .loadClass("nl.utwente.ce.imagexport.export.svg.Activator").newInstance());
                act.start(InternalPlatform.getDefault().getBundleContext());

                Class<?> cl = bundleExportSVG.loadClass("nl.utwente.ce.imagexport.export.svg.ExportSVG");
                Method m = cl.getMethod("exportImage", String.class, String.class, IFigure.class);
                m.invoke(cl.newInstance(), "SVG", file.getAbsolutePath(), rootFigure);
                succ = true;
            } catch (Exception e) {
                FMUIPlugin.getDefault().logError(e);
            }
        } else {
            final String infoMessage = "Eclipse plugin for exporting diagram in SVG format is not existing."
                    + "\nIf you want to use this, you have to install GEF Imageexport with SVG in Eclipse from "
                    + "\nhttp://veger.github.com/eclipse-gef-imageexport";

            MessageDialog dialog = new MessageDialog(new Shell(), "SVG export failed",
                    FMUIPlugin.getImage("FeatureIconSmall.ico"), infoMessage, MessageDialog.INFORMATION,
                    new String[] { IDialogConstants.OK_LABEL }, 0);

            dialog.open();
            FMUIPlugin.getDefault().logInfo(infoMessage);
            return false;
        }
    } else {
        GEFImageWriter.writeToFile(viewer, file);
        succ = true;
    }

    GraphicsExporter.printExportMessage(file, succ);

    return succ;
}

From source file:de.quamoco.adaptation.util.swt.SWTUtil.java

License:Apache License

/**
 * Create and opens simple error dialog with an OK button.
 * @param shell the shell of the dialog/*from  w  w w  .j a va  2s.co m*/
 * @param title the title of the dialog
 * @param message the message of the dialog
 * @param exeception the exception that was thrown (optional)
 */
public static void showErrorDialog(Shell shell, String title, String message, Exception exception) {
    String[] buttons = { IDialogConstants.OK_LABEL };
    if (exception != null) {
        message = message + "\n\nException: " + exception.getClass().getSimpleName() + "\nMessage: "
                + exception.getMessage();
    }
    new MessageDialog(shell, title, null, message, MessageDialog.ERROR, buttons, 0).open();
}

From source file:de.quamoco.adaptation.wizard.util.preselection.PreselectionDialog.java

License:Apache License

/** Just creates an OK Button. */
@Override/*from  ww  w  .  j av  a 2 s  . co m*/
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
}

From source file:de.quamoco.qm.properties.eval.util.Util.java

License:Apache License

public static void showOkMessageDialog(String title, String message, int dialogImageType) {
    String[] dialogButtonLabels = { IDialogConstants.OK_LABEL };
    MessageDialog dialog = new MessageDialog(null, title, null, message, dialogImageType, dialogButtonLabels,
            0);/*from w  w  w. jav  a 2 s . com*/
    dialog.open();
}