Example usage for org.eclipse.jface.dialogs MessageDialog openConfirm

List of usage examples for org.eclipse.jface.dialogs MessageDialog openConfirm

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog openConfirm.

Prototype

public static boolean openConfirm(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a simple confirm (OK/Cancel) dialog.

Usage

From source file:QuitHandler.java

License:Open Source License

 @Execute
public void execute(IWorkbench workbench, IEclipseContext context,
      @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
      throws InvocationTargetException, InterruptedException {
   if (MessageDialog.openConfirm(shell, "Confirmation",
         "Do you want to exit?")) {
      workbench.close();//  www .j  a  v  a  2  s .c  om
   }
}

From source file:$group_id$.core.handlers.QuitHandler.java

License:Open Source License

@Execute
public void execute(IWorkbench workbench, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
    if (MessageDialog.openConfirm(shell, "Confirmation", "Do you want to exit?")) {
        workbench.close();//from ww w  .j a  v a2s.c o m
    }
}

From source file:al.gov.asp.smc.e4.linkapp.handlers.QuitHandler.java

License:Open Source License

@Execute
public void execute(IWorkbench workbench, IEclipseContext context,
        @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
        throws InvocationTargetException, InterruptedException {
    if (MessageDialog.openConfirm(shell, "Confirmation", "Do you wasikuro daku xit?")) {
        workbench.close();// w ww.  j av  a  2  s . com
    }
}

From source file:alma.acs.alarmsystemprofiler.handlers.QuitHandler.java

License:Open Source License

@Execute
public void execute(IWorkbench workbench, Shell shell) {
    if (MessageDialog.openConfirm(shell, "Confirmation", "Do you want to exit?")) {
        AcsSourceClient.shutdown();//from w  w w . ja v  a 2 s . c o m
        workbench.close();
    }
}

From source file:application.e4.handlers.QuitHandler.java

License:Open Source License

@Execute
public void execute(IWorkbench workbench, IEclipseContext context,
        @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
        throws InvocationTargetException, InterruptedException {
    if (MessageDialog.openConfirm(shell, "Confirmation", "Do you want to exit?")) {
        workbench.close();//from   w  ww  .j  a va2  s .co  m
    }
}

From source file:ar.com.fluxit.jqa.wizard.page.UsageDefinitionWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;/*from  ww w  .  ja va 2  s .  c  o  m*/
    container.setLayout(layout);

    viewer = new GraphViewer(container, SWT.BORDER);
    viewer.setContentProvider(new LayersGraphContentProvider());
    viewer.setLabelProvider(new LayersGraphLabelProvider());
    viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
    LayoutAlgorithm graphLayout = new TreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING);
    graphLayout.setEntityAspectRatio(0.95);
    viewer.setLayoutAlgorithm(graphLayout, true);
    viewer.applyLayout();
    viewer.getGraphControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            StructuredSelection selection = (StructuredSelection) event.getSelection();
            if (!selection.isEmpty()) {
                @SuppressWarnings("unchecked")
                List<Object> selectedObjects = selection.toList();
                EntityConnectionData connection = findConnection(selectedObjects);
                if (connection == null) {
                    if (selectedObjects.size() > 1) {
                        LayerDescriptor sourceLayer = (LayerDescriptor) selectedObjects.get(0);
                        LayerDescriptor destinationLayer = (LayerDescriptor) selectedObjects.get(1);
                        sourceLayer.addUsage(destinationLayer);
                        viewer.refresh();
                        viewer.setSelection(StructuredSelection.EMPTY);
                    }
                } else {
                    ((LayerDescriptor) connection.source).removeUsage((LayerDescriptor) connection.dest);
                    viewer.refresh();
                    viewer.setSelection(StructuredSelection.EMPTY);
                }
            }
        }
    });

    final Menu menu = new Menu(viewer.getGraphControl());

    MenuItem layoutMenuItem = new MenuItem(menu, SWT.PUSH);
    layoutMenuItem.setText("Layout");
    layoutMenuItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            viewer.applyLayout();
        }
    });

    MenuItem resetMenuItem = new MenuItem(menu, SWT.PUSH);
    resetMenuItem.setText("Reset");
    resetMenuItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean openConfirm = MessageDialog.openConfirm(menu.getShell(), "Confirm reset", "Are you sure?");
            if (openConfirm) {
                for (LayerDescriptor layer : getArchitectureDescriptor().getLayers()) {
                    layer.clearUsages();
                    viewer.refresh();
                }
            }
        }
    });

    viewer.getGraphControl().setMenu(menu);
    setControl(container);
    ((WizardDialog) getContainer()).addPageChangedListener(this);
}

From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java

License:Open Source License

/**
 * handleRemoveMetaInfFile.//  ww w  .  ja v  a 2  s.  c o  m
 * 
 * @param value
 *            the value to delete
 * @return true if value was deleted, and false otherwise.
 */
private boolean handleRemoveMetaInfFile(final KeyValuePair value) {
    if (MessageDialog.openConfirm(getSite().getShell(), "Confirm delete",
            "Would really like to remove the selected META-INF file")) {
        RemoveCommand cmd = new RemoveCommand(editingDomain, getTask().getFiles(), value);
        if (cmd.canExecute()) {
            cmd.execute();
            return true;
        }
    }
    return false;
}

From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java

License:Open Source License

/**
 * handleRemoveFont./*from  w  w w . ja v a2 s  . c  o  m*/
 * 
 * @param value
 *            the value to delete
 * @return true if value was deleted, and false otherwise.
 */
private boolean handleRemoveFont(final KeyValuePair value) {
    if (MessageDialog.openConfirm(getSite().getShell(), "Confirm delete",
            "Would really like to remove the selected font")) {
        RemoveCommand cmd = new RemoveCommand(editingDomain, getTask().getFonts(), value);
        if (cmd.canExecute()) {
            cmd.execute();
            return true;
        }
    }
    return false;
}

From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java

License:Open Source License

/**
 * handleRemoveManifestAttr.// w ww  .  ja v  a2 s .co  m
 * 
 * @param value
 *            the value to delete
 * @return true if value was deleted, and false otherwise.
 */
private boolean handleRemoveManifestAttr(final Param value) {
    if (MessageDialog.openConfirm(getSite().getShell(), "Confirm delete",
            "Would really like to remove the selected attribute")) {
        RemoveCommand cmd = new RemoveCommand(editingDomain, getTask().getManifestEntries(), value);
        if (cmd.canExecute()) {
            cmd.execute();
            return true;
        }
    }
    return false;
}

From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java

License:Open Source License

/**
 * handleRemoveIcon.//w  ww .  jav a 2 s  . c om
 * 
 * @param value
 *            the value to delete
 * @return true if value was deleted, and false otherwise.
 */
private boolean handleRemoveIcon(final Icon value) {
    if (MessageDialog.openConfirm(getSite().getShell(), "Confirm delete",
            "Would really like to remove the selected icon")) {
        RemoveCommand cmd = new RemoveCommand(editingDomain, getTask().getDeploy().getInfo().getIcon(), value);
        if (cmd.canExecute()) {
            cmd.execute();
            return true;
        }
    }
    return false;
}