Java Code Examples for org.openide.util.NbBundle#getBundle()

The following examples show how to use org.openide.util.NbBundle#getBundle() . 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: AddBreakpointAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Constructs managed dialog instance using TopManager.createDialog
* and returnrs it */
private Dialog createDialog () {
    ResourceBundle bundle = NbBundle.getBundle (AddBreakpointAction.class);

    panel = new AddBreakpointPanel ();
    // create dialog descriptor, create & return the dialog
    descriptor = new DialogDescriptor (
        panel,
        bundle.getString ("CTL_Breakpoint_Title"), // NOI18N
        true,
        this
    );
    descriptor.setOptions (new JButton[] {
        bOk = new JButton (bundle.getString ("CTL_Ok")), // NOI18N
        bCancel = new JButton (bundle.getString ("CTL_Cancel")) // NOI18N
    });
    bOk.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Ok")); // NOI18N
    bCancel.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Cancel")); // NOI18N
    descriptor.setClosingOptions (new Object [0]);
    notificationSupport = descriptor.createNotificationLineSupport();
    Dialog d = DialogDisplayer.getDefault ().createDialog (descriptor);
    d.pack ();
    return d;
}
 
Example 2
Source File: FileInformation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * @return short status name for local changes, for remote
 * changes returns <tt>""</tt>
 */
public String getShortStatusText() {
    ResourceBundle loc = NbBundle.getBundle(FileInformation.class);
    if (match(status, FileInformation.STATUS_NOTVERSIONED_EXCLUDED)) {
        return loc.getString("CTL_FileInfoStatus_Excluded_Short");
    } else if (match(status, FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY)) {
        return loc.getString("CTL_FileInfoStatus_NewLocally_Short");
    } else if (match(status, FileInformation.STATUS_VERSIONED_ADDEDLOCALLY)) {
        if (entry != null && entry.isCopied()) {
            return loc.getString("CTL_FileInfoStatus_AddedLocallyCopied_Short");
        }
        return loc.getString("CTL_FileInfoStatus_AddedLocally_Short");
    } else if (status == FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY) {
        return loc.getString("CTL_FileInfoStatus_RemovedLocally_Short");
    } else if (status == FileInformation.STATUS_VERSIONED_DELETEDLOCALLY) {
        return loc.getString("CTL_FileInfoStatus_DeletedLocally_Short");
    } else if (match(status, FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY)) {
        return loc.getString("CTL_FileInfoStatus_ModifiedLocally_Short");
    } else if (match(status, FileInformation.STATUS_VERSIONED_CONFLICT_TREE)) {
        return loc.getString("CTL_FileInfoStatus_TreeConflict_Short");
    } else if (match(status, FileInformation.STATUS_VERSIONED_CONFLICT)) {
        return loc.getString("CTL_FileInfoStatus_Conflict_Short");
    } else {
        return "";  // NOI18N                  
    }
}
 
Example 3
Source File: DBTableDrop.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Registers assistant messages related to DB table DnD.
 */
private void initAssistant() {
    ResourceBundle bundle = NbBundle.getBundle(DBColumnDrop.class);
    String dropBindingMsg = bundle.getString("MSG_TableDropBinding"); // NOI18N
    String dropComponentMsg = bundle.getString("MSG_TableDropComponent"); // NOI18N
    String tableWithoutPKMsg = bundle.getString("MSG_TableWithoutPK"); // NOI18N
    String tableDefaultPackageMsg = bundle.getString("MSG_TableDefaultPackage"); // NOI18N
    AssistantMessages messages = AssistantMessages.getDefault();
    messages.setMessages("tableDropBinding", dropBindingMsg); // NOI18N
    messages.setMessages("tableDropComponent", dropComponentMsg); // NOI18N
    messages.setMessages("tableWithoutPK", tableWithoutPKMsg); // NOI18N
    messages.setMessages("tableDefaultPackage", tableDefaultPackageMsg);
    assistantInitialized = true;
}
 
Example 4
Source File: IndexSearch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initAccessibility() {
    ResourceBundle b = NbBundle.getBundle(IndexSearch.class);
    getAccessibleContext().setAccessibleName(b.getString("ACS_SEARCH_PanelA11yName"));  // NOI18N
    getAccessibleContext().setAccessibleDescription(b.getString("ACS_SEARCH_PanelA11yDesc"));  // NOI18N
    searchComboBox.getAccessibleContext().setAccessibleName(b.getString("ACS_SEARCH_SearchComboBoxA11yName"));  // NOI18N
    searchComboBox.getAccessibleContext().setAccessibleDescription(b.getString("ACS_SEARCH_SearchComboBoxA11yDesc")); // NOI18N
    resultsList.getAccessibleContext().setAccessibleName(b.getString("ACS_SEARCH_ResultsListA11yName"));  // NOI18N
    resultsList.getAccessibleContext().setAccessibleDescription(b.getString("ACS_SEARCH_ResultsListA11yDesc")); // NOI18N
}
 
Example 5
Source File: FormatSelector.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes category list. 
 */
private void initCategoryList() {
    ResourceBundle bundle = NbBundle.getBundle(getClass());
    DefaultListModel model = new DefaultListModel();
    model.addElement(bundle.getString("LBL_FormatSelector_Category_number")); // NOI18N
    model.addElement(bundle.getString("LBL_FormatSelector_Category_date")); // NOI18N
    model.addElement(bundle.getString("LBL_FormatSelector_Category_time")); // NOI18N
    model.addElement(bundle.getString("LBL_FormatSelector_Category_percent")); // NOI18N
    model.addElement(bundle.getString("LBL_FormatSelector_Category_currency")); // NOI18N
    model.addElement(bundle.getString("LBL_FormatSelector_Category_mask")); // NOI18N
    categoryList.setModel(model);
    categoryList.setSelectedIndex(0);
}
 
Example 6
Source File: SetResizabilityAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void createResizabilitySubmenu(JMenu menu) {
    Node[] nodes = getActivatedNodes();
    List components = FormUtils.getSelectedLayoutComponents(nodes);
    if ((components == null) || (components.size() < 1)) {
        return;
    }
    if (!(menu.getMenuComponentCount() > 0)) {
        ResourceBundle bundle = NbBundle.getBundle(SetResizabilityAction.class);

        JCheckBoxMenuItem hItem = new ResizabilityMenuItem(
                bundle.getString("CTL_ResizabilityH"), // NOI18N
                components,
                0);
        JCheckBoxMenuItem vItem = new ResizabilityMenuItem(
                bundle.getString("CTL_ResizabilityV"), // NOI18N
                components,
                1);
        items = new JCheckBoxMenuItem[] {hItem, vItem};
        
        for (int i=0; i<2; i++) {
            items[i].addActionListener(getMenuItemListener());
            HelpCtx.setHelpIDString(items[i], SetResizabilityAction.class.getName());
            menu.add(items[i]);
        }
    }
    updateState(components);
}
 
Example 7
Source File: SplittedPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public EmptySplitter(int width) {
    ResourceBundle bundle = NbBundle.getBundle(SplittedPanel.class);

    accessibleContext = null;
    this.width = width;

    getAccessibleContext().setAccessibleName(bundle.getString("ACS_SplittedPanel_EmptySplitter"));
    getAccessibleContext().setAccessibleName(bundle.getString("ACSD_SplittedPanel_EmptySplitter"));
}
 
Example 8
Source File: RefreshPanelModifier.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static RefreshPanelModifier getDefault (String budleSuffixKey) {
    RefreshPanelModifier instance = instances.get(budleSuffixKey);
    if (instance == null) {
        RefreshPanelModifier prov = new RefreshPanelModifier();
        ResourceBundle loc = NbBundle.getBundle(RefreshPanelModifier.class);
        prov.messages.put(BundleMessage.FILE_TABLE_HEADER_COMMIT, loc.getString("FILE_TABLE_HEADER_COMMIT")); //NOI18N
        prov.messages.put(BundleMessage.FILE_TABLE_HEADER_COMMIT_DESC, loc.getString("FILE_TABLE_HEADER_COMMIT_DESC")); //NOI18N
        prov.messages.put(BundleMessage.FILE_TABLE_HEADER_ACTION, loc.getString("FILE_TABLE_HEADER_ACTION")); //NOI18N
        prov.messages.put(BundleMessage.FILE_TABLE_HEADER_ACTION_DESC, loc.getString("FILE_TABLE_HEADER_ACTION_DESC")); //NOI18N
        prov.messages.put(BundleMessage.FILE_TABLE_INCLUDE_ACTION_NAME, loc.getString("IncludeOption.name")); //NOI18N
        prov.messages.put(BundleMessage.FILE_TABLE_EXCLUDE_ACTION_NAME, loc.getString("ExcludeOption.name")); //NOI18N
        prov.messages.put(BundleMessage.FILE_TABLE_ACCESSIBLE_NAME, loc.getString("FILE_TABLE_ACCESSIBLE_NAME")); //NOI18N
        prov.messages.put(BundleMessage.FILE_TABLE_ACCESSIBLE_DESCRIPTION, loc.getString("FILE_TABLE_ACCESSIBLE_DESCRIPTION")); //NOI18N
        prov.messages.put(BundleMessage.FILE_PANEL_TITLE, loc.getString("FILE_PANEL_TITLE")); //NOI18N
        prov.messages.put(BundleMessage.TABS_MAIN_NAME, loc.getString("TABS_MAIN_NAME")); //NOI18N
        prov.messages.put(BundleMessage.COMMIT_BUTTON_ACCESSIBLE_DESCRIPTION, loc.getString("COMMIT_BUTTON_ACCESSIBLE_DESCRIPTION." + budleSuffixKey)); //NOI18N
        prov.messages.put(BundleMessage.COMMIT_BUTTON_ACCESSIBLE_NAME, loc.getString("COMMIT_BUTTON_ACCESSIBLE_NAME." + budleSuffixKey)); //NOI18N
        prov.messages.put(BundleMessage.COMMIT_BUTTON_LABEL, loc.getString("COMMIT_BUTTON_LABEL." + budleSuffixKey)); //NOI18N
        prov.messages.put(BundleMessage.MESSAGE_FINISHING_FROM_DIFF, loc.getString("MESSAGE_FINISHING_FROM_DIFF." + budleSuffixKey)); //NOI18N
        prov.messages.put(BundleMessage.MESSAGE_FINISHING_FROM_DIFF_TITLE, loc.getString("MESSAGE_FINISHING_FROM_DIFF_TITLE." + budleSuffixKey)); //NOI18N
        prov.messages.put(BundleMessage.PANEL_ACCESSIBLE_NAME, loc.getString("PANEL_ACCESSIBLE_NAME." + budleSuffixKey)); //NOI18N
        prov.messages.put(BundleMessage.PANEL_ACCESSIBLE_DESCRIPTION, loc.getString("PANEL_ACCESSIBLE_DESCRIPTION." + budleSuffixKey)); //NOI18N
        instance = prov;
        instances.put(budleSuffixKey, prov);
    }
    return instance;
}
 
Example 9
Source File: ApplicationTypeAction.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private ApplicationTypeAction (FileObject fo) {
    super (Application.class);
    mainClassName = (String) fo.getAttribute (MAIN_CLASS_NAME);
    pluginCodeName = (String) fo.getAttribute (PLUGIN_CODE_NAME);
    String bundle = (String) fo.getAttribute (LOCALIZING_BUNDLE);
    ResourceBundle b = NbBundle.getBundle (bundle);
    displayName = b.getString ((String) fo.getAttribute (ACTION_NAME));
    putValue(NAME, displayName);
}
 
Example 10
Source File: VisualState.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static String getDefaultGapDisplayName(PaddingType pt) {
    if (PADDING_DISPLAY_NAMES == null) {
        ResourceBundle bundle = NbBundle.getBundle(VisualState.class);
        PADDING_DISPLAY_NAMES = new String[] {
            bundle.getString("DEFAULT_GAP_SMALL"), // NOI18N
            bundle.getString("DEFAULT_GAP_MEDIUM"), // NOI18N
            bundle.getString("INDENT_GAP"), // NOI18N
            bundle.getString("DEFAULT_GAP_LARGE"), // NOI18N
            bundle.getString("DEFAULT_GAP_UNSPECIFIED") // NOI18N
        };
    }
    return PADDING_DISPLAY_NAMES[pt != null ? pt.ordinal() : 4];
}
 
Example 11
Source File: QuickSearchComboBar.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static Issue selectIssue(String message, Repository repository, JPanel caller, HelpCtx helpCtx) {
    QuickSearchComboBar bar = new QuickSearchComboBar(caller);
    bar.setRepository(repository);
    bar.setAlignmentX(0f);
    bar.setMaximumSize(new Dimension(Short.MAX_VALUE, bar.getPreferredSize().height));
    JPanel panel = new JPanel();
    BoxLayout layout = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
    panel.setLayout(layout);
    JLabel label = new JLabel();
    Mnemonics.setLocalizedText(label, message);
    panel.add(label);
    label.setLabelFor(bar.getIssueComponent());
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    int gap = layoutStyle.getPreferredGap(label, bar, LayoutStyle.ComponentPlacement.RELATED, SwingConstants.SOUTH, panel);
    panel.add(Box.createVerticalStrut(gap));
    panel.add(bar);
    panel.add(Box.createVerticalStrut(gap));
    ResourceBundle bundle = NbBundle.getBundle(QuickSearchComboBar.class);
    JLabel hintLabel = new JLabel(bundle.getString("MSG_SelectIssueHint")); // NOI18N
    hintLabel.setEnabled(false);
    panel.add(hintLabel);
    panel.add(Box.createVerticalStrut(80));
    panel.setBorder(BorderFactory.createEmptyBorder(
            layoutStyle.getContainerGap(panel, SwingConstants.NORTH, null),
            layoutStyle.getContainerGap(panel, SwingConstants.WEST, null),
            0,
            layoutStyle.getContainerGap(panel, SwingConstants.EAST, null)));
    panel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_IssueSelector"));
    Issue issue = null;
    JButton ok = new JButton(bundle.getString("LBL_Select")); // NOI18N
    ok.getAccessibleContext().setAccessibleDescription(ok.getText());
    JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N
    cancel.getAccessibleContext().setAccessibleDescription(cancel.getText());
    DialogDescriptor descriptor = new DialogDescriptor(
            panel,
            bundle.getString("LBL_Issues"), // NOI18N
            true,
            NotifyDescriptor.OK_CANCEL_OPTION,
            ok,
            null);
    descriptor.setOptions(new Object [] {ok, cancel});
    descriptor.setHelpCtx(helpCtx);
    DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
    if (descriptor.getValue() == ok) {
        issue = bar.getIssue();
    }
    return issue;
}
 
Example 12
Source File: WhereUsedQueryUI.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private String getString(String key) {
    if (bundle == null) {
        bundle = NbBundle.getBundle(WhereUsedQueryUI.class);
    }
    return bundle.getString(key);
}
 
Example 13
Source File: ExceptionBreakpointPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Creates new form LineBreakpointPanel */
public ExceptionBreakpointPanel (ExceptionBreakpoint b) {
    breakpoint = b;
    initComponents ();
    
    String className = b.getExceptionClassName ();
    ResourceBundle bundle = NbBundle.getBundle(ExceptionBreakpointPanel.class);
    String tooltipText = bundle.getString("TTT_TF_Field_Breakpoint_Class_Name");
    Pair<JScrollPane, JEditorPane> editorCC = ClassBreakpointPanel.addClassNameEditorCC(
            ExceptionClassNbDebugEditorKit.MIME_TYPE, pSettings, className, tooltipText);
    spExceptionClassName = editorCC.first();
    epExceptionClassName = editorCC.second();
    epExceptionClassName.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_Method_Breakpoint_ClassName"));
    epExceptionClassName.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Exception_Breakpoint_ClassName"));
    HelpCtx.setHelpIDString(epExceptionClassName, HELP_ID);
    jLabel3.setLabelFor(spExceptionClassName);
    
    cbBreakpointType.addItem (bundle.getString("LBL_Exception_Breakpoint_Type_Catched"));
    cbBreakpointType.addItem (bundle.getString("LBL_Exception_Breakpoint_Type_Uncatched"));
    cbBreakpointType.addItem (bundle.getString("LBL_Exception_Breakpoint_Type_Catched_or_Uncatched"));
    switch (b.getCatchType ()) {
        case ExceptionBreakpoint.TYPE_EXCEPTION_CATCHED:
            cbBreakpointType.setSelectedIndex (0);
            break;
        case ExceptionBreakpoint.TYPE_EXCEPTION_UNCATCHED:
            cbBreakpointType.setSelectedIndex (1);
            break;
        case ExceptionBreakpoint.TYPE_EXCEPTION_CATCHED_UNCATCHED:
            cbBreakpointType.setSelectedIndex (2);
            break;
    }
    
    conditionsPanel = new ConditionsPanel(HELP_ID);
    conditionsPanel.setupConditionPaneContext();
    conditionsPanel.showClassFilter(true);
    conditionsPanel.showCondition(true);
    conditionsPanel.setClassMatchFilter(b.getClassFilters());
    conditionsPanel.setClassExcludeFilter(b.getClassExclusionFilters());
    conditionsPanel.setCondition(b.getCondition());
    conditionsPanel.setHitCountFilteringStyle(b.getHitCountFilteringStyle());
    conditionsPanel.setHitCount(b.getHitCountFilter());
    cPanel.add(conditionsPanel, "Center");
    
    actionsPanel = new ActionsPanel (b);
    pActions.add (actionsPanel, "Center");
    // <RAVE>
    // The help IDs for the AddBreakpointPanel panels have to be different from the
    // values returned by getHelpCtx() because they provide different help
    // in the 'Add Breakpoint' dialog and when invoked in the 'Breakpoints' view
    putClientProperty("HelpID_AddBreakpointPanel", "debug.add.breakpoint.java.exception"); // NOI18N
    // </RAVE>
}
 
Example 14
Source File: WatchPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public JComponent getPanel() {
    if (panel != null) {
        return panel;
    }

    panel = new JPanel();
    ResourceBundle bundle = NbBundle.getBundle(WatchPanel.class);

    panel.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_WatchPanel")); // NOI18N
    JLabel textLabel = new JLabel();
    Mnemonics.setLocalizedText(textLabel, bundle.getString ("CTL_Watch_Name")); // NOI18N
    if (expression != null && expression.trim().length() == 0) {
        JEditorPane editor = EditorContextDispatcher.getDefault().getMostRecentEditor();
        if (editor != null && editor.getDocument() instanceof StyledDocument) {
            StyledDocument doc = (StyledDocument) editor.getDocument();
            String selectedExpression = getSelectedIdentifier(doc, editor, editor.getCaret ().getDot ());
            if (selectedExpression != null) {
                expression = selectedExpression;
            }
        }
    }
    JComponent [] editorComponents = Utilities.createSingleLineEditor("text/plain");
    JScrollPane sp = (JScrollPane) editorComponents[0];
    editorPane = (JEditorPane) editorComponents[1];

    int h = sp.getPreferredSize().height;
    int w = Math.min(70*editorPane.getFontMetrics(editorPane.getFont()).charWidth('a'),
                     org.openide.windows.WindowManager.getDefault().getMainWindow().getSize().width);
    sp.setPreferredSize(new Dimension(w, h));
    /*
    FontMetrics fm = editorPane.getFontMetrics(editorPane.getFont());
    int size = 2*fm.getLeading() + fm.getMaxAscent() + fm.getMaxDescent();
    Insets eInsets = editorPane.getInsets();
    Insets spInsets = sp.getInsets();
    sp.setPreferredSize(new Dimension(30*size,
            size +
            eInsets.bottom + eInsets.top +
            spInsets.bottom + spInsets.top));
    */
    textLabel.setBorder (new EmptyBorder (0, 0, 5, 0));
    panel.setLayout (new BorderLayout ());
    panel.setBorder (new EmptyBorder (11, 12, 1, 11));
    panel.add (BorderLayout.NORTH, textLabel);
    panel.add (BorderLayout.CENTER, sp);
    
    editorPane.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Watch_Name")); // NOI18N
    editorPane.setText (expression);
    editorPane.selectAll ();

    Runnable editorPaneUpdated = new Runnable() {
        @Override
        public void run() {
            editorPane.setText (expression);
            editorPane.selectAll ();
        }
    };
    setupContext(editorPane, editorPaneUpdated);

    textLabel.setLabelFor (editorPane);
    HelpCtx.setHelpIDString(editorPane, "debug.customize.watch");
    editorPane.requestFocus ();
    
    return panel;
}
 
Example 15
Source File: AlignAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void createAlignSubmenu(JMenu menu) {
    Node[] nodes = getActivatedNodes();
    List components = FormUtils.getSelectedLayoutComponents(nodes);
    if (!(menu.getMenuComponentCount() > 0)) {
        ResourceBundle bundle = NbBundle.getBundle(AlignAction.class);

        JMenuItem leftGroupItem = new AlignMenuItem(
                bundle.getString("CTL_GroupLeft"), // NOI18N
                components,
                0);
        JMenuItem rightGroupItem = new AlignMenuItem(
                bundle.getString("CTL_GroupRight"), // NOI18N
                components,
                1);
        JMenuItem centerHGroupItem = new AlignMenuItem(
                bundle.getString("CTL_GroupHCenter"), // NOI18N
                components,
                2);
        JMenuItem upGroupItem = new AlignMenuItem(
                bundle.getString("CTL_GroupUp"), // NOI18N
                components,
                3);
        JMenuItem downGroupItem = new AlignMenuItem(
                bundle.getString("CTL_GroupDown"), // NOI18N
                components,
                4);
        JMenuItem centerVGroupItem = new AlignMenuItem(
                bundle.getString("CTL_GroupVCenter"), // NOI18N
                components,
                5);
        JMenuItem leftItem = new AlignMenuItem(
                bundle.getString("CTL_AlignLeft"), // NOI18N
                components,
                6);
        JMenuItem rightItem = new AlignMenuItem(
                bundle.getString("CTL_AlignRight"), // NOI18N
                components,
                7);
        JMenuItem upItem = new AlignMenuItem(
                bundle.getString("CTL_AlignUp"), // NOI18N
                components,
                8);
        JMenuItem downItem = new AlignMenuItem(
                bundle.getString("CTL_AlignDown"), // NOI18N
                components,
                9);
        items = new JMenuItem[] {leftGroupItem, rightGroupItem, centerHGroupItem,
            upGroupItem, downGroupItem, centerVGroupItem, leftItem, rightItem,
            upItem, downItem};
        for (int i=0; i < items.length; i++) {
            items[i].addActionListener(getMenuItemListener());
            items[i].setEnabled(false);
            HelpCtx.setHelpIDString(items[i], AlignAction.class.getName());
            menu.add(items[i]);
            if (i == 5) {
                menu.addSeparator();
            }
        }
    }
    updateState(components);
}
 
Example 16
Source File: NotifyExcPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Updates the visual state of the dialog.
*/
private void update () {
    // JST: this can be improved in future...
    boolean isLocalized = current.isLocalized();

    boolean repack;
    boolean visNext = next.isVisible();
    boolean visPrev = previous.isVisible();
    next.setVisible (exceptions.existsNextElement());
    previous.setVisible (exceptions.existsPreviousElement());
    repack = next.isVisible() != visNext || previous.isVisible() != visPrev;

    if (showDetails) {
        Mnemonics.setLocalizedText(details, org.openide.util.NbBundle.getBundle(NotifyExcPanel.class).getString("CTL_Exception_Hide_Details"));
        details.getAccessibleContext().setAccessibleDescription(
            org.openide.util.NbBundle.getBundle(NotifyExcPanel.class).getString("ACSD_Exception_Hide_Details"));
    } else {
        Mnemonics.setLocalizedText(details, org.openide.util.NbBundle.getBundle(NotifyExcPanel.class).getString("CTL_Exception_Show_Details"));
        details.getAccessibleContext().setAccessibleDescription(
            org.openide.util.NbBundle.getBundle(NotifyExcPanel.class).getString("ACSD_Exception_Show_Details"));
    }

    //    setText (current.getLocalizedMessage ());
    String title = org.openide.util.NbBundle.getBundle(NotifyExcPanel.class).getString("CTL_Title_Exception");

    if (showDetails) {
        descriptor.setMessage (this);
        
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                // XXX #28191: some other piece of code should underline these, etc.
                    StringWriter wr = new StringWriter();
                    current.printStackTrace(new PrintWriter(wr, true));
                    output.setText(wr.toString());
                    output.getCaret().setDot(0);
                    if (!AUTO_FOCUS && FocusManager.getCurrentManager().getActiveWindow() == null) {
                        // Do not steal focus if no Java window have it
                        output.requestFocusInWindow();
                    } else {
                        output.requestFocus ();
                    }
            }
        });
    } else {
        if (isLocalized) {
            String msg = current.getLocalizedMessage ();
            if (msg != null) {
                descriptor.setMessage (msg);
            }
        } else {
            ResourceBundle curBundle = NbBundle.getBundle (NotifyExcPanel.class);
            if (current.getSeverity() == Level.WARNING) {
                // less scary message for warning level
                descriptor.setMessage (
                    java.text.MessageFormat.format(
                        curBundle.getString("NTF_ExceptionWarning"),
                        new Object[] {
                            current.getClassName ()
                        }
                    )
                );
                title = curBundle.getString("NTF_ExceptionWarningTitle"); // NOI18N
            } else {
                // emphasize user-non-friendly exceptions
                //      if (this.getMessage() == null || "".equals(this.getMessage())) { // NOI18N
                descriptor.setMessage (
                    java.text.MessageFormat.format(
                        curBundle.getString("NTF_ExceptionalException"),
                        new Object[] {
                            current.getClassName (),
                            CLIOptions.getLogDir ()
                        }
                    )
                );

                title = curBundle.getString("NTF_ExceptionalExceptionTitle"); // NOI18N
            }
        }
    }

    descriptor.setTitle (title);
    if (repack) {
        dialog.pack();
    }
   
}
 
Example 17
Source File: FileInformation.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Returns localized text representation of status.
 *
 * @param displayStatuses statuses bitmask
 *
 * @return status name, for multistatuses prefers local
 * status name, for masked <tt>""</tt>.
 */
public String getStatusText(int displayStatuses) {
    int status = this.status & displayStatuses;
    ResourceBundle loc = NbBundle.getBundle(FileInformation.class);
    String retval;
    if (status == FileInformation.STATUS_UNKNOWN) {
        retval = loc.getString("CTL_FileInfoStatus_Unknown");            
    } else if (match(status, FileInformation.STATUS_NOTVERSIONED_EXCLUDED)) {
        retval = loc.getString("CTL_FileInfoStatus_Excluded");
    } else if (match(status, FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY)) {
        retval = loc.getString("CTL_FileInfoStatus_NewLocally");
    } else if (match(status, FileInformation.STATUS_VERSIONED_ADDEDLOCALLY)) {
        if (entry != null && entry.isCopied()) {
            retval = loc.getString("CTL_FileInfoStatus_AddedLocallyCopied");
        } else {
            retval = loc.getString("CTL_FileInfoStatus_AddedLocally");
        }
    } else if (match(status, FileInformation.STATUS_VERSIONED_UPTODATE)) {
        retval = loc.getString("CTL_FileInfoStatus_UpToDate");
    } else if (match(status, FileInformation.STATUS_VERSIONED_CONFLICT_TREE)) {
        retval = loc.getString("CTL_FileInfoStatus_TreeConflict");
    } else if (match(status, FileInformation.STATUS_VERSIONED_CONFLICT)) {
        retval = loc.getString("CTL_FileInfoStatus_Conflict");
    } else if (match(status, FileInformation.STATUS_VERSIONED_MERGE)) {
        retval = loc.getString("CTL_FileInfoStatus_Merge");            
    } else if (match(status, FileInformation.STATUS_VERSIONED_DELETEDLOCALLY)) {
        retval = loc.getString("CTL_FileInfoStatus_DeletedLocally");
    } else if (match(status, FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY)) {
        retval = loc.getString("CTL_FileInfoStatus_RemovedLocally");
    } else if (match(status, FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY)) {
        retval = loc.getString("CTL_FileInfoStatus_ModifiedLocally");
    } else if (match(status, FileInformation.STATUS_VERSIONED_NEWINREPOSITORY)) {
        retval = loc.getString("CTL_FileInfoStatus_NewInRepository");
    } else if (match(status, FileInformation.STATUS_VERSIONED_MODIFIEDINREPOSITORY)) {
        retval = loc.getString("CTL_FileInfoStatus_ModifiedInRepository");
    } else if (match(status, FileInformation.STATUS_VERSIONED_REMOVEDINREPOSITORY)) {
        retval = loc.getString("CTL_FileInfoStatus_RemovedInRepository");
    } else {
        retval = "";   // NOI18N                     
    }
    if ((this.status & STATUS_LOCKED) != 0) {
        if (!retval.isEmpty()) {
            retval += "/"; //NOI18N
        }
        retval += loc.getString("CTL_FileInfoStatus_LockedLocally");
    } else if ((this.status & STATUS_LOCKED_REMOTELY) != 0) {
        if (!retval.isEmpty()) {
            retval += "/"; //NOI18N
        }
        retval += loc.getString("CTL_FileInfoStatus_LockedRemotely");
    }
    return retval;
}
 
Example 18
Source File: MultiDiffPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Workaround.
 * I18N Test Wizard searches for keys in syncview package Bundle.properties
 */
private String actionString(String key) {
    ResourceBundle actionsLoc = NbBundle.getBundle(MercurialAnnotator.class);
    return actionsLoc.getString(key);
}
 
Example 19
Source File: Setup.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Setup (GitFileNode<FileInformation> node, Mode mode, Revision revision) {
    this.baseFile = node.getFile();

    ResourceBundle loc = NbBundle.getBundle(Setup.class);
    String firstTitle;
    String secondTitle;
    FileInformation info = node.getInformation();
    File originalFile = null;
    if (info != null && (info.isCopied() || info.isRenamed())) {
        originalFile = info.getOldFile();
    }

    // <editor-fold defaultstate="collapsed" desc="left panel">
    switch (mode) {
        case HEAD_VS_WORKING_TREE:
        case HEAD_VS_INDEX:
            firstRevision = originalFile == null && info.containsStatus(EnumSet.of(FileInformation.Status.NEW_HEAD_WORKING_TREE, FileInformation.Status.NEW_HEAD_INDEX)) ? null : revision.getCommitId();
            firstTitle = originalFile == null
                    ? revision.toString()
                    : MessageFormat.format(loc.getString("MSG_DiffPanel_Revision.file"), //NOI18N
                    new Object[] { revision.toString(), originalFile.getName() } );
            break;
        case INDEX_VS_WORKING_TREE:
            firstRevision = GitUtils.INDEX;
            firstTitle = MessageFormat.format(loc.getString("MSG_DiffPanel_IndexRevision"), new Object[]{firstRevision}); // NOI18N
            break;
        default:
            throw new IllegalArgumentException("Unknown diff type: " + mode); // NOI18N
    }// </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="right panel">
    switch (mode) {
        case HEAD_VS_WORKING_TREE:
        case INDEX_VS_WORKING_TREE:
            if (info.containsStatus(FileInformation.Status.NEW_HEAD_WORKING_TREE)) {
                secondRevision = GitUtils.CURRENT;
                if (originalFile != null) {
                    if (info.isRenamed()) {
                        secondTitle = loc.getString("MSG_DiffPanel_LocalRenamed"); //NOI18N
                    } else {
                        secondTitle = loc.getString("MSG_DiffPanel_LocalCopied"); //NOI18N
                    }
                } else {
                    secondTitle = loc.getString("MSG_DiffPanel_LocalNew"); //NOI18N
                }
            } else if (info.containsStatus(FileInformation.Status.REMOVED_HEAD_WORKING_TREE)) {
                secondRevision = null;
                secondTitle = loc.getString("MSG_DiffPanel_LocalDeleted"); // NOI18N
            } else {
                secondRevision = GitUtils.CURRENT;
                secondTitle = loc.getString("MSG_DiffPanel_LocalModified"); // NOI18N
            }
            break;
        case HEAD_VS_INDEX:
            if (info.containsStatus(FileInformation.Status.NEW_HEAD_INDEX)) {
                secondRevision = GitUtils.INDEX;
                if (originalFile != null) {
                    if (info.isRenamed()) {
                        secondTitle = loc.getString("MSG_DiffPanel_IndexRenamed"); //NOI18N
                    } else {
                        secondTitle = loc.getString("MSG_DiffPanel_IndexCopied"); //NOI18N
                    }
                } else {
                    secondTitle = loc.getString("MSG_DiffPanel_IndexNew"); //NOI18N
                }
            } else if (info.containsStatus(FileInformation.Status.REMOVED_HEAD_INDEX)) {
                secondRevision = null;
                secondTitle = loc.getString("MSG_DiffPanel_IndexDeleted"); // NOI18N
            } else {
                secondRevision = GitUtils.INDEX;
                secondTitle = loc.getString("MSG_DiffPanel_IndexModified"); // NOI18N
            }
            break;
        default:
            throw new IllegalArgumentException("Unknown diff type: " + mode); // NOI18N
    }// </editor-fold>

    firstSource = new DiffStreamSource(originalFile == null || mode == Mode.INDEX_VS_WORKING_TREE ? baseFile : originalFile, baseFile, firstRevision, firstTitle);
    secondSource = new DiffStreamSource(baseFile, baseFile, secondRevision, secondTitle);
    title = "<html>" + info.annotateNameHtml(baseFile.getName()); // NOI18N
}
 
Example 20
Source File: AuthorizationEntry.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public AuthorizationEntry(String propName, String attrName, String resBase) {
    super(null, propName, NbBundle.getBundle("org.netbeans.modules.j2ee.sun.share.configbean.customizers.webservice.Bundle"),
            resBase, false, false);

    childAttributeName = attrName;
}