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

The following examples show how to use org.openide.NotifyDescriptor#setMessageType() . 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: 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 2
Source File: BundleNodeCustomizer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void removeLocalesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeLocalesActionPerformed
    Object[] selectedValues = localesList.getSelectedValues();

    String basicName = propDataObject.getPrimaryFile().getName();
    basicName = Util.getBaseName(basicName);
    
    NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(NbBundle.getMessage(BundleNodeCustomizer.class, "CTL_Deletebundle_Prompt"));
    descriptor.setTitle(NbBundle.getMessage(BundleNodeCustomizer.class, "CTL_Deletebundle_Title"));
    descriptor.setMessageType(JOptionPane.WARNING_MESSAGE);
    descriptor.setOptionType(NotifyDescriptor.YES_NO_OPTION);

    Object res = DialogDisplayer.getDefault().notify(descriptor);
    if (res != NotifyDescriptor.YES_OPTION) {
        return;
    }

    for(int i=0; i<selectedValues.length; i++) {
        PropertiesFileEntry entry = propDataObject.getBundleStructure().getEntryByFileName(basicName + PropertiesDataLoader.PRB_SEPARATOR_CHAR + selectedValues[i].toString());
        try {
            entry.delete();
            if (!propDataObject.isValid()) {
                propDataObject = Util.findPrimaryDataObject(propDataObject);
                nameText.setText(propDataObject.getName());
            }
        } catch(IOException ioe) {
            org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ioe);
        }
    }
    
    localesList.setListData(retrieveLocales(propDataObject));
}
 
Example 3
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;
}