List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION
int INFORMATION
To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.
Click Source Link
From source file:net.rim.ejde.internal.ui.preferences.SignatureToolPrefsPage.java
License:Open Source License
private void removeKeys() { try {//from w ww . j a v a2 s. c om File cskFile = new File( VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.CSK_FILE_NAME); File dbFile = new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.DB_FILE_NAME); if ((!cskFile.exists()) && (!dbFile.exists())) { MessageDialog dialog = new MessageDialog(getShell(), Messages.CodeSigningPrefsPage_MessageDialogTitle3, null, Messages.CodeSigningPrefsPage_MessageDialogMsg3, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); return; } if (cskFile.exists()) { cskFile.renameTo(new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.CSK_FILE_NAME + IConstants.UNDERSCORE_STRING + System.currentTimeMillis())); } if (dbFile.exists()) { dbFile.renameTo(new File(VMToolsUtils.getVMToolsFolderPath() + File.separator + IConstants.DB_FILE_NAME + IConstants.UNDERSCORE_STRING + System.currentTimeMillis())); } if ((!cskFile.exists()) && (!dbFile.exists())) { MessageDialog dialog = new MessageDialog(getShell(), Messages.CodeSigningPrefsPage_MessageDialogTitle3, null, Messages.CodeSigningPrefsPage_MessageDialogMsg5 + Messages.CodeSigningPrefsPage_MessageDialogMsg6, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); _searchKeyLink.setEnabled(true); _removeKeyLink.setEnabled(false); _log.info(Messages.CodeSigningPrefsPage_MessageDialogMsg7); } } catch (IOException e) { _log.error(e.getMessage()); } }
From source file:net.rim.ejde.internal.util.UpgradingNotification.java
License:Open Source License
/** * Help method for opening a dialog//from w w w. j ava2s. c o m * * @param title * @param message * @param dialogButtonLabels * @return */ private DialogOutput openMessageDialog(final String title, final String message, final String upgradeUrl, final String[] dialogButtonLabels) { final DialogOutput result = new DialogOutput(); final Display display = Display.getDefault(); if (display != null && !display.isDisposed()) { display.syncExec(new Runnable() { public void run() { NewVersionDetectionDialog dialog = new NewVersionDetectionDialog(display.getActiveShell(), title, null, message, upgradeUrl, MessageDialog.INFORMATION, dialogButtonLabels, 0); result.setStatus(dialog.open()); _snoozeDays = dialog.getSnoozeDays(); } }); } return result; // return status of the dialog }
From source file:net.sf.eclipsensis.util.Common.java
License:Open Source License
public static void openInformation(Shell parent, String title, String message, Image icon) { MessageDialog dialog = new MessageDialog(parent, title, icon, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open();/* w w w . j av a 2 s . c om*/ }
From source file:net.sf.fjep.fatjar.wizard.FJExportWizardConfigPage.java
License:Open Source License
private void showOneJARHelp() { MessageDialog dialog = new MessageDialog(getShell(), "One-JAR", null, "One-JAR Help", MessageDialog.INFORMATION, new String[] { "OK" }, 0) { protected Font font; public boolean close() { boolean result; try { font.dispose();// w w w . ja v a 2 s . c o m } finally { result = super.close(); } return result; } protected Control createCustomArea(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = 600; gd.heightHint = 300; String resource = "one-jar-help.txt"; StringBuffer help = null; try { help = readText(this.getClass().getResourceAsStream(resource)); } catch (IOException iox1) { help = new StringBuffer(); help.append("Unable to locate built-in help for One-JAR at: " + resource + ": " + iox1); } Text text = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT); FontData fd = font.getFontData()[0]; // Reduce the font-size. TODO: Should make this configurable in // preferences. fd.setHeight(fd.getHeight() - 2); font = new Font(text.getDisplay(), fd); text.setFont(font); text.setEditable(false); text.setLayoutData(gd); text.setText(help.toString()); Hyperlink href = new Hyperlink(parent, SWT.NONE); href.setText("http://one-jar.sourceforge.net"); href.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE)); href.setUnderlined(true); href.addHyperlinkListener(new IHyperlinkListener() { public void linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent e) { } public void linkExited(org.eclipse.ui.forms.events.HyperlinkEvent e) { } public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) { try { SystemBrowserFactory factory = new SystemBrowserFactory(); factory.createBrowser().displayURL(e.getLabel()); } catch (Exception x) { MessageDialog.openError(e.display.getActiveShell(), "Unable to open " + e.getLabel(), "Unable to open browser: \n" + x.getStackTrace()); } } }); return text; } }; dialog.open(); }
From source file:net.sf.fjep.fatjar.wizard.FJExportWizardConfigPage.java
License:Open Source License
/** * Show the One-JAR license in a dialogbox. The first time the user sees * this they must accept its terms in order to be able to use One-JAR, under * its BSD-style license terms.//from w w w . j a va 2s . co m * * @return The code from the dialog. 0==Accept, 1==Reject. */ private int showOneJARLicense() { // Show license. String buttons[] = new String[] { "Accept", "Decline" }; MessageDialog dialog = new MessageDialog(getShell(), "One-JAR License", null, "One-JAR is licensed according to the following terms. Please visit http://one-jar.sourceforge.net for more information.", MessageDialog.INFORMATION, buttons, 0) { protected Control createCustomArea(Composite parent) { // Put the license text in the dialog. Text text = new Text(parent, SWT.BORDER | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY | SWT.MULTI); text.setEditable(false); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; text.setLayoutData(gd); // Load the license data as a resource. TODO: Resource this // name! try { JarInputStream jis = new JarInputStream( AguiPlugin.class.getResourceAsStream(AguiPlugin.ONE_JAR_BOOT)); JarEntry entry = (JarEntry) jis.getNextEntry(); StringBuffer license = new StringBuffer(); while (entry != null) { if (entry.getName().equals("doc/one-jar-license.txt")) { license = readText(jis); break; } entry = (JarEntry) jis.getNextEntry(); } text.setText(license.toString()); return text; } catch (Exception x) { text.setText("The One-JAR license is available at http://one-jar.sourceforge.net"); } return text; } }; return dialog.open(); }
From source file:net.sf.fjep.fatjar.wizards.export.ConfigPage.java
License:Open Source License
private void showOneJARHelp() { MessageDialog dialog = new MessageDialog(getShell(), "One-JAR", null, "One-JAR Help", MessageDialog.INFORMATION, new String[] { "OK" }, 0) { protected Font font; public boolean close() { boolean result; try { font.dispose();//from w w w . ja va2s .c om } finally { result = super.close(); } return result; } protected Control createCustomArea(Composite parent) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = 600; gd.heightHint = 300; String resource = "one-jar-help.txt"; StringBuffer help = null; try { help = readText(this.getClass().getResourceAsStream(resource)); } catch (IOException iox1) { help = new StringBuffer(); help.append("Unable to locate built-in help for One-JAR at: " + resource + ": " + iox1); } Text text = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT); FontData fd = font.getFontData()[0]; // Reduce the font-size. TODO: Should make this configurable in preferences. fd.setHeight(fd.getHeight() - 2); font = new Font(text.getDisplay(), fd); text.setFont(font); text.setEditable(false); text.setLayoutData(gd); text.setText(help.toString()); Hyperlink href = new Hyperlink(parent, SWT.NONE); href.setText("http://one-jar.sourceforge.net"); href.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE)); href.setUnderlined(true); href.addHyperlinkListener(new IHyperlinkListener() { public void linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent e) { } public void linkExited(org.eclipse.ui.forms.events.HyperlinkEvent e) { } public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) { try { SystemBrowserFactory factory = new SystemBrowserFactory(); factory.createBrowser().displayURL(e.getLabel()); } catch (Exception x) { MessageDialog.openError(e.display.getActiveShell(), "Unable to open " + e.getLabel(), "Unable to open browser: \n" + x.getStackTrace()); } } }); return text; } }; dialog.open(); }
From source file:net.sf.fjep.fatjar.wizards.export.ConfigPage.java
License:Open Source License
/** * Show the One-JAR license in a dialogbox. The first time the user sees this * they must accept its terms in order to be able to use One-JAR, under its * BSD-style license terms./*from w w w .j a v a 2 s .com*/ * @return The code from the dialog. 0==Accept, 1==Reject. */ private int showOneJARLicense() { // Show license. String buttons[] = new String[] { "Accept", "Decline" }; MessageDialog dialog = new MessageDialog(getShell(), "One-JAR License", null, "One-JAR is licensed according to the following terms. Please visit http://one-jar.sourceforge.net for more information.", MessageDialog.INFORMATION, buttons, 0) { protected Control createCustomArea(Composite parent) { // Put the license text in the dialog. Text text = new Text(parent, SWT.BORDER | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY | SWT.MULTI); text.setEditable(false); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; text.setLayoutData(gd); // Load the license data as a resource. TODO: Resource this name! try { JarInputStream jis = new JarInputStream( AguiPlugin.class.getResourceAsStream(AguiPlugin.ONE_JAR_BOOT)); JarEntry entry = (JarEntry) jis.getNextEntry(); StringBuffer license = new StringBuffer(); while (entry != null) { if (entry.getName().equals("doc/one-jar-license.txt")) { license = readText(jis); break; } entry = (JarEntry) jis.getNextEntry(); } text.setText(license.toString()); return text; } catch (Exception x) { text.setText("The One-JAR license is available at http://one-jar.sourceforge.net"); } return text; } }; return dialog.open(); }
From source file:net.sf.freeqda.common.handler.LoadProjectHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell(); //TODO check for active project and close if exists // File standard dialog FileDialog fileDialog = new FileDialog(shell, SWT.OPEN); // Initialise the dialog fileDialog.setText(DIALOG_TEXT);/* w ww. ja v a 2 s .c om*/ fileDialog.setFilterNames(new String[] { MessageFormat.format(Messages.LoadProjectHandler_Filter_FQDAProjects, new Object[] { SUFFIX_FQDA_PROJECTS }), MessageFormat.format(Messages.LoadProjectHandler_Filter_AllFiles, new Object[] { SUFFIX_ALL_FILES }) }); fileDialog.setFilterExtensions(new String[] { SUFFIX_FQDA_PROJECTS, SUFFIX_ALL_FILES }); //TODO create platform dependent wildcards! // Open Dialog and save result of selection String selected = fileDialog.open(); /* * Check if dialog has been canceled */ if (selected == null) { new MessageDialog(shell, DIALOG_LOAD_CANCELED_TITLE, null, DIALOG_LOAD_CANCELED_MESSAGE, MessageDialog.WARNING, new String[] { DIALOG_LOAD_CANCELED_BUTTONS }, 0).open(); return null; } /* * Load selected project file */ try { ProjectManager.getInstance().load(new File(selected)); new MessageDialog(shell, DIALOG_PROJECT_LOADED_TITLE, null, MessageFormat.format(Messages.LoadProjectHandler_DialogProjectLoaded_Message, new Object[] { selected }), MessageDialog.INFORMATION, new String[] { DIALOG_PROJECT_LOADED_BUTTONS }, 0).open(); } catch (IOException e) { new MessageDialog(shell, DIALOG_LOADING_FAILED_TITLE, null, MessageFormat.format(Messages.LoadProjectHandler_DialogProjectLoadingFailed_Message, new Object[] { selected }), MessageDialog.ERROR, new String[] { DIALOG_LOADING_FAILED_BUTTONS }, 0).open(); e.printStackTrace(); } return null; }
From source file:net.sf.freeqda.common.handler.SaveProjectHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell(); /*/* w ww . ja v a2s.co m*/ * Load selected project file */ try { /* * Save project data */ JAXBUtils.saveProject(PM.getProjectFile()); ProgressMonitorDialog progressMonitor = new ProgressMonitorDialog(shell); /* * Save dirty editors */ for (IEditorPart editor : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getDirtyEditors()) { if (editor instanceof StyledEditor) { StyledEditor styledEditor = (StyledEditor) editor; styledEditor.doSave(progressMonitor.getProgressMonitor()); } else if (editor instanceof TaggedPassagesEditor) { TaggedPassagesEditor taggedPassagesEditor = (TaggedPassagesEditor) editor; taggedPassagesEditor.doSave(progressMonitor.getProgressMonitor()); } else { new MessageDialog(shell, SAVE_PROJECT_UNHANDLED_TITLE, null, SAVE_PROJECT_UNHANDLED_MESSAGE, MessageDialog.ERROR, new String[] { SAVE_PROJECT_UNHANDLED_BUTTON_CONFIRM }, 0).open(); } } new MessageDialog(shell, SAVE_PROJECT_SUCCESS_TITLE, null, SAVE_PROJECT_SUCCESS_MESSAGE, MessageDialog.INFORMATION, new String[] { SAVE_PROJECT_SUCCESS_BUTTON_CONFIRM }, 0).open(); } catch (IOException e) { new MessageDialog(shell, SAVE_PROJECT_FAILED_TITLE, null, MessageFormat.format(Messages.SaveProjectHandler_SaveProjectFailed_Message, new Object[] { PM.getProjectFile().getAbsolutePath() }), MessageDialog.ERROR, new String[] { SAVE_PROJECT_FAILED_BUTTON_CONFIRM }, 0).open(); e.printStackTrace(); } return null; }
From source file:net.sf.freeqda.common.wizard.newproject.NewProjectWizard.java
License:Open Source License
@Override public boolean performFinish() { File projectDirectory = new File(ProjectManager.getInstance().getWorkspaceDirectory() + File.separator + nameSelectionPage.getProjectName()); projectDirectory.mkdirs();//from www . j av a2 s . c o m Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (projectDirectory.exists() && projectDirectory.canRead() && projectDirectory.canExecute()) { File projectFile = new File(projectDirectory, ProjectManager.FQDA_PROJECT_FILE_NAME); ObjectFactory of = new ObjectFactory(); FQDAProjectType newProject = of.createFQDAProjectType(); newProject.setName(nameSelectionPage.getProjectName()); if (projectFile.exists()) { nameSelectionPage.setErrorMessage(MessageFormat.format(Messages.NewProjectWizard_ErrorProjectExists, new Object[] { projectFile.getAbsolutePath() })); return false; } try { JAXBUtils.saveProject(projectFile); ProjectManager.getInstance().load(projectFile); new MessageDialog(shell, MSG_CREATION_SUCCEEDED_TITLE, null, MSG_CREATION_SUCCEEDED_TEXT, MessageDialog.INFORMATION, new String[] { BUTTON_OK_LABEL }, 0).open(); return true; } catch (IOException e) { e.printStackTrace(); nameSelectionPage.setErrorMessage(MessageFormat.format( Messages.NewProjectWizard_ErrorProjectCreationFailed, new Object[] { e.getMessage() })); return false; } } else { nameSelectionPage.setErrorMessage(ERROR_CANNOT_WRITE); return false; } }