Java Code Examples for org.openide.NotifyDescriptor#setTitle()

The following examples show how to use org.openide.NotifyDescriptor#setTitle() . 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: PermanentMergePlugin.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
public void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException {
    int selectedNode = parameters.getParameters().get(PRIMARY_NODE_PARAMETER_ID).getIntegerValue();
    @SuppressWarnings("unchecked") //SELECTED_NODES_PARAMETER will generate list of integers which extends from object type
    final List<Integer> selections = (List<Integer>) parameters.getParameters().get(SELECTED_NODES_PARAMETER_ID).getObjectValue();
    @SuppressWarnings("unchecked") //ATTRIBUTES_PARAMETER will generate map of integers to strings which extends from object type
    final Map<Integer, String> attributes = (Map<Integer, String>) parameters.getParameters().get(ATTTRIBUTES_PARAMETER_ID).getObjectValue();
    final boolean createNode = parameters.getParameters().get(CREATE_NEW_NODE_PARAMETER_ID).getBooleanValue();
    final boolean createLoops = parameters.getParameters().get(CREATE_LOOPS_PARAMETER_ID).getBooleanValue();
    final boolean keepSimple = parameters.getParameters().get(KEEP_SIMPLE_PARAMETER_ID).getBooleanValue();

    if (selections.size() > 1 || (selections.size() == 1 && !createNode && selectedNode != Graph.NOT_FOUND)) {
        if (createNode || selectedNode == Graph.NOT_FOUND) {
            selectedNode = this.createVertex(graph, attributes);
        } else if (selections.contains(selectedNode)) {
            selections.remove((Integer) selectedNode);
        }

        this.processTransactions(graph, selections, selectedNode, createLoops, keepSimple);
    } else {
        final NotifyDescriptor nd = new NotifyDescriptor.Message(Bundle.ErrorInsufficientItems(), NotifyDescriptor.ERROR_MESSAGE);
        nd.setTitle(Bundle.PermanentMergePlugin());
        DialogDisplayer.getDefault().notify(nd);
    }
}
 
Example 2
Source File: DeleteLocalAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void performContextAction(final Node[] nodes) {
    NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(NbBundle.getMessage(DeleteLocalAction.class, "CTL_DeleteLocal_Prompt")); // NOI18N
    descriptor.setTitle(NbBundle.getMessage(DeleteLocalAction.class, "CTL_DeleteLocal_Title")); // NOI18N
    descriptor.setMessageType(JOptionPane.WARNING_MESSAGE);
    descriptor.setOptionType(NotifyDescriptor.YES_NO_OPTION);

    Object res = DialogDisplayer.getDefault().notify(descriptor);
    if (res != NotifyDescriptor.YES_OPTION) {
        return;
    }
    
    final Context ctx = getContext(nodes);
    ProgressSupport support = new ContextAction.ProgressSupport(this, nodes, ctx) {
        public void perform() {
            performDelete(ctx, this);
        }
    };
    support.start(createRequestProcessor(ctx));
}
 
Example 3
Source File: CreateDatabasePanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if a database already exists, and raise a message to
 * the user if it does.
 * 
 * @return true if it's OK to continue or false to cancel
 */
private static boolean checkExistingDatabase(
        DatabaseServer server, String dbname) throws DatabaseException {
    if ( ! server.databaseExists(dbname)) {
        return true;
    }
         
   NotifyDescriptor ndesc = new NotifyDescriptor.Message(
            NbBundle.getMessage(CreateDatabasePanel.class, 
                    "CreateNewDatabasePanel.MSG_DatabaseAlreadyExists",
                dbname));
   ndesc.setTitle(NbBundle.getMessage(CreateDatabasePanel.class,
                "CreateNewDatabasePanel.STR_DatabaseExistsTitle"));

   DialogDisplayer.getDefault().notify(ndesc);

   return false;
}
 
Example 4
Source File: WildflyInstantiatingIterator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static void showInformation(final String msg,  final String title) {
    Runnable info = new Runnable() {
        @Override
        public void run() {
            NotifyDescriptor d = new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE);
            d.setTitle(title);
            DialogDisplayer.getDefault().notify(d);
        }
    };

    if (SwingUtilities.isEventDispatchThread()) {
        info.run();
    } else {
        SwingUtilities.invokeLater(info);
    }
}
 
Example 5
Source File: ProfilerDialogsProviderImpl.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Boolean displayConfirmation(String message, String caption, boolean cancellable) {
    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(message,
            cancellable ? NotifyDescriptor.YES_NO_CANCEL_OPTION : NotifyDescriptor.YES_NO_OPTION);
    if (caption != null) nd.setTitle(caption);
    Object ret = DialogDisplayer.getDefault().notify(nd);
    if (ret == NotifyDescriptor.YES_OPTION) return Boolean.TRUE;
    if (ret == NotifyDescriptor.NO_OPTION) return Boolean.FALSE;
    return null;
}
 
Example 6
Source File: IpListActions.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void performAction(Node[] activatedNodes) {
    for (Node activatedNode : activatedNodes) {
        DevicesNode.MobileDeviceHolder holder = activatedNode.getLookup().lookup(DevicesNode.MobileDeviceHolder.class);
        if (holder != null) {
            List<AdbTools.IpRecord> deviceIps = AdbTools.getDeviceIps(holder.getUsb(), true);
            JTable table = new JTable(new DeviceIpListTablemodel(deviceIps));
            JScrollPane pane = new JScrollPane(table);
            NotifyDescriptor nd = new NotifyDescriptor.Message(pane, NotifyDescriptor.INFORMATION_MESSAGE);
            nd.setTitle(holder.getSerialNumber() + " IP list");
            DialogDisplayer.getDefault().notifyLater(nd);
        }
    }
}
 
Example 7
Source File: CommitAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static boolean commitAfterMerge (boolean locallyModifiedExcluded, File repository) {
    // XXX consider usage of repository to determine if there are any non-included files which have to be committed, too
    // and thus removing the option HgModuleConfig.getDefault().getConfirmCommitAfterMerge()
    if (locallyModifiedExcluded || HgModuleConfig.getDefault().getConfirmCommitAfterMerge()) { // ask before commit?
        NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_AFTER_MERGE_QUERY")); // NOI18N
        descriptor.setTitle(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_AFTER_MERGE_TITLE")); // NOI18N
        descriptor.setMessageType(JOptionPane.WARNING_MESSAGE);
        descriptor.setOptionType(NotifyDescriptor.YES_NO_OPTION);

        Object res = DialogDisplayer.getDefault().notify(descriptor);
        return res == NotifyDescriptor.YES_OPTION;
    }
    return true;
}
 
Example 8
Source File: JBInstantiatingIterator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void showInformation(final String msg,  final String title) {
    Runnable info = new Runnable() {
        public void run() {
            NotifyDescriptor d = new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE);
            d.setTitle(title);
            DialogDisplayer.getDefault().notify(d); 
        }
    };
    
    if (SwingUtilities.isEventDispatchThread()) {
        info.run();
    } else {
        SwingUtilities.invokeLater(info);
    }
}
 
Example 9
Source File: AppClientProjectProperties.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static boolean showModifiedMessage (String title) {
    String message = NbBundle.getMessage(AppClientProjectProperties.class,"TXT_Regenerate");
    JButton regenerateButton = new JButton (NbBundle.getMessage(AppClientProjectProperties.class,"CTL_RegenerateButton"));
    regenerateButton.setDefaultCapable(true);
    regenerateButton.getAccessibleContext().setAccessibleDescription (NbBundle.getMessage(AppClientProjectProperties.class,"AD_RegenerateButton"));
    NotifyDescriptor d = new NotifyDescriptor.Message (message, NotifyDescriptor.WARNING_MESSAGE);
    d.setTitle(title);
    d.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
    d.setOptions(new Object[] {regenerateButton, NotifyDescriptor.CANCEL_OPTION});        
    return DialogDisplayer.getDefault().notify(d) == regenerateButton;
}
 
Example 10
Source File: WebFreeFormActionProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Display an alert asking the user whether to really generate a target.
 * @param commandDisplayName the display name of the action to be bound
 * @param scriptPath the path that to the script that will be generated or written to
 * @return true if IDE should proceed
 */
private boolean alert(String commandDisplayName, String scriptPath) {
    String projectDisplayName = ProjectUtils.getInformation(project).getDisplayName();
    String title = NbBundle.getMessage(WebFreeFormActionProvider.class, "TITLE_generate_target_dialog", commandDisplayName, projectDisplayName);
    String body = NbBundle.getMessage(WebFreeFormActionProvider.class, "TEXT_generate_target_dialog", commandDisplayName, scriptPath);
    NotifyDescriptor d = new NotifyDescriptor.Message(body, NotifyDescriptor.QUESTION_MESSAGE);
    d.setTitle(title);
    d.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
    JButton generate = new JButton(NbBundle.getMessage(WebFreeFormActionProvider.class, "LBL_generate"));
    generate.setDefaultCapable(true);
    d.setOptions(new Object[] {generate, NotifyDescriptor.CANCEL_OPTION});
    return DialogDisplayer.getDefault().notify(d) == generate;
}
 
Example 11
Source File: ProfilerDialogsProviderImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void displayMessage(String message, String caption, String details, int type) {
    Object msg = message;
    Object det = details;
    if (isHtmlString(message)) msg = new NBHTMLLabel(message);
    if (isHtmlString(details)) det = new NBHTMLLabel(message);
    NotifyDescriptor nd = det == null ? new NotifyDescriptor.Message(msg, type) :
                    new ProfilerDialogs.MessageWithDetails(msg, det, type, false);
    if (caption != null) nd.setTitle(caption);
    ProfilerDialogs.notify(nd);
}
 
Example 12
Source File: ProfilerDialogsProviderImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean displayConfirmation(String message, String caption, boolean cancellable) {
    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(message,
            cancellable ? NotifyDescriptor.YES_NO_CANCEL_OPTION : NotifyDescriptor.YES_NO_OPTION);
    if (caption != null) nd.setTitle(caption);
    Object ret = DialogDisplayer.getDefault().notify(nd);
    if (ret == NotifyDescriptor.YES_OPTION) return Boolean.TRUE;
    if (ret == NotifyDescriptor.NO_OPTION) return Boolean.FALSE;
    return null;
}
 
Example 13
Source File: ModuleActions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Messages({
    "ERR_harness_too_old=You are attempting to build a module or suite project which uses a new metadata format with an old version of the module build harness which does not understand this format. You may either choose a newer NetBeans platform, or switch the harness used by the selected platform to use a newer harness (try using the harness supplied with the IDE).",
    "TITLE_harness_too_old=Harness Too Old"
})
static void promptForNewerHarness() {
    // #82388: warn the user that the harness version is too low.
    NotifyDescriptor d = new NotifyDescriptor.Message(ERR_harness_too_old(), NotifyDescriptor.ERROR_MESSAGE);
    d.setTitle(TITLE_harness_too_old());
    DialogDisplayer.getDefault().notify(d);
}
 
Example 14
Source File: FeedbackSurvey.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static boolean showDialog(URL whereTo) {
    String msg = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Message");
    String tit = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Title");
    String yes = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Yes");
    String later = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Later");
    String never = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Never");
    
    NotifyDescriptor nd = new NotifyDescriptor.Message(msg, NotifyDescriptor.QUESTION_MESSAGE);
    nd.setTitle(tit);
    //Object[] buttons = { yes, later, never };
    JButton yesButton = new JButton();
    yesButton.getAccessibleContext().setAccessibleDescription( 
            NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Yes"));
    Mnemonics.setLocalizedText(yesButton, yes);
    JButton laterButton = new JButton();
    laterButton.getAccessibleContext().setAccessibleDescription( 
            NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Later"));
    Mnemonics.setLocalizedText(laterButton, later);
    JButton neverButton = new JButton();
    neverButton.getAccessibleContext().setAccessibleDescription( 
            NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Never"));
    Mnemonics.setLocalizedText(neverButton, never);
    Object[] buttons = { yesButton, laterButton, neverButton };
    nd.setOptions(buttons);
    Object res = DialogDisplayer.getDefault().notify(nd);
    
    if (res == yesButton) {
        HtmlBrowser.URLDisplayer.getDefault().showURL(whereTo);
        return true;
    } else {
        if( res == neverButton ) {
            Preferences prefs = NbPreferences.forModule(FeedbackSurvey.class);
            prefs.putInt("feedback.survey.show.count", (int)bundledInt("MSG_FeedbackSurvey_AskTimes")); // NOI18N
        }
        return false;
    }
}
 
Example 15
Source File: ChromeManagerAccessor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public ExtensionManager.ExtensitionStatus isInstalled() {
    // Allows to skip the detection of Chrome extension
    String status = System.getProperty("netbeans.chrome.connector.status"); // NOI18N
    if (status != null) {
        try {
            return ExtensionManager.ExtensitionStatus.valueOf(status);
        } catch (IllegalArgumentException iaex) {
            LOGGER.log(Level.INFO, iaex.getMessage(), iaex);
        }
    }
    while (true) {
        ExtensionManager.ExtensitionStatus result = isInstalledImpl();
        if (result == ExtensionManager.ExtensitionStatus.DISABLED) {
            NotifyDescriptor descriptor = new NotifyDescriptor.Message(
                    NbBundle.getMessage(ChromeExtensionManager.class,
                            "LBL_ChromePluginIsDisabled"),                   // NOI18N
                                NotifyDescriptor.ERROR_MESSAGE);
            descriptor.setTitle(NbBundle.getMessage(ChromeExtensionManager.class,
                    "TTL_ChromePluginIsDisabled"));                             // NOI18N
            if (DialogDisplayer.getDefault().notify(descriptor) != DialogDescriptor.OK_OPTION) {
                return result;
            }
            continue;
        }
        return result;
    }
}
 
Example 16
Source File: ProfilerDialogsProviderImpl.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void displayMessage(String message, String caption, String details, int type) {
    Object msg = message;
    Object det = details;
    if (isHtmlString(message)) msg = new NBHTMLLabel(message);
    if (isHtmlString(details)) det = new NBHTMLLabel(message);
    NotifyDescriptor nd = det == null ? new NotifyDescriptor.Message(msg, type) :
                    new ProfilerDialogs.MessageWithDetails(msg, det, type, false);
    if (caption != null) nd.setTitle(caption);
    ProfilerDialogs.notify(nd);
}
 
Example 17
Source File: IconChooser.java    From constellation with Apache License 2.0 5 votes vote down vote up
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
    // Save an icon from the icon list.
    final String iconName = getSelectedIconName();
    if (iconName != null) {
        final FileChooserBuilder fChooser = new FileChooserBuilder(IconChooser.class)
                .setTitle("Save icon");
//        final File file = fChooser.showSaveDialog();

        // We need to get a JFileChooser because FileChooserBuilder doesn't have setSelectedFile().
        final JFileChooser chooser = fChooser.createFileChooser();

        chooser.setSelectedFile(new File(iconName + ".png"));
        final int result = chooser.showSaveDialog(this);
        final File file = result == JFileChooser.APPROVE_OPTION ? chooser.getSelectedFile() : null;

        if (file != null) {
            try {
                final IconListModel listModel = (IconListModel) iconsList.getModel();
                final int index = iconsList.getSelectedIndex();
                final IconListElement element = listModel.getElementAt(index);

                try (final FileOutputStream fos = new FileOutputStream(file)) {
                    fos.write(element.iconValue.buildByteArray());
                    fos.flush();
                }
            } catch (IOException ex) {
                final NotifyDescriptor nd = new NotifyDescriptor.Message(String.format("Error writing icon file %s:%n%s", file.toString(), ex.getMessage()), NotifyDescriptor.ERROR_MESSAGE);
                nd.setTitle("Icon file error");
                DialogDisplayer.getDefault().notify(nd);
            }
        }
    }
}
 
Example 18
Source File: FilesModifiedConfirmation.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected void showSaveError(String errMsg) {
    NotifyDescriptor errDialog
            = new NotifyDescriptor.Message(errMsg, ERROR_MESSAGE);
    errDialog.setTitle(getMessage("MSG_Title_SavingError"));        //NOI18N
    DialogDisplayer.getDefault().notify(errDialog);
}
 
Example 19
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 20
Source File: JAXBRefreshAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected void performAction(Node[] nodes) {
    Node node = nodes[ 0 ];
    FileObject fo = node.getLookup().lookup( FileObject.class );
    Project proj = node.getLookup().lookup(Project.class);
    String origLoc = (String) node.getValue(
            JAXBWizModuleConstants.ORIG_LOCATION);
    Boolean origLocIsURL = (Boolean) node.getValue(
            JAXBWizModuleConstants.ORIG_LOCATION_TYPE);
    FileObject locSchemaRoot = (FileObject) node.getValue(
            JAXBWizModuleConstants.LOC_SCHEMA_ROOT);
    
    if ( ( fo != null ) && ( origLoc != null ) ) {
        // XXX TODO run in separate non-awt thread.
         try {
             if (fo.canWrite()){
                 if (origLocIsURL){
                    URL url = new URL(origLoc);
                     ProjectHelper.retrieveResource(locSchemaRoot, 
                             url.toURI());                        
                 } else {
                     File projDir = FileUtil.toFile(
                             proj.getProjectDirectory());
                     //File srcFile = new File(origLoc);
                     File srcFile = FileSysUtil.Relative2AbsolutePath(
                             projDir, origLoc);
                     ProjectHelper.retrieveResource(fo.getParent(), 
                             srcFile.toURI());
                 }
             } else {
                 String msg = NbBundle.getMessage(this.getClass(),
                         "MSG_CanNotRefreshFile"); //NOI18N
                 NotifyDescriptor d = new NotifyDescriptor.Message(
                         msg, NotifyDescriptor.INFORMATION_MESSAGE);
                 d.setTitle(NbBundle.getMessage(this.getClass(), 
                         "LBL_RefreshFile")); //NOI18N
                 DialogDisplayer.getDefault().notify(d);
             }
         } catch (Exception ex){
             log(ex);
         } 
    }
}