List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_LABEL
String OK_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_LABEL.
Click Source Link
From source file:net.sf.eclipsensis.util.Common.java
License:Open Source License
public static void openError(Shell parent, String title, String message, Image icon) { MessageDialog dialog = new MessageDialog(parent, title, icon, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open();//www .j av a2s . c o m }
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 2s . c o m }
From source file:net.sf.eclipsensis.util.Common.java
License:Open Source License
public static void openWarning(Shell parent, String title, String message, Image icon) { MessageDialog dialog = new MessageDialog(parent, title, icon, message, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open();//w w w .ja va2 s.c o m }
From source file:net.sf.eclipsensis.util.NSISCompileTestUtility.java
License:Open Source License
private boolean saveEditors(List<IEditorPart> editors, int beforeCompileSave) { List<IEditorPart> editors2 = editors; if (!Common.isEmptyCollection(editors2)) { boolean ok = false; String message = null;//from w ww .j ava 2s . c o m switch (beforeCompileSave) { case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_ASSOCIATED_CONFIRM: if (editors2.size() > 1) { StringBuffer buf = new StringBuffer(); for (Iterator<IEditorPart> iter = editors2.iterator(); iter.hasNext();) { IEditorPart editor = iter.next(); buf.append(INSISConstants.LINE_SEPARATOR).append( ((IFileEditorInput) editor.getEditorInput()).getFile().getFullPath().toString()); } message = EclipseNSISPlugin.getFormattedString("compile.save.associated.confirmation", //$NON-NLS-1$ new String[] { buf.toString() }); break; } //$FALL-THROUGH$ case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_CURRENT_CONFIRM: IEditorPart editor = editors2.get(0); if (editors2.size() > 1) { editors2 = editors2.subList(0, 1); } IPathEditorInput input = NSISEditorUtilities.getPathEditorInput(editor); IPath path = (input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile().getFullPath() : input.getPath()); message = EclipseNSISPlugin.getFormattedString("compile.save.current.confirmation", //$NON-NLS-1$ new String[] { path.toString() }); break; case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_ALL_CONFIRM: message = EclipseNSISPlugin.getResourceString("compile.save.all.confirmation"); //$NON-NLS-1$ break; case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_CURRENT_AUTO: case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_ASSOCIATED_AUTO: case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_ALL_AUTO: ok = true; } Shell shell = Display.getDefault().getActiveShell(); if (!ok) { MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, EclipseNSISPlugin.getResourceString("confirm.title"), //$NON-NLS-1$ EclipseNSISPlugin.getShellImage(), message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0, EclipseNSISPlugin.getResourceString("compile.save.toggle.message"), false); //$NON-NLS-1$ dialog.open(); ok = dialog.getReturnCode() == IDialogConstants.OK_ID; if (ok && dialog.getToggleState()) { NSISPreferences.getInstance().setBeforeCompileSave( beforeCompileSave | INSISPreferenceConstants.BEFORE_COMPILE_SAVE_AUTO_FLAG); NSISPreferences.getInstance().store(); } } if (ok) { ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); dialog.open(); IProgressMonitor progressMonitor = dialog.getProgressMonitor(); if (editors2.size() > 1) { progressMonitor.beginTask( EclipseNSISPlugin.getResourceString("saving.before.compilation.task.name"), //$NON-NLS-1$ editors2.size()); for (Iterator<IEditorPart> iter = editors2.iterator(); iter.hasNext();) { IEditorPart editor = iter.next(); SubProgressMonitor monitor = new SubProgressMonitor(progressMonitor, 1); editor.doSave(monitor); if (monitor.isCanceled()) { break; } } } else { editors2.get(0).doSave(progressMonitor); } dialog.close(); if (progressMonitor.isCanceled()) { return false; } } return ok; } return true; }
From source file:net.sf.jmoney.copier.actions.CutSessionAction.java
License:Open Source License
/** * The action has been activated. The argument of the * method represents the 'real' action sitting * in the workbench UI.//w w w . j a v a 2 s. c o m * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { DatastoreManager sessionManager = JMoneyPlugin.getDefault().getSessionManager(); if (sessionManager == null) { MessageDialog waitDialog = new MessageDialog(window.getShell(), "Menu item unavailable", null, // accept the default window icon "No session is open. " + "This action is used to copy session data from one session to another. " + "You must first use this action to save the contents of the current session. " + "You must then open another session and then select the 'Paste Contents' action. " + "The contents of the session will then be copied into the new session.", MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); waitDialog.open(); return; } // We call canClose now so that we are sure // that we can later close the session without // further user input. If the user does not // provide at this time all the information required // to close the session then we terminate the operation // now. if (!sessionManager.canClose(window)) { return; } // Save the session in a static location. // The session is left open so that we can // later read the data from it. CopierPlugin.setSessionManager(sessionManager); /* * Close this window but leave the session open. * * This ensures that the session cannot be closed before * it is pasted into the new location. */ // TODO: There is a problem with this. If the session is // never pasted then it is never closed. Better may be to // leave the window open, requiring the user to create a // target session in another window, and giving an error if // a paste is done after the source session was closed. try { window.getActivePage().close(); window.openPage(null); } catch (WorkbenchException e) { // TODO: Uncomment this when this becomes a handler // throw new ExecutionException("Workbench exception occured while closing window.", e); //$NON-NLS-1$ } }
From source file:net.sf.jmoney.copier.actions.PasteContentsAction.java
License:Open Source License
/** * The action has been activated. The argument of the * method represents the 'real' action sitting * in the workbench UI./*from w w w. ja v a 2 s. c om*/ * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { DatastoreManager destinationSessionManager = JMoneyPlugin.getDefault().getSessionManager(); if (destinationSessionManager == null) { MessageDialog waitDialog = new MessageDialog(window.getShell(), "Menu item unavailable", null, // accept the default window icon "No session is open. " + "This action is used to copy session data from one session to another. " + "You must open a new session into which the session contents can be copied.", MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); waitDialog.open(); return; } DatastoreManager sourceSessionManager = CopierPlugin.getSessionManager(); if (sourceSessionManager == null) { MessageDialog waitDialog = new MessageDialog(window.getShell(), "Menu item unavailable", null, // accept the default window icon "No session has been cut. " + "Before using this action, you must first use the 'Cut Session' action " + "while the source session is open.", MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); waitDialog.open(); return; } // Copy the data across. CopierPlugin.getDefault().populateSession(destinationSessionManager.getSession(), sourceSessionManager.getSession()); // Confirm copy. }
From source file:net.sf.jmoney.gnucashXML.AccountChooser.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { // create OK and Cancel buttons by default okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); //do this here because setting the text will set enablement on the ok button text.setFocus();/* w w w . j a va2s . c o m*/ if (value != null) { text.setText(value); text.selectAll(); } }
From source file:net.sf.jmoney.gnucashXML.actions.GnucashXMLExportAction.java
License:Open Source License
/** * The action has been activated. The argument of the * method represents the 'real' action sitting * in the workbench UI.//from w w w . j ava 2 s . c o m * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { Session session = JMoneyPlugin.getDefault().getSession(); // Original JMoney disabled the export menu items when no // session was open. I don't know how to do that in Eclipse, // so we display a message instead. if (session == null) { MessageDialog waitDialog = new MessageDialog(window.getShell(), "Disabled Action Selected", null, // accept the default window icon "You cannot export data unless you have a session open. You must first open a session or create a new session.", MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); waitDialog.open(); return; } // Display a warning // TODO Remove this warning when the problem is resolved MessageBox diag = new MessageBox(window.getShell()); diag.setText("Warning"); diag.setMessage( "Warning:\nFor this time, the export as a GnuCash file produce a file which can't be imported under GnuCash. The file can only be imported in the current JMoney application."); diag.open(); FileDialog xmlFileChooser = new FileDialog(window.getShell()); xmlFileChooser.setText(GnucashXMLPlugin.getResourceString("MainFrame.export")); xmlFileChooser.setFilterExtensions(new String[] { "*.xml;*.xac" }); xmlFileChooser.setFilterNames(new String[] { "XML Gnucash Files (*.xml; *.xac)" }); // TODO: Faucheux - delete Directory xmlFileChooser.setFilterPath("D:\\Documents and Settings\\Administrateur\\Mes documents\\Mes comptes"); String fileName = xmlFileChooser.open(); if (fileName != null) { GnucashXML export = GnucashXML.getSingleton(window); export.export(session, fileName); } }
From source file:net.sf.jmoney.gnucashXML.actions.GnucashXMLImportAction.java
License:Open Source License
/** * The action has been activated. The argument of the * method represents the 'real' action sitting * in the workbench UI.//from ww w. j a v a 2 s .c om * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { Session session = JMoneyPlugin.getDefault().getSession(); // Original JMoney disabled the import menu items when no // session was open. I don't know how to do that in Eclipse, // so we display a message instead. if (session == null) { MessageDialog waitDialog = new MessageDialog(window.getShell(), "Disabled Action Selected", null, // accept the default window icon "You cannot import data into an accounting session unless you have a session open. You must first open a session or create a new session.", MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); waitDialog.open(); return; } FileDialog xmlFileChooser = new FileDialog(window.getShell()); xmlFileChooser.setText(GnucashXMLPlugin.getResourceString("MainFrame.import")); xmlFileChooser.setFilterExtensions(new String[] { "*.xml;*.xac" }); xmlFileChooser.setFilterNames(new String[] { "XML Gnucash Files (*.xml; *.xac)" }); // TODO: Faucheux - delete Directory xmlFileChooser.setFilterPath("D:\\Documents and Settings\\Administrateur\\Mes documents\\Mes comptes"); String fileName = xmlFileChooser.open(); if (fileName != null) { File qifFile = new File(fileName); GnucashXML gnucashXML = GnucashXML.getSingleton(window); gnucashXML.importFile(session, qifFile); } }
From source file:net.sf.jmoney.gnucashXML.wizards.GnucashImportWizard.java
License:Open Source License
public void init(IWorkbench workbench, IStructuredSelection selection) { this.window = workbench.getActiveWorkbenchWindow(); this.session = JMoneyPlugin.getDefault().getSession(); // Original JMoney disabled the import menu items when no // session was open. I don't know how to do that in Eclipse, // so we display a message instead. if (session == null) { MessageDialog waitDialog = new MessageDialog(window.getShell(), "Disabled Action Selected", null, // accept the default window icon "You cannot import data into an accounting session unless you have a session open. You must first open a session or create a new session.", MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); waitDialog.open();// w w w. ja v a2s . com return; } mainPage = new GnucashImportWizardPage(window); addPage(mainPage); }