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.ibm.xsp.extlib.designer.bluemix.manifest.editor.ManifestHybridEditorPage.java
License:Open Source License
protected boolean canOverwriteDeployFile(String srcFilename) { if (StringUtil.isNotEmpty(srcFilename)) { File srcFile = new File(srcFilename); File dstFile = new File( new Path(_deployDir).addTrailingSeparator().append(srcFile.getName()).toOSString()); if (!srcFile.equals(dstFile)) { if (dstFile.exists()) { String msg = StringUtil.format("\"{0}\" will be overwritten. Continue?", dstFile.getAbsolutePath()); // $NLX-ManifestHybridEditorPage.0willbeoverwrittenContinue-1$ if (!MessageDialog.openQuestion(null, "Copy file to deployment directory", msg)) { // $NLX-ManifestHybridEditorPage.Copyfiletodeploymentdirectory-1$ return false; }/*w w w . j a v a 2s. c o m*/ } } } return true; }
From source file:com.ibm.xsp.extlib.designer.bluemix.manifest.editor.ManifestMetaModel.java
License:Open Source License
@Override public boolean openDesign(DesignerProject designerProject) { if (designerProject != null) { IProject project = designerProject.getProject(); if (project != null) { BluemixConfig config = ConfigManager.getInstance() .getConfig((IDominoDesignerProject) designerProject); if (!config.isValid(false)) { // App has not been configured or bluemix.properties is corrupt String msg = "To edit the Manifest this application must be configured for deployment. Do you want to open the Configuration Wizard?"; // $NLX-ManifestMetaModel.ToedittheManifestthisApplicationm-1$ if (MessageDialog.openQuestion(null, BluemixUtil.productizeString("%BM_PRODUCT% Manifest"), msg)) { // $NLX-ManifestMetaModel.IBMBluemixManifest.1-1$ ConfigBluemixWizard.launch(); }//from w ww. j a v a 2s . c o m } else if (!ManifestUtil.doesManifestExist(config)) { // App config is valid but Manifest is missing String msg = "The Manifest for this application is missing. Do you want to open the Configuration Wizard?"; // $NLX-ManifestMetaModel.TheManifestforthisApplicat-1$ if (MessageDialog.openQuestion(null, BluemixUtil.productizeString("%BM_PRODUCT% Manifest"), msg)) { // $NLX-ManifestMetaModel.IBMBluemixManifest.1-1$ ConfigBluemixWizard.launch(); } } // Get the config again - it might have been changed by the Wizard config = ConfigManager.getInstance().getConfig((IDominoDesignerProject) designerProject); // Allow user to edit a corrupt Manifest if (config.isValid(false) && ManifestUtil.doesManifestExist(config)) { File file = ManifestUtil.getManifestFile(config); if (file.exists() && file.isFile()) { IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI()); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { page.openEditor( new BluemixManifestEditorInput(fileStore, (IDominoDesignerProject) designerProject), "com.ibm.xsp.extlib.designer.bluemix.manifest.editor"); // $NON-NLS-1$ } catch (PartInitException e) { if (BluemixLogger.BLUEMIX_LOGGER.isErrorEnabled()) { BluemixLogger.BLUEMIX_LOGGER.errorp(this, "openDesign", e, "Failed to open Manifest Editor {0}", fileStore); // $NON-NLS-1$ $NLE-ManifestMetaModel.FailedtoopenManifestEditor0-2$ } } } } } } return true; }
From source file:com.ibm.xsp.extlib.designer.bluemix.manifest.editor.ManifestMultiPageEditor.java
License:Open Source License
private void checkForExternalChange() { // Check has the file been externally modified if (_bean.externallyModified()) { // Only do this once per change _bean.resetModifiedTime();// ww w . j a v a 2 s. c o m // Ask the reload question String msg = "The file '{0}' has been changed on the file system. Do you wish to replace the editor contents with these changes?"; // $NLX-ManifestMultiPageEditor.Thefile0hasbeenchangedonthefilesy-1$ if (MessageDialog.openQuestion(null, "File changed", StringUtil.format(msg, _bean.getFileName()))) { // $NLX-ManifestMultiPageEditor.Filechanged-1$ // Reload the file _srcEditor.doRevertToSaved(); // Make sure the contents are reflected in the editor pageChange(getActivePage()); } else { // User has chosen not to reload - show editor as "dirty" _srcEditor.setExternallyModified(true); firePropertyChange(IEditorPart.PROP_DIRTY); } } }
From source file:com.ibm.xsp.extlib.designer.bluemix.manifest.editor.ManifestTableEditor.java
License:Open Source License
@SuppressWarnings("unchecked") // $NON-NLS-1$ public void deleteItem() { int selIndex = _tableViewer.getTable().getSelectionIndex(); if (selIndex >= 0) { if (MessageDialog.openQuestion(null, BluemixUtil.productizeString("%BM_PRODUCT%"), "Are you sure you want to delete this item?")) { // $NON-NLS-1$ $NLX-ManifestTableEditor.Areyousureyouwanttodeletethisitem-2$ ((ArrayList<EditTableItem>) _tableViewer.getInput()).remove(selIndex); _tableViewer.refresh();/*from ww w . ja va 2 s .c om*/ if (_callback != null) { _callback.contentsChanged(((CustomTable) _tableViewer.getTable()).getId()); } } } }
From source file:com.ibm.xsp.extlib.designer.bluemix.util.BluemixUtil.java
License:Open Source License
public static void displayConfigureServerDialog() { String msg = BluemixUtil.productizeString( "The %BM_PRODUCT% Server connection is not configured correctly. Open the %BM_PRODUCT% preferences?"); // $NLX-BluemixUtil.TheIBMBluemixServerconnectionisnotco-1$ if (MessageDialog.openQuestion(null, "Server Configuration", msg)) { // $NLX-BluemixUtil.ServerConfiguration-1$ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PreferencePage.BLUEMIX_PREF_PAGE, null, null); dialog.open();/*from w w w . j ava 2s. c o m*/ } }
From source file:com.iw.plugins.spindle.ui.preferences.WizardTemplatesPreferencePage.java
License:Mozilla Public License
/** * // ww w .jav a2 s . c o m */ protected void performExport() { FileDialog fileDialog = new FileDialog(getShell(), SWT.SAVE); fileDialog.setFilterExtensions(new String[] { "*.wksp.prefs", "*.*" }); fileDialog.setText("Choose file to export"); String filename = fileDialog.open(); if (filename != null) { File file = new File(filename); if (file.exists()) { if (!MessageDialog.openQuestion(getShell(), "File exists", "Do you want to overwrite '" + file.getName() + "' ?")) return; } Properties p = new Properties(); p.setProperty(XMLFileContextType.APPLICATION_FILE_CONTEXT_TYPE, fApplicationTemplateSelector.getSelectedTemplate().getName()); p.setProperty(XMLFileContextType.LIBRARY_FILE_CONTEXT_TYPE, fLibraryTemplateSelector.getSelectedTemplate().getName()); p.setProperty(XMLFileContextType.COMPONENT_FILE_CONTEXT_TYPE, fComponentTemplateSelector.getSelectedTemplate().getName()); p.setProperty(XMLFileContextType.PAGE_FILE_CONTEXT_TYPE, fPageTemplateSelector.getSelectedTemplate().getName()); p.setProperty(XMLFileContextType.TEMPLATE_FILE_CONTEXT_TYPE, fTapestryTemplateSelector.getSelectedTemplate().getName()); try { FileOutputStream out = new FileOutputStream(filename); StringBuffer buffer = new StringBuffer(); p.store(out, "Spindle wizard template defaults - workspace\n"); } catch (IOException e) { SpindleStatus status = new SpindleStatus(); status.setError(e.getMessage()); ErrorDialog.openError(getShell(), "Export Failed", e.getClass().toString(), status); } } }
From source file:com.iw.plugins.spindle.ui.properties.ProjectTemplatesPropertyPage.java
License:Mozilla Public License
protected void performExport() { FileDialog fileDialog = new FileDialog(getShell(), SWT.SAVE); fileDialog.setFilterExtensions(new String[] { "*.project.prefs", "*.*" }); fileDialog.setText("Choose file to export"); String filename = fileDialog.open(); if (filename != null) { File file = new File(filename); if (file.exists()) { if (!MessageDialog.openQuestion(getShell(), "File exists", "Do you want to overwrite '" + file.getName() + "' ?")) return; }/*from w w w . j a v a2s . c o m*/ Properties p = new Properties(); p.setProperty(XMLFileContextType.LIBRARY_FILE_CONTEXT_TYPE, fLibraryTemplateSelector.getSelectedTemplate().getName()); p.setProperty(XMLFileContextType.COMPONENT_FILE_CONTEXT_TYPE, fComponentTemplateSelector.getSelectedTemplate().getName()); p.setProperty(XMLFileContextType.PAGE_FILE_CONTEXT_TYPE, fPageTemplateSelector.getSelectedTemplate().getName()); p.setProperty(XMLFileContextType.TEMPLATE_FILE_CONTEXT_TYPE, fTapestryTemplateSelector.getSelectedTemplate().getName()); try { FileOutputStream out = new FileOutputStream(filename); StringBuffer buffer = new StringBuffer(); p.store(out, "Spindle wizard template defaults - project\n"); } catch (IOException e) { SpindleStatus status = new SpindleStatus(); status.setError(e.getMessage()); ErrorDialog.openError(getShell(), "Export Failed", e.getClass().toString(), status); } } }
From source file:com.jaspersoft.studio.components.map.property.MapDatasetSection.java
License:Open Source License
@Override public void createControls(final Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parent.setLayout(new GridLayout(2, false)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2;/*from w ww . ja v a2 s . c om*/ createWidget4Property(parent, StandardItemData.PROPERTY_ITEMS, false).getControl().setLayoutData(gd); final Button useMarkerDataset = new Button(parent, SWT.CHECK); useMarkerDataset.setText(Messages.MapDatasetSection_UseMarkersDatasetBtn); GridData gdBtn = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); gdBtn.horizontalIndent = 2; useMarkerDataset.setLayoutData(gdBtn); boolean enableAndShowDSPanel = isDatasetSet(); useMarkerDataset.setSelection(enableAndShowDSPanel); final Composite container = new Composite(parent, SWT.NONE); container.setLayout(new GridLayout()); GridData gdContainer = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); gdContainer.horizontalIndent = 5; container.setLayoutData(gdContainer); container.setEnabled(enableAndShowDSPanel); container.setVisible(enableAndShowDSPanel); final Composite group = getWidgetFactory().createSection(container, com.jaspersoft.studio.messages.Messages.MElementDataset_dataset_run, true, 2, 2); //$NON-NLS-1$ section = (ExpandableComposite) group.getParent(); createWidget4Property(group, JRDesignElementDataset.PROPERTY_DATASET_RUN); useMarkerDataset.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (useMarkerDataset.getSelection()) { toggleDSRunPanel(container, true); getElement().setPropertyValue(StandardItemData.PROPERTY_DATASET, new JRDesignElementDataset()); } else { boolean answer = MessageDialog.openQuestion(UIUtils.getShell(), Messages.MapDatasetSection_DeleteConfirmationTitle, Messages.MapDatasetSection_DeleteConfirmationMsg); if (!answer) { useMarkerDataset.setSelection(true); return; } toggleDSRunPanel(container, false); getElement().setPropertyValue(StandardItemData.PROPERTY_DATASET, null); } parent.layout(new Control[] { container }); } }); }
From source file:com.kdmanalytics.toif.report.internal.handlers.MergeTSV.java
License:Open Source License
/** * display the dialog to find the tsv file. * /*w w w .j av a 2 s . c o m*/ * @param event * the event from the handler execute method. * @return the file that has been selected by the user. */ private File displayFileDialog(final Shell shell) { FileDialog dialog = new FileDialog(shell, SWT.SAVE); dialog.setFilterNames(new String[] { "TSV Files", "All Files (*.*)" }); dialog.setFilterExtensions(new String[] { "*.tsv", "*.*" }); dialog.setFilterPath(System.getProperty("user.dir")); dialog.setFileName(""); final String open = dialog.open(); if (open == null) { return null; } File file = new File(open); if (!file.exists()) { MessageDialog.openQuestion(shell, "No File", "An incorrect file has been choosen...\nNothing will happen."); return null; } System.err.println(file.toString()); return file; }
From source file:com.liferay.ide.hook.ui.editor.HookXmlEditor.java
License:Open Source License
private void configureCustomJspValidation(final IProject project, final String customerJspPath) { final IFolder docFolder = CoreUtil.getDefaultDocrootFolder(project); if (docFolder != null) { final IPath newPath = org.eclipse.core.runtime.Path.fromOSString(customerJspPath); final IPath pathValue = docFolder.getFullPath().append(newPath); final IFolder customJspFolder = project.getFolder(pathValue.makeRelativeTo(project.getFullPath())); boolean needAddCustomJspValidation = HookUtil.configureJSPSyntaxValidationExclude(project, customJspFolder, false); if (!needAddCustomJspValidation) { UIUtil.async(new Runnable() { public void run() { final boolean addDisableCustomJspValidation = MessageDialog.openQuestion( UIUtil.getActiveShell(), Msgs.disableCustomValidationTitle, Msgs.disableCustomValidationMsg); if (addDisableCustomJspValidation) { new WorkspaceJob(" disable custom jsp validation for " + project.getName()) { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { HookUtil.configureJSPSyntaxValidationExclude(project, customJspFolder, true); project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor()); return Status.OK_STATUS; }// w ww . j ava 2s . co m }.schedule(); } } }); } } }