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

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

Introduction

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

Prototype

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

Source Link

Document

Convenience method to open a simple Yes/No question dialog.

Usage

From source file:au.gov.ansto.bragg.kakadu.ui.instrument.InstrumentDataSourceComposite.java

License:Open Source License

private boolean confirmFileRemove(String fileName) {
    return MessageDialog.openQuestion(getShell(), "Data Source View - Remove data file",
            "Are you sure you want to remove file '" + fileName + "'?");
}

From source file:au.gov.ansto.bragg.kakadu.ui.instrument.InstrumentDataSourceComposite.java

License:Open Source License

private boolean confirmRemoveAll() {
    return MessageDialog.openQuestion(getShell(), "Data Source View - Remove all",
            "Are you sure you want to remove all files from the list?");
}

From source file:au.gov.ansto.bragg.kakadu.ui.views.DataSourceComposite.java

License:Open Source License

protected boolean confirmFileReplace(String fileName) {
    return MessageDialog.openQuestion(getShell(), "Data Source View - Add data file",
            "The file '" + fileName + "' already exists.\nDo you want to replace and reload it?");
}

From source file:au.gov.ga.earthsci.application.handlers.QuitHandler.java

License:Apache License

@Execute
public void execute(IWorkbench workbench, IEclipseContext context,
        @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
        throws InvocationTargetException, InterruptedException {
    if (MessageDialog.openQuestion(shell, Messages.QuitHandler_DialogTitle,
            Messages.QuitHandler_DialogMessage)) {
        workbench.close();/*from w w  w  . j  a  va 2  s . c  o m*/
    }
}

From source file:au.gov.ga.earthsci.application.parts.browser.BrowserPart.java

License:Apache License

protected void startIntent(final Composite parent, String location) {
    //Raise an "optional" intent for event.location. For example, if it is a WMS
    //capabilities document, the user can optionally open it as a catalog or layer.
    URI uri;//from  w ww .ja va2  s. co  m
    try {
        uri = new URI(location);
    } catch (URISyntaxException e) {
        return;
    }
    Intent intent = new Intent();
    intent.setURI(uri);
    IIntentFilterSelectionPolicy filterSelectionPolicy = new IIntentFilterSelectionPolicy() {
        @Override
        public boolean allowed(Intent intent, IntentFilter filter) {
            //don't allow the filter to be the one that opens in the browser, causing a looping intent
            return !(HtmlIntentHandler.class.equals(filter.getHandler())
                    || HttpIntentHandler.class.equals(filter.getHandler()));
        }
    };
    IIntentCallback callback = new AbstractIntentCallback() {
        @Override
        public boolean filters(List<IntentFilter> filters, Intent intent) {
            if (filters.isEmpty()) {
                return false;
            }
            final boolean[] result = new boolean[1];
            if (!parent.isDisposed()) {
                parent.getDisplay().syncExec(new Runnable() {
                    @Override
                    public void run() {
                        result[0] = MessageDialog.openQuestion(parent.getShell(), "Open URL",
                                "This URL can be handled by EarthSci. Would you like to continue?");
                    }
                });
            }
            return result[0];
        }

        @Override
        public void error(Exception e, Intent intent) {
        }

        @Override
        public void completed(Object result, Intent intent) {
            if (result != null) {
                Dispatcher.getInstance().dispatch(result, intent, context);
            }
        }
    };
    IntentManager.getInstance().start(intent, filterSelectionPolicy, false, callback, context);
}

From source file:au.gov.ga.earthsci.application.parts.globe.handlers.StereoHandler.java

License:Apache License

protected void setupViewDelegate(IDelegateView view, String menuItemId, Composite parent) {
    try {/* ww w  .  ja va 2  s . c o  m*/
        Double initFov = Configuration.getDoubleValue(AVKey.FOV);
        if (initFov == null) {
            initFov = 45d;
        }
        view.setFieldOfView(Angle.fromDegrees(initFov));

        if (MENU_NONE.equals(menuItemId)) {
            view.setDelegate(null);
            return;
        }
        lastMenuItemId = menuItemId;
        if (MENU_OCULUSRIFT.equals(menuItemId)) {
            view.setDelegate(new RiftViewDistortionDelegate());
        } else if (MENU_OCULUSRIFTPREVIEW.equals(menuItemId)) {
            view.setDelegate(new RiftViewPreviewDelegate());
        } else {
            StereoViewDelegate delegate = new StereoViewDelegate();
            view.setDelegate(delegate);

            StereoViewParameters parameters = delegate.getParameters();
            parameters.setStereoEnabled(true);
            if (MENU_REDCYAN.equals(menuItemId)) {
                parameters.setStereoMode(StereoMode.RC_ANAGLYPH);
            } else if (MENU_GREENMAGENTA.equals(menuItemId)) {
                parameters.setStereoMode(StereoMode.GM_ANAGLYPH);
            } else if (MENU_BLUEYELLOW.equals(menuItemId)) {
                parameters.setStereoMode(StereoMode.BY_ANAGLYPH);
            } else {
                parameters.setStereoMode(StereoMode.STEREO_BUFFER);

                if (!lastWasStereo && !stereo) {
                    if (MessageDialog.openQuestion(parent.getShell(), Messages.StereoHandler_StereoDialogTitle,
                            Messages.StereoHandler_StereoDialogMessage)) {
                        PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(parent.getShell(),
                                GlobePreferencePage.PREFERENCE_PAGE_ID, null, null);
                        dialog.open();
                    }
                }
            }
        }
    } finally {
        lastWasStereo = MENU_QUADBUFFERED.equals(menuItemId);
    }
}

From source file:au.gov.ga.earthsci.discovery.ui.DiscoveryPart.java

License:Apache License

private void performSearch() {
    for (IDiscovery discovery : currentDiscoveries) {
        discovery.cancel();/*from www .  ja v  a  2  s  . com*/
    }
    currentDiscoveries.clear();
    discoverySelected(null);

    if (searchText.getText().length() > 0) {
        for (IDiscoveryService service : DiscoveryServiceManager.getServices()) {
            if (service.isEnabled()) {
                DiscoveryParameters parameters = new DiscoveryParameters();
                parameters.setQuery(searchText.getText());
                IDiscovery discovery = service.createDiscovery(parameters);
                if (discovery != null) {
                    currentDiscoveries.add(discovery);
                    discovery.addListener(DiscoveryPart.this);
                    discovery.start();
                }
            }
        }

        if (currentDiscoveries.isEmpty()) {
            if (MessageDialog.openQuestion(shell, Messages.DiscoveryPart_NoServicesDialogTitle,
                    Messages.DiscoveryPart_NoServicesDialogMessage)) {
                new ServicesHandler().execute(shell);
            }
        }
    }

    discoveriesViewer.setInput(currentDiscoveries);
    resultSelected(null);

    eventBroker.send(UIEvents.REQUEST_ENABLEMENT_UPDATE_TOPIC, UIEvents.ALL_ELEMENT_ID);
}

From source file:au.gov.ga.earthsci.layer.ui.handlers.DeleteAllHandler.java

License:Apache License

@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
    if (MessageDialog.openQuestion(shell, Messages.DeleteAllHandler_QuestionTitle,
            Messages.DeleteAllHandler_QuestionMessage)) {
        model.removeAllLayers();/* w w w  .ja  v  a  2s  .c o m*/
    }
}

From source file:au.gov.ga.earthsci.layer.ui.handlers.ResetHandler.java

License:Apache License

@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
    if (MessageDialog.openQuestion(shell, Messages.ResetHandler_QuestionTitle,
            Messages.ResetHandler_QuestionMessage)) {
        model.resetToDefaultLayers(context);
    }//from  w  w w . j  a  v  a  2s. c om
}

From source file:br.ufmg.dcc.tabuleta.actions.ClearAction.java

License:Open Source License

private boolean shouldProceed() {
    boolean lReturn = true;
    if (Tabuleta.getDefault().isDirty()) {
        lReturn = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                Tabuleta.getResourceString("actions.ClearAction.QuestionDialogTitle"),
                Tabuleta.getResourceString("actions.ClearAction.WarningOverwrite"));
    }//  w ww  .ja v  a 2  s.c  o  m
    return lReturn;
}