List of usage examples for org.eclipse.jface.dialogs IMessageProvider WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs IMessageProvider WARNING.
Click Source Link
From source file:net.sf.fjep.fatjar.wizards.export.AutoJarPage.java
License:Open Source License
private void updateStatus(String errorMessage, String warnMessage) { if (warnMessage == null) setMessage(null);//from w w w.j av a 2s . c om else setMessage(warnMessage, IMessageProvider.WARNING); setErrorMessage(errorMessage); setPageComplete(errorMessage == null); }
From source file:net.tourbook.export.DialogExportTour.java
License:Open Source License
private boolean validateFilePath() { // check path IPath filePath = new Path(getExportPathName()); if (new File(filePath.toOSString()).exists() == false) { // invalid path setError(NLS.bind(Messages.dialog_export_msg_pathIsNotAvailable, filePath.toOSString())); return false; }// w w w . j ava 2s. com boolean returnValue = false; if (_isExport_MultipleToursWithMultipleFiles) { // only the path is checked, the file name is created automatically for each exported tour setMessage(_dlgDefaultMessage); // build file path with extension filePath = filePath.addTrailingSeparator().append(Messages.dialog_export_label_DefaultFileName) .addFileExtension(_exportExtensionPoint.getFileExtension()); returnValue = true; } else { String fileName = getExportFileName(); // remove extentions final int extPos = fileName.indexOf('.'); if (extPos != -1) { fileName = fileName.substring(0, extPos); } // build file path with extension filePath = filePath.addTrailingSeparator().append(fileName) .addFileExtension(_exportExtensionPoint.getFileExtension()); final File newFile = new File(filePath.toOSString()); if ((fileName.length() == 0) || newFile.isDirectory()) { // invalid filename setError(Messages.dialog_export_msg_fileNameIsInvalid); } else if (newFile.exists()) { // file already exists setMessage(NLS.bind(Messages.dialog_export_msg_fileAlreadyExists, filePath.toOSString()), IMessageProvider.WARNING); returnValue = true; } else { setMessage(_dlgDefaultMessage); try { final boolean isFileCreated = newFile.createNewFile(); // name is correct if (isFileCreated) { // delete file because the file is created for checking validity newFile.delete(); } returnValue = true; } catch (final IOException ioe) { setError(Messages.dialog_export_msg_fileNameIsInvalid); } } } _txtFilePath.setText(filePath.toOSString()); return returnValue; }
From source file:net.tourbook.export.gpx.DialogExportTour.java
License:Open Source License
private boolean validateFilePath() { // check path IPath filePath = new Path(getExportPathName()); if (new File(filePath.toOSString()).exists() == false) { // invalid path setError(NLS.bind(Messages.dialog_export_msg_pathIsNotAvailable, filePath.toOSString())); return false; }// w ww.j av a 2 s . c o m boolean returnValue = false; if (_isMultipleTourAndMultipleFile) { // only the path is checked, the file name is created automatically for each exported tour setMessage(_dlgDefaultMessage); // build file path with extension filePath = filePath.addTrailingSeparator().append(Messages.dialog_export_label_DefaultFileName) .addFileExtension(_exportExtensionPoint.getFileExtension()); returnValue = true; } else { String fileName = getExportFileName(); // remove extentions final int extPos = fileName.indexOf('.'); if (extPos != -1) { fileName = fileName.substring(0, extPos); } // build file path with extension filePath = filePath.addTrailingSeparator().append(fileName) .addFileExtension(_exportExtensionPoint.getFileExtension()); final File newFile = new File(filePath.toOSString()); if ((fileName.length() == 0) || newFile.isDirectory()) { // invalid filename setError(Messages.dialog_export_msg_fileNameIsInvalid); } else if (newFile.exists()) { // file already exists setMessage(NLS.bind(Messages.dialog_export_msg_fileAlreadyExists, filePath.toOSString()), IMessageProvider.WARNING); returnValue = true; } else { setMessage(_dlgDefaultMessage); try { final boolean isFileCreated = newFile.createNewFile(); // name is correct if (isFileCreated) { // delete file because the file is created for checking validity newFile.delete(); } returnValue = true; } catch (final IOException ioe) { setError(Messages.dialog_export_msg_fileNameIsInvalid); } } } _txtFilePath.setText(filePath.toOSString()); return returnValue; }
From source file:net.tourbook.printing.DialogPrintTour.java
License:Open Source License
private boolean validateFilePath() { // check path IPath filePath = new Path(getPrintPathName()); if (new File(filePath.toOSString()).exists() == false) { // invalid path setError(NLS.bind(Messages.Dialog_Print_Msg_PathIsNotAvailable, filePath.toOSString())); return false; }// w w w .jav a 2 s .com boolean returnValue = false; String fileName = getPrintFileName(); // remove extentions final int extPos = fileName.indexOf('.'); if (extPos != -1) { fileName = fileName.substring(0, extPos); } // build file path with extension filePath = filePath.addTrailingSeparator().append(fileName).addFileExtension(PDF_FILE_EXTENSION); final File newFile = new File(filePath.toOSString()); if ((fileName.length() == 0) || newFile.isDirectory()) { // invalid filename setError(Messages.Dialog_Print_Msg_FileNameIsInvalid); } else if (newFile.exists()) { // file already exists setMessage(NLS.bind(Messages.Dialog_Print_Msg_FileAlreadyExists, filePath.toOSString()), IMessageProvider.WARNING); returnValue = true; } else { setMessage(_dlgDefaultMessage); try { final boolean isFileCreated = newFile.createNewFile(); // name is correct if (isFileCreated) { // delete file because the file is created for checking validity newFile.delete(); } returnValue = true; } catch (final IOException ioe) { setError(Messages.Dialog_Print_Msg_FileNameIsInvalid); } } _txtFilePath.setText(filePath.toOSString()); return returnValue; }
From source file:net.tourbook.ui.MessageRegion.java
License:Open Source License
/** * Show the new message in the message text and update the image. Base the background color on * whether or not there are errors.// w w w. j ava2s .c o m * * @param newMessage * The new value for the message * @param newType * One of the IMessageProvider constants. If newType is IMessageProvider.NONE show * the title. * @see IMessageProvider */ public void updateText(final String newMessage, final int newType) { Image newImage = null; boolean showingError = false; switch (newType) { case IMessageProvider.NONE: hideRegion(); return; case IMessageProvider.INFORMATION: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; case IMessageProvider.WARNING: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IMessageProvider.ERROR: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); showingError = true; break; } if (newMessage == null) {//No message so clear the area hideRegion(); return; } showRegion(); // Any more updates required if (newMessage.equals(messageText.getText()) && newImage == messageImageLabel.getImage()) { return; } messageImageLabel.setImage(newImage); messageText.setText(newMessage); if (showingError) { setMessageColors(JFaceColors.getErrorBackground(messageComposite.getDisplay())); } else { lastMessageText = newMessage; setMessageColors(JFaceColors.getBannerBackground(messageComposite.getDisplay())); } }
From source file:no.javatime.inplace.ui.dialogs.DependencyDialog.java
License:Open Source License
/** * Initialize and manage the start radio group */// w w w. ja va2 s . co m private void start() { grpStart = new Group(container, SWT.NONE); grpStart.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { setMessage(msg.formatString("dep_operation_group_startstop", startOp), IMessageProvider.INFORMATION); } @Override public void mouseDown(MouseEvent e) { setMessage(msg.formatString("dep_operation_group_startstop", startOp), IMessageProvider.INFORMATION); } }); grpStart.setToolTipText(msg.formatString("dep_operation_group_startstop", startOp)); GridData gd_grpStart = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_grpStart.heightHint = grpHeightHint; gd_grpStart.widthHint = grWidthHint; grpStart.setLayoutData(gd_grpStart); grpStart.setText(msg.formatString("dep_bundles_name", msg.formatString("dep_operation_start"))); btnStartSingleBundles = new Button(grpStart, SWT.RADIO); btnStartSingleBundles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (btnStartSingleBundles.getSelection()) { setMessage(msg.formatString("dep_operation_single", startOp), IMessageProvider.INFORMATION); } if (!btnStartSingleBundles.getSelection()) { setMessage("Excluding providing bundles on start may result in stale references", IMessageProvider.WARNING); } } }); btnStartSingleBundles.setToolTipText(msg.formatString("dep_operation_single", startOp)); btnStartSingleBundles.setBounds(30, 20, 53, 16); btnStartSingleBundles.setText("Single"); if (!requiringOnStart && !providingOnStart && !partialOnStart) { btnStartSingleBundles.setSelection(true); } btnStartRequiringBundles = new Button(grpStart, SWT.RADIO); btnStartRequiringBundles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!btnStartRequiringProvidingBundles.getSelection()) { Category.setState(Category.requiringOnStart, btnStartRequiringBundles.getSelection()); } if (btnStartRequiringBundles.getSelection()) { setMessage(msg.formatString("dep_operation_requiring", startOp), IMessageProvider.INFORMATION); } } }); btnStartRequiringBundles.setToolTipText(msg.formatString("dep_operation_requiring", startOp)); btnStartRequiringBundles.setBounds(194, 20, 72, 16); btnStartRequiringBundles.setText("Requiring"); if (!providingOnStart) { btnStartRequiringBundles.setSelection(Category.getState(Category.requiringOnStart)); } else { btnStartRequiringBundles.setSelection(false); } btnStartProvidingBundles = new Button(grpStart, SWT.RADIO); btnStartProvidingBundles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!btnStartRequiringProvidingBundles.getSelection()) { Category.setState(Category.providingOnStart, btnStartProvidingBundles.getSelection()); } if (btnStartProvidingBundles.getSelection()) { setMessage(msg.formatString("dep_operation_providing", startOp), IMessageProvider.INFORMATION); } } }); btnStartProvidingBundles.setToolTipText(msg.formatString("dep_operation_providing", startOp)); btnStartProvidingBundles.setBounds(101, 20, 72, 16); btnStartProvidingBundles.setText("Providing"); if (!requiringOnStart) { btnStartProvidingBundles.setSelection(Category.getState(Category.providingOnStart)); } else { btnStartProvidingBundles.setSelection(false); } btnStartRequiringProvidingBundles = new Button(grpStart, SWT.RADIO); btnStartRequiringProvidingBundles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Category.setState(Category.requiringOnStart, btnStartRequiringProvidingBundles.getSelection()); Category.setState(Category.providingOnStart, btnStartRequiringProvidingBundles.getSelection()); if (btnStartRequiringProvidingBundles.getSelection()) { setMessage(msg.formatString("dep_operation_requiring_providing", startOp), IMessageProvider.INFORMATION); } } }); btnStartRequiringProvidingBundles .setToolTipText(msg.formatString("dep_operation_requiring_providing", startOp)); btnStartRequiringProvidingBundles.setBounds(290, 20, 144, 16); btnStartRequiringProvidingBundles.setText("Requiring and Providing"); if (Category.getState(Category.requiringOnStart) && Category.getState(Category.providingOnStart)) { btnStartRequiringProvidingBundles.setSelection(true); } btnStartPartialGraph = new Button(grpStart, SWT.RADIO); btnStartPartialGraph.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Category.setState(Category.partialGraphOnStart, btnStartPartialGraph.getSelection()); if (btnStartPartialGraph.getSelection()) { setMessage(msg.formatString("dep_operation_partial", startOp), IMessageProvider.INFORMATION); } } }); btnStartPartialGraph.setToolTipText(msg.formatString("dep_operation_partial", startOp)); btnStartPartialGraph.setBounds(463, 20, 89, 16); btnStartPartialGraph.setText("Partial Graph"); btnStartPartialGraph.setSelection(Category.getState(Category.partialGraphOnStart)); }
From source file:nz.ac.massey.cs.jquest.views.VisualizationForm.java
License:Open Source License
protected void configureFormText(final Form form, FormText text) { text.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { String is = (String) e.getHref(); try { ((FormText) e.widget).getShell().dispose(); int index = Integer.parseInt(is); IMessage[] messages = form.getChildrenMessages(); IMessage message = messages[index]; // ErrorReporting error = (ErrorReporting) message.getData(); // if (error != null) { // error.handleError(); // } } catch (NumberFormatException ex) { }/* www . j a v a 2 s . c o m*/ } }); text.setImage("error", getImage(IMessageProvider.ERROR)); text.setImage("warning", getImage(IMessageProvider.WARNING)); text.setImage("info", getImage(IMessageProvider.INFORMATION)); }
From source file:nz.ac.massey.cs.jquest.views.VisualizationForm.java
License:Open Source License
String createFormTextContent(IMessage[] messages) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println("<form>"); for (int i = 0; i < messages.length; i++) { IMessage message = messages[i];/*from w w w .ja va 2 s . c o m*/ pw.print("<li vspace=\"false\" style=\"image\" indent=\"16\" value=\""); switch (message.getMessageType()) { case IMessageProvider.ERROR: pw.print("error"); break; case IMessageProvider.WARNING: pw.print("warning"); break; case IMessageProvider.INFORMATION: pw.print("info"); break; } pw.print("\"> <a href=\""); pw.print(i + ""); pw.print("\">"); if (message.getPrefix() != null) { pw.print(message.getPrefix()); } pw.print(message.getMessage()); pw.println("</a></li>"); } pw.println("</form>"); pw.flush(); return sw.toString(); }
From source file:nz.ac.massey.cs.jquest.views.VisualizationForm.java
License:Open Source License
protected Image getImage(int type) { switch (type) { case IMessageProvider.ERROR: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); case IMessageProvider.WARNING: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK); case IMessageProvider.INFORMATION: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK); }/*from www . ja v a2 s. com*/ return null; }
From source file:org.amanzi.splash.editors.SplashJFreeChartEditor.java
License:Open Source License
private IFile createNewFile(String message) throws CoreException { SaveAsDialog dialog = new SaveAsDialog(getEditorSite().getShell()); dialog.setTitle("Save Mini-Spreadsheet As"); if (getEditorInput() instanceof FileEditorInput) dialog.setOriginalFile(((FileEditorInput) getEditorInput()).getFile()); dialog.create();//from w w w . ja v a2 s. c o m if (message != null) dialog.setMessage(message, IMessageProvider.WARNING); else dialog.setMessage("Save file to another location."); dialog.open(); IPath path = dialog.getResult(); if (path == null) { return null; } else { String ext = path.getFileExtension(); if (ext == null || !ext.equalsIgnoreCase("jrss")) { throw new CoreException( new Status(IStatus.ERROR, SplashPlugin.getId(), 0, "File extension must be 'jrss'.", null)); } IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (!file.exists()) file.create(new ByteArrayInputStream(new byte[] {}), false, null); return file; } }