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:com.google.gdt.eclipse.designer.actions.ConvertIntoGwtProjectAction.java

License:Open Source License

public void run(IAction action) {
    if (!MessageDialog.openConfirm(DesignerPlugin.getShell(), "Confirm",
            "Do you really want to convert project '" + m_javaProject.getElementName()
                    + "' into GWT project?")) {
        return;/*w w w.  j  av  a2 s .  c  o m*/
    }
    //
    try {
        ProjectWizard.configureProjectAsGWTProject(m_javaProject);
    } catch (Throwable e) {
        DesignerPlugin.log(e);
    }
}

From source file:com.google.gdt.eclipse.designer.mobile.preferences.device.DevicesPreferencePage.java

License:Open Source License

/**
 * Removes selected {@link CategoryInfo} or {@link DeviceInfo}.
 *//*w  w w . j  a  v a 2 s. c  o  m*/
private void onRemove() {
    List<Object> selection = getSelectedElements();
    if (MessageDialog.openConfirm(getShell(), "Confirm",
            "Are you sure you want to remove " + selection.size() + " selected element(s)?")) {
        for (Object element : selection) {
            if (element instanceof CategoryInfo) {
                commands_add(new CategoryRemoveCommand((CategoryInfo) element));
            } else if (element instanceof DeviceInfo) {
                commands_add(new DeviceRemoveCommand((DeviceInfo) element));
            }
        }
        refreshViewer();
    }
}

From source file:com.google.gdt.eclipse.designer.uibinder.model.util.EventHandlerProperty.java

License:Open Source License

@Override
public void setValue(Object value) throws Exception {
    if (value == UNKNOWN_VALUE && isModified()) {
        if (MessageDialog.openConfirm(DesignerPlugin.getShell(), "Confirm",
                "Do you really want delete handle '" + m_handler.getMethodName() + "'?")) {
            ExecutionUtils.run(m_object, new RunnableEx() {
                public void run() throws Exception {
                    removeListener();// w w  w.j a v a2 s.c  o m
                }
            });
        }
    }
}

From source file:com.googlecode.osde.internal.shindig.CreateSampleDataAction.java

License:Apache License

public void run(IAction action) {
    try {//from  w  w  w  . j  a v  a2s  . c om
        final PersonService personService = Activator.getDefault().getPersonService();
        boolean confirm = MessageDialog.openConfirm(shell, "Confirm",
                "Would you like to create sample data in Shindig database?\n"
                        + "(Created people are 'conrad.doe', 'john.doe', 'jane.doe' and 'george.doe')");
        if (confirm) {
            Job job = new Job("Create sample data") {
                @Override
                protected IStatus run(IProgressMonitor monitor) {
                    Person[] samplePeople = createSamplePeople();
                    monitor.beginTask("Create sample data", samplePeople.length + 2);
                    if (isAlreadyExistsPeople(samplePeople, personService)) {
                        shell.getDisplay().syncExec(new Runnable() {
                            public void run() {
                                IWorkbenchWindow window = targetPart.getSite().getWorkbenchWindow();
                                MessageDialog.openWarning(window.getShell(), "Warning",
                                        "Sample people already exists.");
                            }
                        });
                        monitor.done();
                        return Status.OK_STATUS;
                    }
                    for (Person p : samplePeople) {
                        personService.storePerson(p);
                        monitor.worked(1);
                    }
                    setRelations(samplePeople, personService);
                    monitor.worked(1);
                    shell.getDisplay().syncExec(new Runnable() {
                        public void run() {
                            try {
                                IWorkbenchWindow window = targetPart.getSite().getWorkbenchWindow();
                                PersonView personView = (PersonView) window.getActivePage()
                                        .showView(PersonView.ID);
                                personView.loadPeople();
                            } catch (PartInitException e) {
                                // TODO: Handle PartInitException.
                                throw new IllegalStateException(e);
                            }
                        }
                    });
                    monitor.worked(1);
                    monitor.done();
                    return Status.OK_STATUS;
                }
            };
            job.setUser(true);
            job.schedule();
        }
    } catch (ConnectionException ce) {
        MessageDialog.openError(shell, "Error", "Shindig database not started yet.");
    }
}

From source file:com.googlecode.osde.internal.shindig.ShindigLauncher.java

License:Apache License

public static boolean launchWithConfirm(Shell shell, final IWorkbenchPart targetPart) {
    if (MessageDialog.openConfirm(shell, "Confirm",
            "Shindig not started yet. Would you like to start Shindig?")) {
        ShindigLauncher.launch(shell, targetPart);
        return true;
    } else {//  w w w  .j  a va 2s. c  o m
        return false;
    }
}

From source file:com.googlecode.osde.internal.ui.views.activities.ActivitiesView.java

License:Apache License

protected void removeAllActivities() {
    try {/*from   w w w. ja v a 2  s.  c o m*/
        ActivityService activityService = Activator.getDefault().getActivityService();
        if (MessageDialog.openConfirm(getSite().getShell(), "Confirm",
                "Would you like to delete all activities?")) {
            activityService.removeAll();
            loadPeople();
        }
    } catch (ConnectionException e) {
        MessageDialog.openError(getSite().getShell(), "Error", "Shindig database not started yet.");
    }
}

From source file:com.googlecode.osde.internal.ui.views.appdata.AppDataView.java

License:Apache License

public void removeAllAppData() {
    try {//from w ww .j  a va 2  s  . c o m
        AppDataService appDataService = Activator.getDefault().getAppDataService();
        if (MessageDialog.openConfirm(getSite().getShell(), "Confirm",
                "Would you like to delete all application data?")) {
            appDataService.removeAll();
            loadPeopleAndApplications();
        }
    } catch (ConnectionException e) {
        MessageDialog.openError(getSite().getShell(), "Error", "Shindig database not started yet.");
    }
}

From source file:com.googlecode.osde.internal.ui.views.apps.ApplicationView.java

License:Apache License

private void removeAllApplications() {
    try {//from   w  w  w  .  ja v a  2 s . c o m
        ApplicationService applicationService = Activator.getDefault().getApplicationService();
        if (MessageDialog.openConfirm(getSite().getShell(), "Confirm",
                "Would you like to delete all applications?")) {
            applicationService.removeAll();
            loadApplications();
        }
    } catch (ConnectionException e) {
        MessageDialog.openError(getSite().getShell(), "Error", "Shindig database not started yet.");
    }
}

From source file:com.googlecode.osde.internal.ui.views.people.PersonView.java

License:Apache License

private void removeAllPeople() {
    try {//from  w  ww  . ja  v  a 2s  .co m
        PersonService personService = Activator.getDefault().getPersonService();
        if (MessageDialog.openConfirm(getSite().getShell(), "Confirm",
                "Would you like to delete all people?")) {
            personService.removeAll();
            loadPeople();
        }
    } catch (ConnectionException e) {
        MessageDialog.openError(getSite().getShell(), "Error", "Shindig database not started yet.");
    }
}

From source file:com.hangum.tadpole.commons.admin.core.dialogs.users.ModifyUserDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (BTN_INITIALIZE_PASSWORD == buttonId) {
        if (MessageDialog.openConfirm(null, Messages.get().Confirm,
                String.format(Messages.get().ModifyUserDialog_9, "tadpole"))) { //$NON-NLS-3$
            userDAO.setPasswd("tadpole"); //$NON-NLS-1$
            try {
                TadpoleSystem_UserQuery.updateUserPassword(userDAO);
                SessionManager.updateSessionAttribute(SessionManager.NAME.LOGIN_PASSWORD.toString(),
                        userDAO.getPasswd());

                MessageDialog.openInformation(null, Messages.get().Confirm, Messages.get().ModifyUserDialog_17);
            } catch (Exception e) {
                logger.error("Changing password", e); //$NON-NLS-1$
                MessageDialog.openError(getShell(), Messages.get().Error, e.getMessage()); //$NON-NLS-1$
            }//from  ww  w .  j  a v a 2s.c o  m
        }

    } else {
        super.buttonPressed(buttonId);
    }
}