List of usage examples for org.eclipse.jface.dialogs MessageDialog openQuestion
public static boolean openQuestion(Shell parent, String title, String message)
From source file:com.nokia.carbide.cpp.uiq.ui.viewwizard.ApplicationDefinitionPage.java
License:Open Source License
public boolean handleApplicationEditorDirty() { IDesignerDataModel rootModel = (IDesignerDataModel) getWizardManager().getDataStore() .get(ViewWizardManager.ROOT_MODEL_KEY); if (rootModel != null) { IEditorPart editorPart = EditorServices.findEditor(rootModel); if ((editorPart != null) && editorPart.isDirty()) { String messageFmt = Messages.getString("ApplicationDefinitionPage.AppEditorDirtyMessageFormat"); //$NON-NLS-1$ IProject project = (IProject) getWizardManager().getDataStore().get(ViewWizardManager.PROJECT_KEY); if (project != null) { String message = MessageFormat.format(messageFmt, new Object[] { project.getName() }); if (MessageDialog.openQuestion(getShell(), Messages.getString("ApplicationDefinitionPage.AppEditorDirtyMessageTitle"), message)) //$NON-NLS-1$ EditorServices.saveEditor(editorPart); else return false; }/*from www .jav a 2 s.c o m*/ } } return true; }
From source file:com.nokia.carbide.cpp.uiq.ui.viewwizard.ViewWizard.java
License:Open Source License
private boolean collisionDetected() { List<IPath> collisions = wizardManager.getSourceCollisions(); if (collisions.size() > 0) { String message = MessageFormat.format(Messages.getString("ViewWizard.CollisionMessage"), //$NON-NLS-1$ new Object[] { TextUtils.formatTabbedList(collisions) }); if (MessageDialog.openQuestion(getShell(), Messages.getString("ViewWizard.CollisionDialogTitle"), //$NON-NLS-1$ message))//from ww w .java2 s . c om return false; return true; } return false; }
From source file:com.nokia.carbide.internal.bugreport.ui.wizards.BugDescriptionPage.java
License:Open Source License
/** * The product plug-in might need to ask user some settings before we can move to * next page. This method asks the product if UI service is needed; if UI is needed, * method queries the user if (s)he wants to provide the necessary information, and * opens the product's UI if user wants to do so. * @return true if we can move to next page, false if not. */// www. ja v a 2 s . c o m public boolean canChangePage() { if (!product.uiServiceNeeded()) return true; if (MessageDialog.openQuestion(this.getShell(), Messages.getString("BugDescriptionPage.BugReporting"), //$NON-NLS-1$ product.getUiServiceText())) product.showUiService(this.getShell()); return false; }
From source file:com.nokia.carbide.internal.updater.ProjectUpdateJob.java
License:Open Source License
private void confirmUpdateFiles() { if (!doRefactoring) return;// w w w .ja va 2 s. c o m if (!session.getShowRefactoringDialog()) { doRefactoring = false; return; } // If there was no project update dialog then there's no need // to also show the file update confirmation dialog. if (!showedProjectUpdateDialog || !session.getConfirmFileUpdates() || WorkbenchUtils.isJUnitRunning()) { return; } getShell().getDisplay().syncExec(new Runnable() { public void run() { doRefactoring = MessageDialog.openQuestion(getShell(), Messages.getString("UpdateAction.FileUpdatesConfirmTitle"), //$NON-NLS-1$ Messages.getString("UpdateAction.FileUpdatesConfirmText")); //$NON-NLS-1$ } }); showedConfirmFileDialog = true; }
From source file:com.nokia.carbide.search.system.internal.ui.CopyToClipboardAction.java
License:Open Source License
private void copyToClipboard(Clipboard clipboard, String str, Shell shell) { try {//from w w w . j a v a2s. c o m clipboard.setContents(new String[] { str }, new Transfer[] { TextTransfer.getInstance() }); } catch (SWTError ex) { if (ex.code != DND.ERROR_CANNOT_SET_CLIPBOARD) throw ex; String title = SearchMessages.CopyToClipboardAction_error_title; String message = SearchMessages.CopyToClipboardAction_error_message; if (MessageDialog.openQuestion(shell, title, message)) copyToClipboard(clipboard, str, shell); } }
From source file:com.nokia.s60ct.cenrep.gui.editors.CRBrowser.java
License:Open Source License
protected boolean handleDirtyConflict() { return MessageDialog.openQuestion(getSite().getShell(), getString("_UI_FileConflict_label"), getString("_WARN_FileConflict")); }
From source file:com.nokia.s60ct.general.ValidatorGUI.java
License:Open Source License
@Override public boolean validateBeforeGenerate(Configuration conf, Object[] repos) { validate(getCRMLs(null), Collections.singletonList(conf), false); int numberOfErrors = MarkerManager.getInstance().getNumberOfErrors(); if (numberOfErrors == 0) { return true; } else {/* w w w. j av a 2 s . co m*/ showProblemsView(); String messagePrefix = ""; if (numberOfErrors == 1) messagePrefix = "One error."; else messagePrefix = numberOfErrors + " errors."; boolean answer = MessageDialog.openQuestion(this.shell, "Validation Error", messagePrefix + " Are you sure that you want to continue generation. Result files might contain errors"); return answer; } }
From source file:com.nokia.s60ct.gui.wizard.NewConfigurationWizard.java
License:Open Source License
/** * Do the work after everything is specified. * <!-- begin-user-doc -->//from w w w . jav a 2 s.com * <!-- end-user-doc --> * @generated */ @Override public boolean performFinish() { try { // Get the URI of the model file. // URI uri = getModelURI(); File file = new File(uri.toFileString()); if (uri.toFileString().startsWith(File.separator) && System.getProperties().getProperty("os.name").startsWith("Windows")) {//unusual case, but user typed path that starts with "\" String userDir = System.getProperty("user.dir"); char driveLetter = userDir.charAt(0); file = new File(driveLetter + ":" + uri.toFileString()); uri = URI.createFileURI(file.toString()); } final URI fileURI = uri; //final uri for innerclass readOnlyError = false; if (file.exists()) { if (!MessageDialog.openQuestion(getShell(), S60CtEditorPlugin.INSTANCE.getString("_UI_Question_title"), S60CtEditorPlugin.INSTANCE .getString("_WARN_FileConflict", new String[] { fileURI.toFileString() }))) { initialObjectCreationPage.selectFileField(); return false; } } // Do the work within an operation. // IRunnableWithProgress operation = new IRunnableWithProgress() { public void run(IProgressMonitor progressMonitor) { try { // Create a resource set // // ResourceSet resourceSet = new ResourceSetImpl(); // Create a resource for this file. // Resource resource = new ConfigurationemfResourceImpl(fileURI); // Add the initial model object to the contents. // EObject rootObject = createInitialModel(); if (rootObject != null) { resource.getContents().add(rootObject); } resource.save(null); } catch (java.io.FileNotFoundException ioe) { //folder is read-only readOnlyError = true; } catch (Exception exception) { S60CtEditorPlugin.INSTANCE.log(exception); } finally { progressMonitor.done(); } } }; getContainer().run(false, false, operation); if (readOnlyError) { MessageDialog.openError(getShell(), S60CtEditorPlugin.INSTANCE.getString("_UI_Error_title"), S60CtEditorPlugin.INSTANCE.getString("_UI_ReadOnlyFolderError_message", new String[] { fileURI.toFileString() })); return false; } OpenConfiguration.openEditor(fileURI); return true; } catch (Exception exception) { S60CtEditorPlugin.INSTANCE.log(exception); return false; } }
From source file:com.nokia.s60tools.analyzetool.global.Util.java
License:Open Source License
/** * Opens confirmation Dialog./*from www. j av a 2 s .c o m*/ * * @param text * Dialog info text * @return boolean True if user selects "Yes" False if user selects "No" */ public static boolean openConfirmationDialog(final String text) { Activator.getDefault().getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { ret = MessageDialog.openQuestion(new Shell(), Constants.ANALYZE_TOOL_TITLE, text); } }); return ret; }
From source file:com.nokia.s60tools.compatibilityanalyser.ui.editors.ComptAnalyserLauncher.java
License:Open Source License
public void open(IPath file) { try {// w w w . j a va2s. c o m Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(new File(file.toString())); engine = ParserEngine.parseTheConfiguration(document); String status = validateGivenData(engine); if (status != null) { boolean query = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Compatibility Analyser", "Invalid Configuration: " + status + "\n Do you want to edit the Configuration file?"); if (query) { engine.getCurrentSdkData().isOpenedFromConfigFile = true; engine.getCurrentSdkData().configFileSysPath = file.toString(); Runnable showWizardRunnable = new Runnable() { public void run() { WizardDialog wizDialog; AnalysisWizard wiz = new AnalysisWizard(engine); wiz.setNeedsProgressMonitor(true); wizDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz); wizDialog.create(); //wizDialog.getShell().setSize(550, 680); wizDialog.addPageChangedListener(wiz); wizDialog.open(); } }; Display.getDefault().asyncExec(showWizardRunnable); } //MessageDialog.openError(Display.getCurrent().getActiveShell(), "Compatibility Analyser", "Invalid Configuration: " + status); return; } runStaticAnalysis(engine); } catch (SAXException e) { Status status = new Status(IStatus.ERROR, "Compatibiliy Analyser", 0, e.getMessage(), null); ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Compatibiliy Analyser", "Unable to read the configuration", status); } catch (IOException e) { MessageDialog.openError(Display.getCurrent().getActiveShell(), "Compatibility Analyser", "Unable to read the configuration from " + file.toString()); } catch (ParserConfigurationException e) { Status status = new Status(IStatus.ERROR, "Compatibiliy Analyser", 0, e.getMessage(), null); ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Compatibiliy Analyser", "Unable to read the configuration", status); } }