Java Code Examples for org.openide.NotifyDescriptor.Message#ERROR_MESSAGE

The following examples show how to use org.openide.NotifyDescriptor.Message#ERROR_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: PlatformShellAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "# {0} - error message",
    "ERR_RunPlatformShell=Error starting Java Shell: {0}"
})
@Override
public void actionPerformed(ActionEvent e) {
    JavaPlatform platform = options.getSelectedPlatform();
    if (platform == null) {
        NotifyDescriptor.Confirmation conf = new NotifyDescriptor.Confirmation(
                Bundle.ERR_NoShellPlatform(), NotifyDescriptor.Confirmation.OK_CANCEL_OPTION
        );
        Object result = DialogDisplayer.getDefault().notify(conf);
        if (result == NotifyDescriptor.Confirmation.OK_OPTION) {
            OptionsDisplayer.getDefault().open("Java/JShell", true);
        }
        platform = options.getSelectedPlatform();
        if (platform == null) {
            return;
        }
    }
    try {
        JShellEnvironment env = ShellRegistry.get().openDefaultSession(platform);
        env.open();
    } catch (IOException ex) {
        Message msg = new Message(Bundle.ERR_RunPlatformShell(ex.getLocalizedMessage()), Message.ERROR_MESSAGE);
        DialogDisplayer.getDefault().notifyLater(msg);
    }
}
 
Example 2
Source File: ProfilesPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private String duplicateProfile() {
    String newName = null;
    InputLine il = new InputLine(
            KeymapPanel.loc("CTL_Create_New_Profile_Message"), // NOI18N
            KeymapPanel.loc("CTL_Create_New_Profile_Title") // NOI18N
            );
    String profileToDuplicate =(String) profilesList.getSelectedValue();
    il.setInputText(profileToDuplicate);
    DialogDisplayer.getDefault().notify(il);
    if (il.getValue() == NotifyDescriptor.OK_OPTION) {
        newName = il.getInputText();
        for (String s : getKeymapPanel().getMutableModel().getProfiles()) {
            if (newName.equals(s)) {
                Message md = new Message(
                        KeymapPanel.loc("CTL_Duplicate_Profile_Name"), // NOI18N
                        Message.ERROR_MESSAGE);
                DialogDisplayer.getDefault().notify(md);
                return null;
            }
        }
        MutableShortcutsModel currentModel = getKeymapPanel().getMutableModel();
        String currrentProfile = currentModel.getCurrentProfile();
        getKeymapPanel().getMutableModel().setCurrentProfile(profileToDuplicate);
        getKeymapPanel().getMutableModel().cloneProfile(newName);
        currentModel.setCurrentProfile(currrentProfile);
        model.addItem(newName);
        profilesList.setSelectedValue(il.getInputText(), true);
    }
    return newName;
}
 
Example 3
Source File: FontAndColorsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void actionPerformed (ActionEvent e) {
    if (!listen) return;
    if (e.getSource () == bDuplicate) {
        InputLine il = new InputLine (
            loc ("CTL_Create_New_Profile_Message"),                // NOI18N
            loc ("CTL_Create_New_Profile_Title")                   // NOI18N
        );
        il.setInputText (currentProfile);
        DialogDisplayer.getDefault ().notify (il);
        if (il.getValue () == NotifyDescriptor.OK_OPTION) {
            String newScheme = il.getInputText ();                
            for (int i = 0; i < cbProfile.getItemCount(); i++)                 
                if (newScheme.equals (cbProfile.getItemAt(i))) {
                    Message md = new Message (
                        loc ("CTL_Duplicate_Profile_Name"),        // NOI18N
                        Message.ERROR_MESSAGE
                    );
                    DialogDisplayer.getDefault ().notify (md);
                    return;
                }
            setCurrentProfile (newScheme);
            listen = false;
            cbProfile.addItem (il.getInputText ());
            cbProfile.setSelectedItem (il.getInputText ());
            listen = true;
        }
        return;
    }
    if (e.getSource () == bDelete) {
        deleteCurrentProfile ();
    }
}