Java Code Examples for org.openide.NotifyDescriptor#WARNING_MESSAGE
The following examples show how to use
org.openide.NotifyDescriptor#WARNING_MESSAGE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientSideProject.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages({ "# {0} - project name", "ClientSideProject.error.broken=<html>Project <b>{0}</b> is broken, resolve project problems first." }) public boolean isBroken(boolean showCustomizer) { boolean broken = getSourcesFolder() == null && getSiteRootFolder() == null; if (broken && showCustomizer) { NotifyDescriptor descriptor = new NotifyDescriptor.Message( Bundle.ClientSideProject_error_broken(getName()), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(descriptor); ProjectProblems.showCustomizer(this); } return broken; }
Example 2
Source File: WebKitPageModel.java From netbeans with Apache License 2.0 | 6 votes |
/** * Checks if the current information that we have about the inspected * page is too large to continue with the page inspection safely. */ @NbBundle.Messages({ "WebKitPageModel.pageSizeWarningTitle=Page Too Large", "WebKitPageModel.pageSizeWarningMessage=" + "The page is too large to inspect it in NetBeans safely. " + "You may run out of memory if you continue with the inspection. " + "Do you want to close this page and stop its inspection?" }) private void showPageSizeWarning() { if (!pageSizeWarningShown) { pageSizeWarningShown = true; NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation( Bundle.WebKitPageModel_pageSizeWarningMessage(), Bundle.WebKitPageModel_pageSizeWarningTitle(), NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE ); DialogDisplayer.getDefault().notify(descriptor); if (descriptor.getValue() == NotifyDescriptor.YES_OPTION) { EnhancedBrowser browser = pageContext.lookup(EnhancedBrowser.class); if (browser != null) { browser.close(true); } } } }
Example 3
Source File: CreateAvdVisualPanel3.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
private void skinSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skinSelectActionPerformed // TODO add your handling code here: FileChooserBuilder builder = new FileChooserBuilder("ANDROID_SKIN"); builder.setDirectoriesOnly(true); builder.setTitle("Select skin directory..."); File skinFolder = builder.showOpenDialog(); if (skinFolder != null && skinFolder.exists()) { File layout = new File(skinFolder.getAbsolutePath() + File.separator + "layout"); if (layout.exists()) { skinCombo.setModel(new SkinsComboboxModel(new File(skinFolder.getParent()))); skinCombo.setSelectedItem(skinFolder); } else { NotifyDescriptor nd = new NotifyDescriptor.Message("The selected directory does not contain a skin!", NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notifyLater(nd); } } }
Example 4
Source File: XmlMultiViewEditorSupport.java From netbeans with Apache License 2.0 | 6 votes |
private boolean checkCharsetConversion(final String encoding) { boolean value = true; try { CharsetEncoder coder = Charset.forName(encoding).newEncoder(); if (!coder.canEncode(getDocument().getText(0, getDocument().getLength()))){ NotifyDescriptor nd = new NotifyDescriptor.Confirmation( NbBundle.getMessage(XmlMultiViewEditorSupport.class, "MSG_BadCharConversion", new Object [] { getDataObject().getPrimaryFile().getNameExt(), encoding}), NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE); nd.setValue(NotifyDescriptor.NO_OPTION); DialogDisplayer.getDefault().notify(nd); if(nd.getValue() != NotifyDescriptor.YES_OPTION) { value = false; } } } catch (BadLocationException e){ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } return value; }
Example 5
Source File: ImportController.java From constellation with Apache License 2.0 | 6 votes |
private void updateSampleData() { if (sampleFile == null) { currentColumns = new String[0]; currentData = new ArrayList<>(); } else { try { currentData = importFileParser.preview(new InputSource(sampleFile), currentParameters, PREVIEW_ROW_LIMIT); String[] columns = currentData.isEmpty() ? new String[0] : currentData.get(0); currentColumns = new String[columns.length + 1]; System.arraycopy(columns, 0, currentColumns, 1, columns.length); currentColumns[0] = "Row"; } catch (IOException ex) { final NotifyDescriptor nd = new NotifyDescriptor.Message(ex.getMessage(), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); } } if (configurationPane != null) { configurationPane.setSampleData(currentColumns, currentData); } }
Example 6
Source File: WindowsJdk7WarningPanel.java From netbeans with Apache License 2.0 | 5 votes |
/** * Possibly open warning dialog. */ public static void warn() { if (!showWindowsJdk7Warning()) { return; } WindowsJdk7WarningPanel panel = new WindowsJdk7WarningPanel(); NotifyDescriptor descriptor = new NotifyDescriptor.Message(panel, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(descriptor); if (panel.doNotShowAgainCheckBox.isSelected()) { hideWindowsJdk7Warning(); } }
Example 7
Source File: CopySupport.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({ "# {0} - project name", "CopySupport.warn.invalidSources=<html>Source Files of project \"{0}\" do not exist, file changes are not propagated to the server.<br><br>" + "Use \"Resolve Project Problems...\" action to repair the project." }) private void warnInvalidSourceRoot() { NotifyDescriptor descriptor = new NotifyDescriptor.Message( Bundle.CopySupport_warn_invalidSources(project.getName()), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notifyLater(descriptor); }
Example 8
Source File: ResourceConfigurator.java From netbeans with Apache License 2.0 | 5 votes |
/** * Create SunDataSource object's defined. Called from impl of * ConfigurationSupport API (ConfigurationSupportImpl). * SunDataSource is a combination of JDBC & JDBC Connection Pool * Resources. * @return Set containing SunDataSource * @param jndiName JNDI Name of JDBC Resource * @param url Url for database referred to by this JDBC Resource's Connection Pool * @param username UserName for database referred to by this JDBC Resource's Connection Pool * @param password Password for database referred to by this JDBC Resource's Connection Pool * @param driver Driver ClassName for database referred to by this JDBC Resource's Connection Pool * @param dir File providing location of the project's server resource directory */ @Override public Datasource createDataSource(String jndiName, String url, String username, String password, String driver, File dir, String baseName) throws DatasourceAlreadyExistsException { SunDatasource ds = null; try { if(isDataSourcePresent(jndiName, dir)){ throw new DatasourceAlreadyExistsException(new SunDatasource(jndiName, url, username, password, driver)); } if(url != null){ String vendorName = convertToValidName(url); if(vendorName == null) { vendorName = jndiName; }else{ if(vendorName.equals("derby_embedded")){ //NOI18N NotifyDescriptor d = new NotifyDescriptor.Message(bundle.getString("Err_UnSupportedDerby"), NotifyDescriptor.WARNING_MESSAGE); // NOI18N DialogDisplayer.getDefault().notify(d); return null; } } ensureFolderExists(dir); // Is connection pool already defined, if not create String poolName = createCheckForConnectionPool(vendorName, url, username, password, driver, dir, baseName); boolean jdbcExists = requiredResourceExists(jndiName, dir, JDBC_RESOURCE); if (jdbcExists) { ds = null; } else { createJDBCResource(jndiName, poolName, dir, baseName); ds = new SunDatasource(jndiName, url, username, password, driver); } } } catch(IOException ex) { ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, ex); } return ds; }
Example 9
Source File: SymfonyScript.java From netbeans with Apache License 2.0 | 5 votes |
/** * Get the project specific, <b>valid only</b> Symfony2 script. If not found, {@code null} is returned. * @param phpModule PHP module for which Symfony2 script is taken * @param warn <code>true</code> if user is warned when the Symfony2 script is not valid * @return Symfony2 console script or {@code null} if the script is not valid */ @Messages({ "# {0} - error message", "MSG_InvalidSymfony2Script=<html>Project''s Symfony console script is not valid.<br>({0})" }) @CheckForNull public static SymfonyScript forPhpModule(PhpModule phpModule, boolean warn) { String console = null; SymfonyVersion symfonyVersion = SymfonyVersion.forPhpModule(phpModule); if (symfonyVersion != null) { FileObject script = symfonyVersion.getConsole(); if (script != null) { console = FileUtil.toFile(script).getAbsolutePath(); } } String error = validate(console); if (error == null) { return new SymfonyScript(console); } if (warn) { NotifyDescriptor.Message message = new NotifyDescriptor.Message( Bundle.MSG_InvalidSymfony2Script(error), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(message); } return null; }
Example 10
Source File: CreateAvdVisualPanel3.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private void sdcardSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sdcardSelectActionPerformed // TODO add your handling code here: FileChooserBuilder builder = new FileChooserBuilder(CreateAvdVisualPanel3.class); builder.setFilesOnly(true); File sdcardImage = builder.showOpenDialog(); if (sdcardImage != null && sdcardImage.exists()) { try (FileImageInputStream fi = new FileImageInputStream(sdcardImage)) { byte[] boot = new byte[3]; fi.read(boot); if (boot[0] == ((byte) 0xeb) && boot[1] == ((byte) 0x5a) && boot[2] == ((byte) 0x90)) { sdcardPath.setText(sdcardImage.getAbsolutePath()); } else { NotifyDescriptor nd = new NotifyDescriptor.Confirmation("<html>" + "Signature of selected file does not match Android SD Card image.<br/>" + "Are you sure you want to use the selected file?", "SD Card image problem...", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE); Object notify = DialogDisplayer.getDefault().notify(nd); if (NotifyDescriptor.YES_OPTION.equals(notify)) { sdcardPath.setText(sdcardImage.getAbsolutePath()); } } } catch (IOException ex) { Exceptions.printStackTrace(ex); } } }
Example 11
Source File: AbstractJUnitTestCreatorProvider.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void createTests(Context context) { String problem; if ((problem = checkNodesValidity(context.getActivatedFOs())) != null) { // TODO report problem NotifyDescriptor msg = new NotifyDescriptor.Message( problem, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(msg); return; } final FileObject[] filesToTest = context.getActivatedFOs(); if (filesToTest == null) { return; //XXX: display some message } /* * Determine the plugin to be used: */ final JUnitPlugin plugin = JUnitTestUtil.getPluginForProject( FileOwnerQuery.getOwner(filesToTest[0]), useVersion() ); if (!JUnitTestUtil.createTestActionCalled( plugin, filesToTest)) { return; } /* * Store the configuration data: */ final boolean singleClass = context.isSingleClass(); final Map<CommonPlugin.CreateTestParam, Object> params = JUnitTestUtil.getSettingsMap(!singleClass); if (singleClass) { params.put(CommonPlugin.CreateTestParam.CLASS_NAME, context.getTestClassName()); } final FileObject targetFolder = context.getTargetFolder(); if(context.isIntegrationTests()) { params.put(CommonPlugin.CreateTestParam.INC_GENERATE_INTEGRATION_TEST, Boolean.TRUE); } else { params.put(CommonPlugin.CreateTestParam.INC_GENERATE_INTEGRATION_TEST, Boolean.FALSE); } RequestProcessor.getDefault().post(new Runnable() { @Override public void run() { /* * Now create the tests: */ final FileObject[] testFileObjects = JUnitTestUtil.createTests( plugin, filesToTest, targetFolder, params); /* * Open the created/updated test class if appropriate: */ if (testFileObjects.length == 1) { try { DataObject dobj = DataObject.find(testFileObjects[0]); final EditorCookie ec = dobj.getLookup().lookup(EditorCookie.class); if (ec != null) { EventQueue.invokeLater(new Runnable() { @Override public void run() { ec.open(); } }); } } catch (DataObjectNotFoundException ex) { ex.printStackTrace(); } } } }); }
Example 12
Source File: ClobFieldTableCellEditor.java From netbeans with Apache License 2.0 | 4 votes |
private void displayError(File f, Exception ex, boolean read) { DialogDisplayer dd = DialogDisplayer.getDefault(); String errorObjectMsg; String messageMsg; String titleMsg; if (ex instanceof SQLException) { errorObjectMsg = NbBundle.getMessage(ClobFieldTableCellEditor.class, "lobErrorObject.database"); } else { errorObjectMsg = NbBundle.getMessage(ClobFieldTableCellEditor.class, "lobErrorObject.file"); } if (!read) { titleMsg = NbBundle.getMessage(ClobFieldTableCellEditor.class, "clobSaveToFileError.title"); messageMsg = NbBundle.getMessage(ClobFieldTableCellEditor.class, "clobSaveToFileError.message", errorObjectMsg, f.getAbsolutePath(), ex.getLocalizedMessage()); } else { titleMsg = NbBundle.getMessage(ClobFieldTableCellEditor.class, "clobReadFromFileError.title"); messageMsg = NbBundle.getMessage(ClobFieldTableCellEditor.class, "clobReadFromFileError.message", errorObjectMsg, f.getAbsolutePath(), ex.getLocalizedMessage()); } NotifyDescriptor nd = new NotifyDescriptor( messageMsg, titleMsg, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.WARNING_MESSAGE, new Object[]{NotifyDescriptor.CANCEL_OPTION}, NotifyDescriptor.CANCEL_OPTION); dd.notifyLater(nd); }
Example 13
Source File: BlobFieldTableCellEditor.java From netbeans with Apache License 2.0 | 4 votes |
private void displayError(File f, Exception ex, boolean read) { DialogDisplayer dd = DialogDisplayer.getDefault(); String errorObjectMsg; String messageMsg; String titleMsg; if (ex instanceof SQLException) { errorObjectMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class, "lobErrorObject.database"); } else { errorObjectMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class, "lobErrorObject.file"); } if (!read) { titleMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class, "blobSaveToFileError.title"); messageMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class, "blobSaveToFileError.message", errorObjectMsg, f.getAbsolutePath(), ex.getLocalizedMessage()); } else { titleMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class, "blobReadFromFileError.title"); messageMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class, "blobReadFromFileError.message", errorObjectMsg, f.getAbsolutePath(), ex.getLocalizedMessage()); } NotifyDescriptor nd = new NotifyDescriptor( messageMsg, titleMsg, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.WARNING_MESSAGE, new Object[]{NotifyDescriptor.CANCEL_OPTION}, NotifyDescriptor.CANCEL_OPTION); dd.notifyLater(nd); }
Example 14
Source File: UI.java From netbeans with Apache License 2.0 | 4 votes |
public static boolean printWarning(String message) { NotifyDescriptor confirm = new NotifyDescriptor.Confirmation(message, NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(confirm); return confirm.getValue() == NotifyDescriptor.YES_OPTION; }
Example 15
Source File: TemplatesPanel.java From netbeans with Apache License 2.0 | 4 votes |
@NbBundle.Messages({"# {0} - The file name", "MSG_FileIsLocked=The file {0} is in use."}) private void notifyFileLocked(FileObject fo) { NotifyDescriptor warning = new NotifyDescriptor.Message(Bundle.MSG_FileIsLocked(fo.getNameExt()), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(warning); }
Example 16
Source File: TplEditorSupport.java From netbeans with Apache License 2.0 | 4 votes |
@NbBundle.Messages({ "warning=Warning", "# {0} document name", "# {1} encoding", "# {2} original encoding of the file when loaded", "MSG_unsupportedEncodingSave=<html>The encoding {1} specified in meta tag of the document {0} is invalid<br> or the document contains characters which cannot be saved using this encoding.<br> Do you want to save the file using <b>{2}</b> encoding?</html>" }) void updateEncoding() throws UserCancelException { //try to find encoding specification in the editor content String documentContent = getDocumentText(); String encoding = TplDataObject.findEncoding(documentContent); String feqEncoding = FileEncodingQuery.getEncoding(getDataObject().getPrimaryFile()).name(); String finalEncoding = null; if (encoding != null) { //found encoding specified in the file content by meta tag if (!isSupportedEncoding(encoding) || !canEncode(documentContent, encoding)) { //test if the file can be saved by the original encoding or if it needs to be saved using utf-8 finalEncoding = canEncode(documentContent, feqEncoding) ? feqEncoding : UTF_8_ENCODING; Integer showEncodingWarnings = getTplDO().getShowEncodingWarnings(); if (showEncodingWarnings == null) { String message = MSG_unsupportedEncodingSave(getDataObject().getPrimaryFile().getNameExt(), encoding, finalEncoding); SaveConfirmationPanel panel = new SaveConfirmationPanel(message); DialogDescriptor dd = new DialogDescriptor(panel, Bundle.warning(), true, DialogDescriptor.YES_NO_OPTION, DialogDescriptor.YES_OPTION, null); DialogDisplayer.getDefault().notify(dd); showEncodingWarnings = (Integer) dd.getValue(); if (panel.isDoNotShowAgainCheckBox() && showEncodingWarnings == NotifyDescriptor.YES_OPTION) { getTplDO().setShowEncodingWarnings(showEncodingWarnings); } } if (!showEncodingWarnings.equals(NotifyDescriptor.YES_OPTION)) { throw new UserCancelException(); } } else { finalEncoding = encoding; } } else { //no encoding specified in the file, use FEQ value if (!canEncode(documentContent, feqEncoding)) { NotifyDescriptor nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(TplEditorSupport.class, "MSG_badCharConversionSave", new Object[]{getDataObject().getPrimaryFile().getNameExt(), feqEncoding}), NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE); nd.setValue(NotifyDescriptor.NO_OPTION); DialogDisplayer.getDefault().notify(nd); if (nd.getValue() != NotifyDescriptor.YES_OPTION) { throw new UserCancelException(); } else { finalEncoding = UTF_8_ENCODING; } } else { finalEncoding = feqEncoding; } } //FEQ cannot be run in saveFromKitToStream since document is locked for writing, //so setting the FEQ result to document property Document document = getDocument(); if (document != null) { document.putProperty(DOCUMENT_SAVE_ENCODING, finalEncoding); } }
Example 17
Source File: ArrangeInBubbleTreeAction.java From constellation with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(final ActionEvent e) { final Graph graph = context.getGraph(); final ReadableGraph rg = graph.getReadableGraph(); try { NamedSelectionState nsState = null; final int namedSelectionId = rg.getAttribute(GraphElementType.VERTEX, "named_selection"); if (namedSelectionId != Graph.NOT_FOUND) { final int namedSelectionStateId = rg.getAttribute(GraphElementType.META, NamedSelectionState.ATTRIBUTE_NAME); if (namedSelectionStateId != Graph.NOT_FOUND) { nsState = rg.getObjectValue(namedSelectionStateId, 0); final SelectNamedSelectionPanel ssp = new SelectNamedSelectionPanel(nsState.getNamedSelections(), "Select a named selection to represent the tree roots."); final DialogDescriptor dd = new DialogDescriptor(ssp, Bundle.CTL_ArrangeInBubbleTreeAction()); dd.setHelpCtx(new HelpCtx("au.gov.asd.tac.constellation.plugins.arrangements.trees.BubbleTreeAction")); final Object result = DialogDisplayer.getDefault().notify(dd); if (result == DialogDescriptor.OK_OPTION) { final long selectionId = ssp.getNamedSelectionId(); if (selectionId != -1) { final long mask = 1L << selectionId; final Set<Integer> rootVxIds = new HashSet<>(); for (int position = 0; position < rg.getVertexCount(); position++) { final int vxId = rg.getVertex(position); final long selections = rg.getLongValue(namedSelectionId, vxId); if ((selections & mask) != 0) { rootVxIds.add(vxId); } } PluginExecutor.startWith(ArrangementPluginRegistry.BUBBLE_TREE) .set(ArrangeInBubbleTreePlugin.ROOTS_PARAMETER_ID, rootVxIds) .set(ArrangeInBubbleTreePlugin.IS_MINIMAL_PARAMETER_ID, true) .followedBy(InteractiveGraphPluginRegistry.RESET_VIEW) .executeWriteLater(context.getGraph(), Bundle.CTL_ArrangeInBubbleTreeAction()); } } } } if (nsState == null) { final NotifyDescriptor nd = new NotifyDescriptor.Message("There must be a named selection to specify the tree roots", NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); } } finally { rg.release(); } }
Example 18
Source File: Codecept.java From netbeans with Apache License 2.0 | 4 votes |
private static void userWarning(String warning) { NotifyDescriptor.Message message = new NotifyDescriptor.Message(warning, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(message); }
Example 19
Source File: SQLExecutionBaseAction.java From netbeans with Apache License 2.0 | 4 votes |
public static void notifyNoDatabaseConnection() { String message = NbBundle.getMessage(SQLExecutionBaseAction.class, "LBL_NoDatabaseConnection"); NotifyDescriptor desc = new NotifyDescriptor.Message(message, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(desc); }
Example 20
Source File: AlgorithmicError.java From constellation with Apache License 2.0 | 2 votes |
/** * Create an error dialog with a custom message. * * @param message the error message */ public static void createDialog(final String message) { final NotifyDescriptor nd = new NotifyDescriptor.Message(message, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(nd); }