Java Code Examples for org.openide.NotifyDescriptor#PLAIN_MESSAGE

The following examples show how to use org.openide.NotifyDescriptor#PLAIN_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: NbUtils.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
@Nullable
public static FileEditPanel.DataContainer editFilePath (@Nullable Component parentComponent, @Nonnull final String title, @Nullable final File projectFolder, @Nullable final FileEditPanel.DataContainer data) {
  final FileEditPanel filePathEditor = new FileEditPanel(projectFolder, data);

  filePathEditor.doLayout();
  filePathEditor.setPreferredSize(new Dimension(450, filePathEditor.getPreferredSize().height));

  final NotifyDescriptor desc = new NotifyDescriptor.Confirmation(filePathEditor, title, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE);
  FileEditPanel.DataContainer result = null;
  if (DialogDisplayer.getDefault().notify(desc) == NotifyDescriptor.OK_OPTION) {
    result = filePathEditor.getData();
    if (!result.isValid()) {
      NbUtils.msgError(parentComponent, String.format(java.util.ResourceBundle.getBundle("com/igormaznitsa/nbmindmap/i18n/Bundle").getString("MMDGraphEditor.editFileLinkForTopic.errorCantFindFile"), result.getFilePathWithLine()));
      result = null;
    }
  }
  return result;
}
 
Example 2
Source File: PayaraPassword.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Display Payara password panel to change Payara password.
 <p/>
 * Password is stored in server instance properties and returned
 * by this method. Properties are persisted.
 * <p/>
 * @param instance Payara server instance.
 * @return Password {@see String} when password was successfully changed
 *         or <code>null</code> otherwise.
 */
public static String setPassword(final PayaraInstance instance) {
    String title = NbBundle.getMessage(PayaraPassword.class, "PayaraPassword.title");
    String message = NbBundle.getMessage(PayaraPassword.class,
            "PayaraPassword.message", instance.getDisplayName());
    NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
            null, title, NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE, null, null);
    PayaraPassword panel
            = new PayaraPassword(notifyDescriptor, instance, message);
    Object button = DialogDisplayer.getDefault().notify(notifyDescriptor);
    if (button == CANCEL_OPTION) {
        return null;
    }
    String password = panel.getPassword();
    instance.setAdminPassword(password);
    try {
        PayaraInstance.writeInstanceToFile(instance);
    } catch (IOException ex) {
        LOGGER.log(Level.INFO,
                "Could not store Payara server attributes", ex);
    }
    return password;
}
 
Example 3
Source File: WarnPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Display Payara process kill warning message and handle <i>Show this
 * warning next time</i> check box.
 * <p/>
 * @param serverName Payara server display name.
 * @return Value of <code>true</code> when <code>YES</code> button
 *         was selected or Value of <code>false</code> when <code>NO/code>
 *         button was selected. Always returns true after <i>Show this
 *         warning next time</i> check box was turned on.
 */
public static boolean gfKillWarning(final String serverName) {
    boolean showAgain = PayaraSettings.getGfKillWarningShowAgain();
    if (showAgain) {
        String warning = NbBundle.getMessage(
                WarnPanel.class, "WarnPanel.GfKillWarning", serverName);
        String title = NbBundle.getMessage(
                WarnPanel.class, "WarnPanel.GfKillTitle");
        WarnPanel panel =  new WarnPanel(warning, showAgain);
        NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
            panel, title, NotifyDescriptor.YES_NO_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE, null, null);
        Object button
                = DialogDisplayer.getDefault().notify(notifyDescriptor);
        PayaraSettings.setGfKillWarningShowAgain(panel.showAgain());
        return button == YES_OPTION;
    } else {
        return true;
    }
}
 
Example 4
Source File: GlassFishCredentials.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Display GlassFish credentials panel to get GlassFish credentials.
 * <p/>
 * User name and password is stored in server instance properties.
 * Properties are persisted.
 * <p/>
 * @param instance GlassFish server instance.
 * @return Value of <code>true</code> when GlassFish credentials were
 *         updated of <code>false</code> when <code>Cancel</code> button
 *         was selected.
 */
public static boolean setCredentials(final GlassfishInstance instance,
        final String message) {
    String title = NbBundle.getMessage(
            GlassFishPassword.class, "GlassFishCredentials.title");
    NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
            null, title, NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE, null, null);
    GlassFishCredentials panel
            = new GlassFishCredentials(notifyDescriptor, instance, message);
    Object button = DialogDisplayer.getDefault().notify(notifyDescriptor);
    if (button == CANCEL_OPTION) {
        return false;
    }
    String userName = panel.getUserName();
    String password = panel.getPassword();
    instance.setAdminUser(userName);
    instance.setAdminPassword(password);
    try {
        GlassfishInstance.writeInstanceToFile(instance);
    } catch (IOException ex) {
        LOGGER.log(Level.INFO,
                "Could not store GlassFish server attributes", ex);
    }
    return true;
}
 
Example 5
Source File: GlassFishPassword.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Display GlassFish password panel to change GlassFish password.
 <p/>
 * Password is stored in server instance properties and returned
 * by this method. Properties are persisted.
 * <p/>
 * @param instance GlassFish server instance.
 * @return Password {@see String} when password was successfully changed
 *         or <code>null</code> otherwise.
 */
public static String setPassword(final GlassfishInstance instance) {
    String title = NbBundle.getMessage(
            GlassFishPassword.class, "GlassFishPassword.title");
    String message = NbBundle.getMessage(
            GlassFishPassword.class,
            "GlassFishPassword.message", instance.getDisplayName());
    NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
            null, title, NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE, null, null);
    GlassFishPassword panel
            = new GlassFishPassword(notifyDescriptor, instance, message);
    Object button = DialogDisplayer.getDefault().notify(notifyDescriptor);
    if (button == CANCEL_OPTION) {
        return null;
    }
    String password = panel.getPassword();
    instance.setAdminPassword(password);
    try {
        GlassfishInstance.writeInstanceToFile(instance);
    } catch (IOException ex) {
        LOGGER.log(Level.INFO,
                "Could not store GlassFish server attributes", ex);
    }
    return password;
}
 
Example 6
Source File: ToDoCustomizer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void btnAddMimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddMimeActionPerformed
    List<MimeIdentifier> allMimeItems = loadMimeTypes();
    allMimeItems.removeAll(mimeIdentifiers);
    IdentifierPickerPanel picker = new IdentifierPickerPanel(allMimeItems, extensionIdentifiers);
    final NotifyDescriptor extensionDialog = new NotifyDescriptor(
            picker,
            NbBundle.getMessage(ToDoCustomizer.class, "LBL_PickMime"), //NOI18N
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE,
            null,
            NotifyDescriptor.OK_OPTION);
    
    picker.addValidityListener(extensionDialog);
    if (DialogDisplayer.getDefault().notify(extensionDialog) == NotifyDescriptor.OK_OPTION) {
        addSelectedToModel(picker.getSelectedMimeTypes());
    }
}
 
Example 7
Source File: ParamEditor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void showDialog() {

	if(editable == Editable.NEITHER) {
	    NotifyDescriptor d = 
		new NotifyDescriptor(this, title, 
				     NotifyDescriptor.DEFAULT_OPTION,
				     NotifyDescriptor.PLAIN_MESSAGE, 
				     new Object[] { NotifyDescriptor.OK_OPTION },
				     NotifyDescriptor.OK_OPTION); 
	    DialogDisplayer.getDefault().notify(d);
	}
	else {
	    editDialog = new DialogDescriptor
		(this, title, true, DialogDescriptor.OK_CANCEL_OPTION,
		 DialogDescriptor.CANCEL_OPTION,
		 new ActionListener() {
		     public void actionPerformed(ActionEvent e) {
			 evaluateInput(); 
		     }
		 }); 

	    dialog = DialogDisplayer.getDefault().createDialog(editDialog);
	    dialog.setVisible(true);
	    this.repaint();
	}
    }
 
Example 8
Source File: WarnPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Display GlassFish process kill warning message and handle <i>Show this
 * warning next time</i> check box.
 * <p/>
 * @param serverName GlassFish server display name.
 * @return Value of <code>true</code> when <code>YES</code> button
 *         was selected or Value of <code>false</code> when <code>NO/code>
 *         button was selected. Always returns true after <i>Show this
 *         warning next time</i> check box was turned on.
 */
public static boolean gfKillWarning(final String serverName) {
    boolean showAgain = GlassFishSettings.getGfKillWarningShowAgain();
    if (showAgain) {
        String warning = NbBundle.getMessage(
                WarnPanel.class, "WarnPanel.GfKillWarning", serverName);
        String title = NbBundle.getMessage(
                WarnPanel.class, "WarnPanel.GfKillTitle");
        WarnPanel panel =  new WarnPanel(warning, showAgain);
        NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
            panel, title, NotifyDescriptor.YES_NO_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE, null, null);
        Object button
                = DialogDisplayer.getDefault().notify(notifyDescriptor);
        GlassFishSettings.setGfKillWarningShowAgain(panel.showAgain());
        return button == YES_OPTION;
    } else {
        return true;
    }
}
 
Example 9
Source File: TableRowDialog.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void showDialog() {
    if (editable == Editable.NEITHER) {
        NotifyDescriptor d =
                new NotifyDescriptor(this, title,
                NotifyDescriptor.DEFAULT_OPTION,
                NotifyDescriptor.PLAIN_MESSAGE,
                new Object[]{NotifyDescriptor.OK_OPTION},
                NotifyDescriptor.OK_OPTION);
        DialogDisplayer.getDefault().notify(d);
    } else {
        editDialog = new DialogDescriptor(this, title, true, DialogDescriptor.OK_CANCEL_OPTION,
                DialogDescriptor.CANCEL_OPTION,
                new ActionListener() {

                    public void actionPerformed(ActionEvent e) {
                        evaluateInput();
                    }
                });

        dialog = DialogDisplayer.getDefault().createDialog(editDialog);
        dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TableRowDialog.class, "ACSD_initparam_edit")); // NOI18N
        dialog.setVisible(true);
        this.repaint();
    }
}
 
Example 10
Source File: WarnPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Display GlassFish 3.1.2 WS bug warning message and handle <i>Show this
 * warning next time</i> check box.
 * <p/>
 * @param serverName  GlassFish server display name.
 * @param installRoot GlassFish server installation root.
 */
public static void gfUnknownVersionWarning(final String serverName,
        final String installRoot) {
    if (GlassFishSettings.showWindowSystem()) {
        String warning = NbBundle.getMessage(
                WarnPanel.class, "WarnPanel.gfUnknownVersionWarning",
                new String[]{serverName, installRoot});
        NotifyDescriptor notifyDescriptor = new NotifyDescriptor.Message(
                warning, NotifyDescriptor.PLAIN_MESSAGE);
        DialogDisplayer.getDefault().notify(notifyDescriptor);
    }
}
 
Example 11
Source File: DashboardTopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void addTask(TaskNode... taskNodes) {
    final CategoryPicker picker = new CategoryPicker(taskNodes);
    final NotifyDescriptor nd = new NotifyDescriptor(
            picker,
            NbBundle.getMessage(DashboardTopComponent.class, "LBL_AddTaskToCat"), //NOI18N
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE,
            null,
            NotifyDescriptor.OK_OPTION);

    picker.setCategoryListener(new CategoryPicker.CategoryComboListener() {
        @Override
        public void comboItemsChanged(boolean categoryAvailable) {
            nd.setValid(categoryAvailable);
        }
    });
    nd.setValid(false);
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        Category category = picker.getChosenCategory();
        dashboard.addTaskToCategory(category, taskNodes);
        
        if(!openedByUserAction && !isOpened()) {
            openedByUserAction = true;
            activate();
        }
    }
}
 
Example 12
Source File: DashboardUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void quickSearchTask(RepositoryImpl repositoryImpl) {
    JButton open = new JButton(NbBundle.getMessage(DashboardTopComponent.class, "OPTION_Open"));
    open.setEnabled(false);
    JButton cancel = new JButton(NbBundle.getMessage(DashboardTopComponent.class, "OPTION_Cancel"));

    QuickSearchPanel quickSearchPanel = new QuickSearchPanel(repositoryImpl);
    NotifyDescriptor quickSearchDialog = new NotifyDescriptor(
            quickSearchPanel,
            NbBundle.getMessage(DashboardTopComponent.class, "LBL_QuickTitle", repositoryImpl.getDisplayName()), //NOI18N
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE,
            new Object[]{open, cancel},
            open);
    quickSearchDialog.setValid(false);
    QuickSearchListener quickSearchListener = new QuickSearchListener(quickSearchPanel, open);
    quickSearchPanel.addQuickSearchListener(quickSearchListener);
    Object result = DialogDisplayer.getDefault().notify(quickSearchDialog);
    if (result == open) {
        IssueImpl issueImpl = quickSearchPanel.getSelectedTask();
        IssueAction.openIssue(issueImpl.getRepositoryImpl(), issueImpl.getID());
        Category selectedCategory = quickSearchPanel.getSelectedCategory();
        if (selectedCategory != null) {
            DashboardViewer.getInstance().addTaskToCategory(selectedCategory, new TaskNode(issueImpl, null));
        }
    }
    quickSearchPanel.removeQuickSearchListener(quickSearchListener);
}
 
Example 13
Source File: WebBrowserImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void reportInvalidUrl( String location, Throwable ex ) {
    if( null != ex ) {
        Logger.getLogger( WebBrowserImpl.class.getName() ).log( Level.INFO, null, ex );
    }
    NotifyDescriptor nd = new NotifyDescriptor.Message(
            NbBundle.getMessage( WebBrowserImpl.class, "Err_InvalidURL", location),
            NotifyDescriptor.PLAIN_MESSAGE );
    DialogDisplayer.getDefault().notifyLater( nd );
}
 
Example 14
Source File: SelectRootsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void addURL(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addURL
    final NotifyDescriptor.InputLine nd = new NotifyDescriptor.InputLine(
        NbBundle.getMessage(SelectRootsPanel.class,"TXT_RemoteJavadoc"),
        NbBundle.getMessage(SelectRootsPanel.class,"TXT_RemoteJavadoc_Title"),
        NotifyDescriptor.OK_CANCEL_OPTION,
        NotifyDescriptor.PLAIN_MESSAGE);
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        final String inputText = nd.getInputText();
        final DefaultListModel<URI> lm = (DefaultListModel<URI>) sources.getModel();
        final Set<URI> contained = new HashSet<>(Collections.list(lm.elements()));
        int index = sources.getSelectedIndex();
        index = index < 0 ? lm.getSize() : index + 1;
        try {
            URI uri = new URI(inputText);
            if (!contained.contains(uri)) {
                lm.add(index, uri);
                select(Collections.<Integer>singleton(index));
                index++;
            }
        } catch (URISyntaxException ex) {
            DialogDisplayer.getDefault().notify(
                new NotifyDescriptor.Message(
                    NbBundle.getMessage(SelectRootsPanel.class, "TXT_InvalidRoot", inputText),
                    NotifyDescriptor.ERROR_MESSAGE));
        }
    }
}
 
Example 15
Source File: WarnPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Display GlassFish 3.1.2 WS bug warning message and handle <i>Show this
 * warning next time</i> check box.
 * <p/>
 * @param serverName GlassFish server display name.
 */
public static void gf312WSWarning(final String serverName) {
    boolean showAgain = GlassFishSettings.getGf312WarningShowAgain();
    if (showAgain) {
        String warning = NbBundle.getMessage(
                WarnPanel.class, "WarnPanel.Gf312WSWarning", serverName);
        WarnPanel panel =  new WarnPanel(warning, showAgain);
        NotifyDescriptor notifyDescriptor = new NotifyDescriptor.Message(
                panel, NotifyDescriptor.PLAIN_MESSAGE);
        DialogDisplayer.getDefault().notify(notifyDescriptor);
        GlassFishSettings.setGf312WarningShowAgain(panel.showAgain());
    }
}
 
Example 16
Source File: WarnPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Display warning message and handle <i>Show this warning next time</i> check box.
 * <p/>
 * @param serverName  Payara server display name.
 * @param installRoot Payara server installation root.
 */
public static void pfUnknownVersionWarning(final String serverName,
        final String installRoot) {
    if (PayaraSettings.showWindowSystem()) {
        String warning = NbBundle.getMessage(
                WarnPanel.class, "WarnPanel.gfUnknownVersionWarning",
                new String[]{serverName, installRoot});
        NotifyDescriptor notifyDescriptor = new NotifyDescriptor.Message(
                warning, NotifyDescriptor.PLAIN_MESSAGE);
        DialogDisplayer.getDefault().notify(notifyDescriptor);
    }
}
 
Example 17
Source File: NbPresenter.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static String getMessageTypeDescription(int messageType) {
    switch(messageType) {
    case NotifyDescriptor.ERROR_MESSAGE:
        return NbBundle.getBundle(NbPresenter.class).getString("ACSD_ErrorMessage"); // NOI18N
    case NotifyDescriptor.WARNING_MESSAGE:
        return NbBundle.getBundle(NbPresenter.class).getString("ACSD_WarningMessage"); // NOI18N
    case NotifyDescriptor.QUESTION_MESSAGE:
        return NbBundle.getBundle(NbPresenter.class).getString("ACSD_QuestionMessage"); // NOI18N
    case NotifyDescriptor.INFORMATION_MESSAGE:
        return NbBundle.getBundle(NbPresenter.class).getString("ACSD_InformationMessage"); // NOI18N
    case NotifyDescriptor.PLAIN_MESSAGE:
        return NbBundle.getBundle(NbPresenter.class).getString("ACSD_PlainMessage"); // NOI18N
    }
    return ""; // NOI18N
}
 
Example 18
Source File: NbUtils.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
public static void plainMessageOk (@Nullable Component parentComponent,@Nonnull final String title, @Nonnull final JComponent compo) {
  final NotifyDescriptor desc = new NotifyDescriptor.Message(compo, NotifyDescriptor.PLAIN_MESSAGE);
  desc.setTitle(title);
  DialogDisplayer.getDefault().notify(desc);
}
 
Example 19
Source File: JavaSEPlatformPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Display GlassFish Java SE selector to allow switch Java SE used
 * to run GlassFish.
 * <p/>
 * Selected Java SE is stored in server instance properties and returned
 * by this method. Properties are persisted.
 * <p/>
 * @param instance GlassFish server instance to be started.
 * @param javaHome Java SE home currently selected.
 */
public static FileObject selectServerSEPlatform(            
       final  GlassfishInstance instance, final File javaHome) {
    FileObject selectedJavaHome = null;
    // Matching Java SE home installed platform if exists.
    JavaPlatform platform = JavaUtils.findInstalledPlatform(javaHome);
    String platformName = platform != null
            ? platform.getDisplayName() : javaHome.getAbsolutePath();
    String message = NbBundle.getMessage(
            JavaSEPlatformPanel.class,
            "JavaSEPlatformPanel.warning", platformName);
    String title = NbBundle.getMessage(
            JavaSEPlatformPanel.class,
            "JavaSEPlatformPanel.title", platformName);
    NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
            null, title, NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE, null, null);
    JavaSEPlatformPanel panel = new JavaSEPlatformPanel(
            notifyDescriptor, instance, message);
    Object button = DialogDisplayer.getDefault().notify(notifyDescriptor);
    if (button == CANCEL_OPTION) {
        return selectedJavaHome;
    }
    JavaPlatform selectedPlatform = panel.javaPlatform();
    if (selectedPlatform != null) {
        Iterator<FileObject> platformIterator
                = selectedPlatform.getInstallFolders().iterator();
        if (platformIterator.hasNext()) {
            selectedJavaHome = platformIterator.next();
        }
    }
    if (selectedJavaHome != null && panel.updateProperties()) {
        instance.setJavaHome(panel.isJavaPlatformDefault() ? null
                : FileUtil.toFile(selectedJavaHome).getAbsolutePath());
        try {
            GlassfishInstance.writeInstanceToFile(instance);
        } catch(IOException ex) {
            LOGGER.log(Level.INFO,
                    "Could not store GlassFish server attributes", ex);
        }
    }
    return selectedJavaHome;
}
 
Example 20
Source File: NbUtils.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
public static boolean plainMessageOkCancel (@Nullable Component parentComponent,@Nonnull final String title, @Nonnull final JComponent compo) {
  final NotifyDescriptor desc = new NotifyDescriptor.Confirmation(compo, title, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE);
  return DialogDisplayer.getDefault().notify(desc) == NotifyDescriptor.OK_OPTION;
}