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:at.rc.tacos.client.editors.JobEditor.java

License:Open Source License

/**
 * Creates the section to manage the changes
 *//*from  ww  w  .j  ava  2s  . c  o m*/
private void createManageSection(Composite parent) {
    Composite client = createSection(parent, "Verwendung verwalten");

    // create info label and hyperlinks to save and revert the changes
    infoLabel = new CLabel(client, SWT.NONE);
    infoLabel.setText("Hier knnen sie die aktuelle Verwendung verwalten und die nderungen speichern.");
    infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("admin.info"));

    // Create the hyperlink to save the changes
    saveHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    saveHyperlink.setText("nderungen speichern");
    saveHyperlink.setEnabled(false);
    saveHyperlink.setForeground(CustomColors.GREY_COLOR);
    saveHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.saveDisabled"));
    saveHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            EditorSaveAction saveAction = new EditorSaveAction();
            saveAction.run();
        }
    });

    // Create the hyperlink to remove the competence
    removeHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    removeHyperlink.setText("Verwendung lschen");
    removeHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.jobRemove"));
    removeHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            boolean result = MessageDialog.openConfirm(getSite().getShell(),
                    "Lschen der Verwendung besttigen",
                    "Mchten sie die Verwendung " + job.getJobName() + " wirklich lschen?");
            if (!result)
                return;
            // reset the dirty flag to prevent the 'save changes' to popup
            // on a deleted item
            isDirty = false;
            // send the remove request
            NetWrapper.getDefault().sendRemoveMessage(Job.ID, job);
        }
    });

    // info label should span over two
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.widthHint = 600;
    infoLabel.setLayoutData(data);
}

From source file:at.rc.tacos.client.editors.MobilePhoneEditor.java

License:Open Source License

/**
 * Creates the section to manage the changes
 *//*from   w  w w  .j av  a2  s  .  c o  m*/
private void createManageSection(Composite parent) {
    Composite client = createSection(parent, "Mobiltelefon verwalten");

    // create info label and hyperlinks to save and revert the changes
    infoLabel = new CLabel(client, SWT.NONE);
    infoLabel.setText("Hier knnen sie das aktuelle Mobiltelefon verwalten und die nderungen speichern.");
    infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("admin.info"));

    // Create the hyperlink to save the changes
    saveHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    saveHyperlink.setText("nderungen speichern");
    saveHyperlink.setEnabled(false);
    saveHyperlink.setForeground(CustomColors.GREY_COLOR);
    saveHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.saveDisabled"));
    saveHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            EditorSaveAction saveAction = new EditorSaveAction();
            saveAction.run();
        }
    });

    // Create the hyperlink to remove the competence
    removeHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    removeHyperlink.setText("Mobiltelefon lschen");
    removeHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.mobilePhoneRemove"));
    removeHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            boolean result = MessageDialog.openConfirm(getSite().getShell(),
                    "Lschen des Mobiltelefons besttigen",
                    "Mchten sie das Mobiltelefon " + detail.getMobilePhoneName() + "-"
                            + detail.getMobilePhoneNumber() + " wirklich lschen?");
            if (!result)
                return;
            // reset the dirty flag to prevent the 'save changes' to popup
            // on a deleted item
            isDirty = false;
            // send the remove request
            NetWrapper.getDefault().sendRemoveMessage(MobilePhoneDetail.ID, detail);
        }
    });

    // info label should span over two
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.widthHint = 600;
    infoLabel.setLayoutData(data);
}

From source file:at.rc.tacos.client.editors.ServiceTypeEditor.java

License:Open Source License

/**
 * Creates the section to manage the changes
 *//*from w w  w .  j  a  v  a  2s .co  m*/
private void createManageSection(Composite parent) {
    Composite client = createSection(parent, "Dienstverhltnis verwalten");

    // create info label and hyperlinks to save and revert the changes
    infoLabel = new CLabel(client, SWT.NONE);
    infoLabel.setText("Hier knnen sie das aktuelle Dienstverhltnis verwalten und die nderungen speichern.");
    infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("admin.info"));

    // Create the hyperlink to save the changes
    saveHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    saveHyperlink.setText("nderungen speichern");
    saveHyperlink.setEnabled(false);
    saveHyperlink.setForeground(CustomColors.GREY_COLOR);
    saveHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.saveDisabled"));
    saveHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            EditorSaveAction saveAction = new EditorSaveAction();
            saveAction.run();
        }
    });

    // Create the hyperlink to remove the competence
    removeHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    removeHyperlink.setText("Dienstverhltnis lschen");
    removeHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.serviceTypeRemove"));
    removeHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            boolean result = MessageDialog.openConfirm(getSite().getShell(),
                    "Lschen des Dienstverhltnisses besttigen",
                    "Mchten sie das Dienstverhltnis " + serviceType.getServiceName() + " wirklich lschen?");
            if (!result)
                return;
            // reset the dirty flag to prevent the 'save changes' to popup
            // on a deleted item
            isDirty = false;
            // send the remove request
            NetWrapper.getDefault().sendRemoveMessage(ServiceType.ID, serviceType);
        }
    });

    // info label should span over two
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.widthHint = 600;
    infoLabel.setLayoutData(data);
}

From source file:at.rc.tacos.client.editors.SickPersonEditor.java

License:Open Source License

/**
 * Creates the section to manage the changes
 *//*from   www.ja v a 2  s.  com*/
private void createManageSection(Composite parent) {
    Composite client = createSection(parent, "Patient verwalten");

    // create info label and hyperlinks to save and revert the changes
    infoLabel = new CLabel(client, SWT.NONE);
    infoLabel.setText("Hier knnen sie den aktuellen Patienten verwalten und die nderungen speichern.");
    infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("admin.info"));

    // Create the hyperlink to save the changes
    saveHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    saveHyperlink.setText("nderungen speichern");
    saveHyperlink.setEnabled(false);
    saveHyperlink.setForeground(CustomColors.GREY_COLOR);
    saveHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.saveDisabled"));
    saveHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            EditorSaveAction saveAction = new EditorSaveAction();
            saveAction.run();
        }
    });

    // Create the hyperlink to remove the competence
    removeHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    removeHyperlink.setText("Patient lschen");
    removeHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.patientDelete"));
    removeHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            boolean result = MessageDialog.openConfirm(getSite().getShell(), "Lschen des Patienten besttigen",
                    "Mchten sie den Patienten " + person.getLastName() + " wirklich lschen?");
            if (!result)
                return;
            // reset the dirty flag to prevent the 'save changes' to popup
            // on a deleted item
            isDirty = false;
            // send the remove request
            NetWrapper.getDefault().sendRemoveMessage(SickPerson.ID, person);
        }
    });

    // info label should span over two
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.widthHint = 600;
    infoLabel.setLayoutData(data);
}

From source file:at.rc.tacos.client.editors.VehicleDetailEditor.java

License:Open Source License

/**
 * Creates the section to manage the changes
 *//* w  ww  .j av a2s  .c  om*/
private void createManageSection(Composite parent) {
    Composite client = createSection(parent, "Fahrzeuge verwalten");

    // create info label and hyperlinks to save and revert the changes
    infoLabel = new CLabel(client, SWT.NONE);
    infoLabel.setText("Hier knnen sie das aktuelle Fahrzeug verwalten und die nderungen speichern.");
    infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("admin.info"));

    // Create the hyperlink to save the changes
    saveHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    saveHyperlink.setText("nderungen speichern");
    saveHyperlink.setEnabled(false);
    saveHyperlink.setForeground(CustomColors.GREY_COLOR);
    saveHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.saveDisabled"));
    saveHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            EditorSaveAction saveAction = new EditorSaveAction();
            saveAction.run();
        }
    });

    // Create the hyperlink to remove the competence
    removeHyperlink = toolkit.createImageHyperlink(client, SWT.NONE);
    removeHyperlink.setText("Fahrzeug lschen");
    removeHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.vehicleRemove"));
    removeHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            boolean result = MessageDialog.openConfirm(getSite().getShell(),
                    "Lschen des Fahrzeuges besttigen", "Mchten sie das Fahrzeug " + detail.getVehicleType()
                            + "-" + detail.getVehicleName() + " wirklich lschen?");
            if (!result)
                return;
            // reset the dirty flag to prevent the 'save changes' to popup
            // on a deleted item
            isDirty = false;
            // send the remove request
            NetWrapper.getDefault().sendRemoveMessage(VehicleDetail.ID, detail);
        }
    });

    // info label should span over two
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.widthHint = 600;
    infoLabel.setLayoutData(data);
}

From source file:at.rc.tacos.client.listeners.SessionListener.java

License:Open Source License

@Override
public void transferFailed(final AbstractMessageInfo info) {
    // the message to display
    final StringBuffer msg = new StringBuffer();
    msg.append("Die folgende Nachricht konnte nicht an den Server bertragen werden. (Zeitberschreitung).\n");
    msg.append(info.getContentType() + " -> " + info.getQueryString());

    // show a message
    Display.getDefault().syncExec(new Runnable() {

        public void run() {
            // show the message to the user
            MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Netzwerkfehler",
                    msg.toString());//ww  w. j  a va  2  s. c om
            // retry
            boolean retryConfirmed = MessageDialog.openConfirm(
                    PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Senden wiederholen",
                    "Wollen sie die Nachricht noch einmal senden?");
            if (!retryConfirmed)
                return;
            NetWrapper.getDefault().sheduleAndSend(info);
        }
    });
}

From source file:at.rc.tacos.client.view.TransportForm.java

License:Open Source License

/**
 * The user pressed the cancel button/*from ww w .  java 2s  .c  om*/
 */
@Override
protected void cancelPressed() {
    boolean result = MessageDialog.openConfirm(getShell(), "Abbrechen", "Wollen Sie wirklich abbrechen?");
    // check the result
    if (result) {
        LockManager.removeLock(Transport.ID, transport.getTransportId());
        getShell().close();
    }
}

From source file:au.gov.ansto.bragg.kakadu.dom.KakaduDOM.java

License:Open Source License

/**
 * Open a confirm dialog window and receive boolean value.
 * @param messageText String text//from   w w w .j  a  va 2 s. c o  m
 * @return boolean type
 * Created on 07/03/2008
 */
public boolean confirm(final String messageText) {
    final String title = "Confirm";
    //      final IWorkbench workbench = PlatformUI.getWorkbench();
    //      final IWorkbenchWindow workbenchWindow = workbench
    //      .getActiveWorkbenchWindow();
    activePage.getWorkbenchWindow().getWorkbench().getDisplay().syncExec(new Runnable() {

        public void run() {
            isConfirm = MessageDialog.openConfirm(activePage.getWorkbenchWindow().getShell(), title,
                    messageText);
        }

    });
    return isConfirm;
}

From source file:au.gov.ansto.bragg.kakadu.ui.editors.AlgorithmTaskEditor.java

License:Open Source License

private boolean confirmParametersApplying() {
    return MessageDialog.openConfirm(parent.getShell(), "Algorithm Task",
            "Changed parameters are going to be applyed before to continue.\n"
                    + "Do you want to apply changed parameters?");
}

From source file:au.gov.ansto.bragg.kakadu.ui.plot.FitPlotPropertiesComposite.java

License:Open Source License

private void removeFunction(String functionName) throws CoreException, FitterException {
    if (MessageDialog.openConfirm(getShell(), "Confirm Removal",
            "Do you want to remove function " + functionName + "?")) {
        String fileName = functionName + ".xml";
        IFolder folder = getProjectFolder();
        IFile file = folder.getFile(fileName);
        File rawFile = new File(file.getRawLocationURI());
        if (rawFile.exists())
            if (!rawFile.delete())
                throw new FitterException("can not remove the function, function is in use");
        updateFunctionCombo();//ww  w.ja va2 s  . co m
        fitFunctionCombo.select(0);
        selectFitFunction(fitFunctionCombo.getItem(fitFunctionCombo.getSelectionIndex()));
    }
}