Java Code Examples for org.openide.util.NbBundle

The following are top voted examples for showing how to use org.openide.util.NbBundle. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: incubator-netbeans   File: TimestampType.java   View source code 6 votes vote down vote up
public static Timestamp convert(Object value) throws DBException {
    if (null == value) {
        return null;
    } else if (value instanceof Timestamp) {
        return (Timestamp) value;
    } else if (value instanceof java.sql.Date) {
        return new Timestamp(((java.sql.Date)value).getTime());
    }  else if (value instanceof java.util.Date) {
        return new Timestamp(((java.util.Date)value).getTime());
    } else if (value instanceof String) {
        Date dVal = doParse ((String) value);
        if (dVal == null) {
            throw new DBException(NbBundle.getMessage(TimestampType.class, "LBL_invalid_timestamp"));
        }
        return new Timestamp(dVal.getTime());
    } else {
        throw new DBException(NbBundle.getMessage(TimestampType.class, "LBL_invalid_timestamp"));
    }
}
 
Example 2
Project: incubator-netbeans   File: DiffAction.java   View source code 6 votes vote down vote up
@Override
protected void performContextAction(Node[] nodes) {
    VCSContext context = HgUtils.getCurrentContext(nodes);
    String contextName = Utils.getContextDisplayName(context);
            
    File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
    boolean bNotManaged = !HgUtils.isFromHgRepository(context) || ( files == null || files.length == 0);

    if (bNotManaged) {
        OutputLogger logger = Mercurial.getInstance().getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);
        logger.outputInRed( NbBundle.getMessage(DiffAction.class,"MSG_DIFF_TITLE")); // NOI18N
        logger.outputInRed( NbBundle.getMessage(DiffAction.class,"MSG_DIFF_TITLE_SEP")); // NOI18N
        logger.outputInRed(
                NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
        logger.output(""); // NOI18N
        logger.closeLog();
        JOptionPane.showMessageDialog(null,
                NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW"),// NOI18N
                NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
                JOptionPane.INFORMATION_MESSAGE);
        return;
    }

    diff(context, Setup.DIFFTYPE_LOCAL, contextName);
}
 
Example 3
Project: incubator-netbeans   File: Utils.java   View source code 6 votes vote down vote up
public static String getFormatedDate(Calendar calendar) {
    if (calendar == null) {
        return "";
    }
    int evaluation = evaluateDate(calendar);
    switch (evaluation) {
        case DATE_MINUTES_AGO:
            int minutes = calculateMinutes(calendar, Calendar.getInstance());
            return NbBundle.getMessage(Utils.class, minutes == 1 ? "LBL_MinuteAgo" : "LBL_MinutesAgo", minutes);
        case DATE_TODAY:
            return NbBundle.getMessage(Utils.class, "LBL_Today", timeFormat.format(calendar.getTime()));
        case DATE_YESTERDAY:
            return NbBundle.getMessage(Utils.class, "LBL_Yesterday", timeFormat.format(calendar.getTime()));
        default:
            return dateFormat.format(calendar.getTime());
    }
}
 
Example 4
Project: incubator-netbeans   File: IDEServicesImpl.java   View source code 6 votes vote down vote up
private File selectPatchContext() {
    PatchContextChooser chooser = new PatchContextChooser();
    ResourceBundle bundle = NbBundle.getBundle(IDEServicesImpl.class);
    JButton ok = new JButton(bundle.getString("LBL_Apply")); // NOI18N
    JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N
    DialogDescriptor descriptor = new DialogDescriptor(
            chooser,
            bundle.getString("LBL_ApplyPatch"), // NOI18N
            true,
            NotifyDescriptor.OK_CANCEL_OPTION,
            ok,
            null);
    descriptor.setOptions(new Object [] {ok, cancel});
    descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.bugtracking.patchContextChooser")); // NOI18N
    File context = null;
    DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
    if (descriptor.getValue() == ok) {
        context = chooser.getSelectedFile();
    }
    return context;
}
 
Example 5
Project: incubator-netbeans   File: JPDAWatchImpl.java   View source code 6 votes vote down vote up
protected void setValue (Value value) throws InvalidExpressionException {
    EvaluationContext.VariableInfo vi = getInfo(debugger, getInnerValue());
    if (vi != null) {
        try {
            vi.setValue(value);
        } catch (IllegalStateException isex) {
            if (isex.getCause() instanceof InvalidExpressionException) {
                throw (InvalidExpressionException) isex.getCause();
            } else {
                throw new InvalidExpressionException(isex);
            }
        }
    } else {
        throw new InvalidExpressionException (
                NbBundle.getMessage(JPDAWatchImpl.class, "MSG_CanNotSetValue", getExpression()));
    }
}
 
Example 6
Project: incubator-netbeans   File: Specification.java   View source code 6 votes vote down vote up
/** Creates command identified by commandName on table tableName.
* Returns null if command specified by commandName was not found. It does not
* check tableName existency; it simply waits for relevant execute() command
* which fires SQLException.
*/	
public DDLCommand createCommand(String commandName, String tableName)
throws CommandNotSupportedException
{
    String classname;
    Class cmdclass;
    AbstractCommand cmd;
    HashMap cprops = (HashMap)desc.get(commandName);
    if (cprops != null) classname = (String)cprops.get("Class"); // NOI18N
    //else throw new CommandNotSupportedException(commandName, "command "+commandName+" is not supported by system");
    else throw new CommandNotSupportedException(commandName,
        MessageFormat.format(NbBundle.getBundle("org.netbeans.lib.ddl.resources.Bundle").getString("EXC_CommandNotSupported"), commandName)); // NOI18N
    try {
        cmdclass = Class.forName(classname);
        cmd = (AbstractCommand)cmdclass.newInstance();
    } catch (Exception e) {
        throw new CommandNotSupportedException(commandName,
            MessageFormat.format(NbBundle.getBundle("org.netbeans.lib.ddl.resources.Bundle").getString("EXC_UnableFindOrInitCommand"), classname, commandName, e.getMessage())); // NOI18N
    }

    cmd.setObjectName(tableName);
    cmd.setSpecification(this);
    cmd.setFormat((String)cprops.get("Format")); // NOI18N
    return cmd;
}
 
Example 7
Project: incubator-netbeans   File: DerbyActivator.java   View source code 6 votes vote down vote up
private static void doActivate() {
    if (!helper.canBundleDerby()) {
        LOGGER.fine("Default platform cannot bundle Derby"); // NOI18N
        return;
    }

    ProgressHandle handle = ProgressHandleFactory.createSystemHandle(NbBundle.getMessage(DerbyActivator.class, "MSG_RegisterJavaDB"));
    handle.start();
    try {
        if (registerDerby()) {
            registerSampleDatabase();
        }
    } finally {
        handle.finish();
    }
}
 
Example 8
Project: incubator-netbeans   File: ExtractInterfaceRefactoringPlugin.java   View source code 6 votes vote down vote up
@Override
public Problem fastCheckParameters() {
    Problem result = null;
    
    String newName = refactoring.getInterfaceName();
    
    if (!Utilities.isJavaIdentifier(newName)) {
        result = createProblem(result, true, NbBundle.getMessage(ExtractInterfaceRefactoringPlugin.class, "ERR_InvalidIdentifier", newName)); // NOI18N
        return result;
    }
    
    FileObject primFile = refactoring.getSourceType().getFileObject();
    FileObject folder = primFile.getParent();
    FileObject[] children = folder.getChildren();
    for (FileObject child: children) {
        if (!child.isVirtual() && child.getName().equalsIgnoreCase(newName) && "java".equalsIgnoreCase(child.getExt())) { // NOI18N
            result = createProblem(result, true, NbBundle.getMessage(ExtractInterfaceRefactoringPlugin.class, "ERR_ClassClash", newName, pkgName)); // NOI18N
            return result;
        }
    }

    return super.fastCheckParameters();
}
 
Example 9
Project: incubator-netbeans   File: CssHintsProvider.java   View source code 6 votes vote down vote up
private static String getMessageKey(String errorKey, boolean enabled) {
    String param = null;
    String keyEnable = null;
    String keyDisable = null;
    if (CssAnalyser.isUnknownPropertyError(errorKey)) {
        keyEnable = "MSG_Disable_Ignore_Property"; //NOI18N
        keyDisable = "MSG_Enable_Ignore_Property"; //NOI18N
        param = CssAnalyser.getUnknownPropertyName(errorKey);
    } else {
        keyEnable = "MSG_Disable_Check"; //NOI18N
        keyDisable = "MSG_Enable_Check"; //NOI18N

    }
    return enabled
            ? NbBundle.getMessage(CssHintsProvider.class, keyEnable, param)
            : NbBundle.getMessage(CssHintsProvider.class, keyDisable, param);

}
 
Example 10
Project: incubator-netbeans   File: MercurialOptionsPanelController.java   View source code 6 votes vote down vote up
private void onExportFilenameBrowseClick() {
    File oldFile = getExecutableFile();
    JFileChooser fileChooser = new AccessibleJFileChooser(NbBundle.getMessage(MercurialOptionsPanelController.class, "ACSD_ExportBrowseFolder"), oldFile);   // NOI18N
    fileChooser.setDialogTitle(NbBundle.getMessage(MercurialOptionsPanelController.class, "ExportBrowse_title"));                                            // NOI18N
    fileChooser.setMultiSelectionEnabled(false);
    FileFilter[] old = fileChooser.getChoosableFileFilters();
    for (int i = 0; i < old.length; i++) {
        FileFilter fileFilter = old[i];
        fileChooser.removeChoosableFileFilter(fileFilter);
    }
    fileChooser.showDialog(panel, NbBundle.getMessage(MercurialOptionsPanelController.class, "OK_Button"));                                            // NOI18N
    File f = fileChooser.getSelectedFile();
    if (f != null) {
        panel.exportFilenameTextField.setText(f.getAbsolutePath());
    }
}
 
Example 11
Project: incubator-netbeans   File: AssignmentIssues.java   View source code 6 votes vote down vote up
@Hint(displayName = "#DN_org.netbeans.modules.java.hints.AssignmentIssues.assignmentToForLoopParam", description = "#DESC_org.netbeans.modules.java.hints.AssignmentIssues.assignmentToForLoopParam", category = "assignment_issues", enabled = false, suppressWarnings = "AssignmentToForLoopParameter", options=Options.QUERY) //NOI18N
@TriggerPatterns({
    @TriggerPattern(value = "for ($paramType $param = $init; $expr; $update) $statement;"), //NOI18N
    @TriggerPattern(value = "for ($paramType $param : $expr) $statement;") //NOI18N
})
public static List<ErrorDescription> assignmentToForLoopParam(HintContext context) {
    final Trees trees = context.getInfo().getTrees();
    final TreePath paramPath = context.getVariables().get("$param"); //NOI18N
    final Element param = trees.getElement(paramPath);
    if (param == null || param.getKind() != ElementKind.LOCAL_VARIABLE) {
        return null;
    }
    final TreePath stat = context.getVariables().get("$statement"); //NOI18N
    final List<TreePath> paths = new LinkedList<TreePath>();
    new AssignmentFinder(trees, param).scan(stat, paths);
    final List<ErrorDescription> ret = new ArrayList<ErrorDescription>(paths.size());
    for (TreePath path : paths) {
        ret.add(ErrorDescriptionFactory.forTree(context, path, NbBundle.getMessage(AssignmentIssues.class, "MSG_AssignmentToForLoopParam", param.getSimpleName()))); //NOI18N
    }
    return ret;
}
 
Example 12
Project: NBANDROID-V2   File: SdksCustomizer.java   View source code 6 votes vote down vote up
/**
 * Shows platforms customizer
 *
 * @param platform which should be seelcted, may be null
 * @return boolean for future extension, currently always true
 */
public static boolean showCustomizer() {
    SdksCustomizer customizer
            = new SdksCustomizer();
    javax.swing.JButton close = new javax.swing.JButton(NbBundle.getMessage(SdksCustomizer.class, "CTL_Close"));
    close.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SdksCustomizer.class, "AD_Close"));
    DialogDescriptor descriptor = new DialogDescriptor(customizer, NbBundle.getMessage(SdksCustomizer.class,
            "TXT_PlatformsManager"), true, new Object[]{close}, close, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.nbandroid.netbeans.gradle.v2.sdk.ui.PlatformsCustomizer"), null); // NOI18N
    Dialog dlg = null;
    try {
        dlg = DialogDisplayer.getDefault().createDialog(descriptor);
        dlg.setVisible(true);
    } finally {
        if (dlg != null) {
            dlg.dispose();
        }
    }
    return true;
}
 
Example 13
Project: incubator-netbeans   File: OutputTab.java   View source code 6 votes vote down vote up
/**
 * Invokes a file dialog and if a file is chosen, saves the output to that file.
 */
void saveAs() {
    OutWriter out = getOut();
    if (out == null) {
        return;
    }
    File f = showFileChooser(this);
    if (f != null) {
        try {
            synchronized (out) {
                out.getLines().saveAs(f.getPath());
            }
        } catch (IOException ioe) {
            NotifyDescriptor notifyDesc = new NotifyDescriptor(
                    NbBundle.getMessage(OutputTab.class, "MSG_SaveAsFailed", f.getPath()),
                    NbBundle.getMessage(OutputTab.class, "LBL_SaveAsFailedTitle"),
                    NotifyDescriptor.DEFAULT_OPTION,
                    NotifyDescriptor.ERROR_MESSAGE,
                    new Object[]{NotifyDescriptor.OK_OPTION},
                    NotifyDescriptor.OK_OPTION);

            DialogDisplayer.getDefault().notify(notifyDesc);
        }
    }
}
 
Example 14
Project: incubator-netbeans   File: PersistenceManager.java   View source code 6 votes vote down vote up
public FileObject getRootLocalFolder () throws IOException {
    try {
        if (rootLocalFolder == null) {
            String folderName = ROOT_LOCAL_FOLDER;
            if( null != currentRole )
                folderName += "-" + currentRole;
            rootLocalFolder = FileUtil.createFolder( FileUtil.getConfigRoot(), folderName );
        }
        return rootLocalFolder;
    } catch (IOException exc) {
        String annotation = NbBundle.getMessage(PersistenceManager.class,
            "EXC_RootFolder", ROOT_LOCAL_FOLDER);
        Exceptions.attachLocalizedMessage(exc, annotation);
        throw exc;
    }
}
 
Example 15
Project: incubator-netbeans   File: PomModelUtils.java   View source code 6 votes vote down vote up
public static boolean implementInTransaction(Model m, Runnable r) {
    m.startTransaction();
    try {
        r.run();
    } finally {
        try {
            m.endTransaction();
        } catch (IllegalStateException ex) {
            StatusDisplayer.getDefault().setStatusText(
                    NbBundle.getMessage(PomModelUtils.class, "ERR_UpdatePomModel",
                    Exceptions.findLocalizedMessage(ex)));
            return false;
        }
    }
    return true;
}
 
Example 16
Project: incubator-netbeans   File: EditDependencyPanel.java   View source code 6 votes vote down vote up
public void refreshAvailablePackages() {
    packagesModel.clear();
    if (hasAvailablePackages()) {
        // XXX should show all subpackages in the case of recursion is set
        // to true instead of e.g. org/**
        SortedSet<String> packages = new TreeSet<String>();
        for (int i = 0; i < pp.length; i++) { // add public packages
            packages.add(pp[i].getPackage() + (pp[i].isRecursive() ? ".**" : "")); // NOI18N
        }
        if (implVer.isSelected()) { // add all packages
            packages.addAll(origDep.getModuleEntry().getAllPackageNames());
        }
        for (String pkg : packages) {
            packagesModel.addElement(pkg);
        }
    } else {
        packagesModel.addElement(NbBundle.getMessage(EditDependencyPanel.class, "EditDependencyPanel_empty"));
    }
    availablePkg.setModel(packagesModel);
}
 
Example 17
Project: incubator-netbeans   File: SelectConfigFilesPanel.java   View source code 6 votes vote down vote up
public boolean open() {
    String title = NbBundle.getMessage(SelectConfigFilesPanel.class, "LBL_ConfigFilesTitle");
    descriptor = new DialogDescriptor(this, title, true, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            cancelDetection();
        }
    });
    if (availableFiles == null) {
        // No available files, will run the detection task.
        descriptor.setValid(false);
        configFileTable.setEnabled(true);
        progressBar.setIndeterminate(true);
        detectTask = rp.create(new FileDetector());
        detectTask.schedule(0);
    } else {
        updateAvailableFiles(availableFiles);
    }
    Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor);
    try {
        dialog.setVisible(true);
    } finally {
        dialog.dispose();
    }
    return descriptor.getValue() == DialogDescriptor.OK_OPTION;
}
 
Example 18
Project: incubator-netbeans   File: CssRenameRefactoringPlugin.java   View source code 6 votes vote down vote up
private void refactorElement(ModificationResult modificationResult, CssElementContext.Editor context, CssIndex index) {
    //type selector: div
    //we do refactor only elements in the current css file, and even this is questionable if makes much sense
    Node element = context.getElement();
    String elementImage = element.image().toString();

    CssFileModel model = CssFileModel.create(context.getParserResult());
    List<Difference> diffs = new ArrayList<>();
    CloneableEditorSupport editor = GsfUtilities.findCloneableEditorSupport(context.getFileObject());
    for (Entry entry : model.getHtmlElements()) {
        if (entry.isValidInSourceDocument() && elementImage.equals(entry.getName())) {
            diffs.add(new Difference(Difference.Kind.CHANGE,
                    editor.createPositionRef(entry.getDocumentRange().getStart(), Bias.Forward),
                    editor.createPositionRef(entry.getDocumentRange().getEnd(), Bias.Backward),
                    entry.getName(),
                    refactoring.getNewName(),
                    NbBundle.getMessage(CssRenameRefactoringPlugin.class, "MSG_Rename_Selector"))); //NOI18N
        }
    }
    if (!diffs.isEmpty()) {
        modificationResult.addDifferences(context.getFileObject(), diffs);
    }

}
 
Example 19
Project: incubator-netbeans   File: DocumentationScrollPane.java   View source code 6 votes vote down vote up
/** Creates a new instance of ScrollJavaDocPane */
    public DocumentationScrollPane( boolean keepDefaultBorder ) {
        super();
 
        // Add the completion doc view
        //XXX fix bg color
        view = new HTMLDocView( getDefaultBackground() );
        view.addHyperlinkListener(new HyperlinkAction());
        setViewportView(view);
        getAccessibleContext().setAccessibleName(NbBundle.getMessage(DocumentationScrollPane.class, "ACSN_DocScrollPane"));
        getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(DocumentationScrollPane.class, "ACSD_DocScrollPane"));
        view.getAccessibleContext().setAccessibleName(NbBundle.getMessage(DocumentationScrollPane.class, "ACSN_DocScrollPane"));
        view.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(DocumentationScrollPane.class, "ACSD_DocScrollPane"));
        installTitleComponent();
//        installKeybindings(view);
        setFocusable(true);
        
        if( !keepDefaultBorder )
            setBorder( BorderFactory.createEmptyBorder() );
    }
 
Example 20
Project: incubator-netbeans   File: Export.java   View source code 5 votes vote down vote up
public Export(File fromFile, boolean localChanges) {
    
    this.fromFile = fromFile;
    
    panel = new ExportPanel();

    panel.scanCheckBox.setSelected(SvnModuleConfig.getDefault().getPreferences().getBoolean(SCAN_AFTER_EXPORT, false));
    panel.exportFromTextField.setText(fromFile.getAbsolutePath());
    panel.browseToFolderButton.addActionListener(this);
    panel.exportToTextField.getDocument().addDocumentListener(this);

    panel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Export.class, "CTL_ExportDialog_Title"));                   // NOI18N

    okButton = new JButton(NbBundle.getMessage(Export.class, "CTL_Export"));
    okButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Export.class, "CTL_Export"));
    cancelButton = new JButton(NbBundle.getMessage(Export.class, "CTL_Cancel"));                                      // NOI18N
    cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(Export.class, "CTL_Cancel"));    // NOI18N

    dialogDescriptor =
            new DialogDescriptor(
                panel,
                NbBundle.getMessage(Export.class, "CTL_ExportDialog_Title"),
                true,
                new Object[]{okButton, cancelButton},
                okButton,
                DialogDescriptor.DEFAULT_ALIGN,
                null,
                null);
    okButton.setEnabled(false);

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(Export.class, "CTL_ExportDialog_Title"));                // NOI18N

    validateUserInput();
}
 
Example 21
Project: incubator-netbeans   File: IExplorerBrowser.java   View source code 5 votes vote down vote up
/**
 * Returns a new instance of BrowserImpl implementation.
 * @throws UnsupportedOperationException when method is called and OS is not Windows.
 * @return browserImpl implementation of browser.
 */
@Override
public HtmlBrowser.Impl createHtmlBrowserImpl() {
    ExtBrowserImpl impl = null;

    if (org.openide.util.Utilities.isWindows ()) {
        impl = new NbDdeBrowserImpl (this);
    } else {
        throw new UnsupportedOperationException (NbBundle.getMessage (IExplorerBrowser.class, "MSG_CannotUseBrowser"));
    }
    
    return impl;
}
 
Example 22
Project: incubator-netbeans   File: NoWebBrowserImpl.java   View source code 5 votes vote down vote up
public NoWebBrowserImpl(String cause) {
    JLabel lbl = new JLabel(NbBundle.getMessage(NoWebBrowserImpl.class, "Err_CannotCreateBrowser", cause));
    lbl.setEnabled( false );
    lbl.setHorizontalAlignment( JLabel.CENTER );
    lbl.setVerticalAlignment( JLabel.CENTER );
    component = lbl;
}
 
Example 23
Project: incubator-netbeans   File: JWSCustomizerPanel.java   View source code 5 votes vote down vote up
private void appletParamsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_appletParamsButtonActionPerformed

    List<Map<String,String>> origProps = jwsProps.getAppletParamsProperties();
    List<Map<String,String>> props = copyList(origProps);
    TableModel appletParamsTableModel = new JWSProjectProperties.PropertiesTableModel(props, JWSProjectProperties.appletParamsSuffixes, appletParamsColumnNames);
    JPanel panel = new AppletParametersPanel((PropertiesTableModel) appletParamsTableModel, jwsProps.appletWidthDocument, jwsProps.appletHeightDocument);
    DialogDescriptor dialogDesc = new DialogDescriptor(panel, NbBundle.getMessage(JWSCustomizerPanel.class, "TITLE_AppletParameters"), true, null); //NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDesc);
    dialog.setVisible(true);
    if (dialogDesc.getValue() == DialogDescriptor.OK_OPTION) {
        jwsProps.setAppletParamsProperties(props);
    }
    dialog.dispose();

}
 
Example 24
Project: incubator-netbeans   File: AttachmentsPanel.java   View source code 5 votes vote down vote up
public AttachmentsPanel(JComponent parentPanel) {
    this.parentPanel = parentPanel;
    this.supp = new ChangeSupport(this);
    setBackground(UIManager.getColor("TextArea.background")); // NOI18N
    ResourceBundle bundle = NbBundle.getBundle(AttachmentsPanel.class);
    noneLabel = new JLabel(bundle.getString("AttachmentsPanel.noneLabel.text")); // NOI18N
    createNewButton = new LinkButton(new CreateNewAction());
    createNewButton.getAccessibleContext().setAccessibleDescription(bundle.getString("AttachmentPanels.createNewButton.AccessibleContext.accessibleDescription")); // NOI18N
    try {
        maxMethod = GroupLayout.Group.class.getDeclaredMethod("calculateMaximumSize", int.class); // NOI18N
        maxMethod.setAccessible(true);
    } catch (NoSuchMethodException nsmex) {
        LOG.log(Level.INFO, nsmex.getMessage(), nsmex);
    }
}
 
Example 25
Project: incubator-netbeans   File: UINode.java   View source code 5 votes vote down vote up
@Override
public String getHtmlDisplayName() {
    if (htmlKey == null) {
        return null;
    } else {
        return NbBundle.getMessage(UINode.class, htmlKey, getDisplayName());
    }
}
 
Example 26
Project: incubator-netbeans   File: OutputKeymapManager.java   View source code 5 votes vote down vote up
public OutWinShortCutAction(String id, String bundleKey) {
    this.id = id;
    this.bundleKey = bundleKey;
    this.displayName = NbBundle.getMessage(
            NbIOProvider.class, bundleKey);
    String nbKeysBundleKey = Utilities.isMac()
            ? bundleKey + ".accel.mac" //NOI18N
            : bundleKey + ".accel";                             //NOI18N
    String nbKeys = NbBundle.getMessage(NbIOProvider.class,
            nbKeysBundleKey);
    this.defaultShortcut = nbKeys;
}
 
Example 27
Project: incubator-netbeans   File: ConnectionNode.java   View source code 5 votes vote down vote up
@Override
public String getShortDescription() {
    if (!getName().equals(getDisplayName())) {
        return getName();
    } else {
        return NbBundle.getMessage (ConnectionNode.class, "ND_Connection"); //NOI18N
    }
}
 
Example 28
Project: incubator-netbeans   File: SelectConnectionPanel.java   View source code 5 votes vote down vote up
/** This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    dbconnLabel = new javax.swing.JLabel();
    dbconnComboBox = new javax.swing.JComboBox();

    org.openide.awt.Mnemonics.setLocalizedText(dbconnLabel, org.openide.util.NbBundle.getMessage(SelectConnectionPanel.class, "SelectConnectionPanel.dbconnLabel.text")); // NOI18N

    dbconnComboBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            dbconnComboBoxActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(dbconnLabel)
                .addComponent(dbconnComboBox, 0, 518, Short.MAX_VALUE))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(dbconnLabel)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(dbconnComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );

    dbconnComboBox.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(SelectConnectionPanel.class, "ChooseConnectionPanel.dbconnComboBox.AccessibleContext.accessibleName")); // NOI18N
    dbconnComboBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(SelectConnectionPanel.class, "ChooseConnectionPanel.dbconnComboBox.AccessibleContext.accessibleDescription")); // NOI18N
}
 
Example 29
Project: incubator-netbeans   File: CloseAllDocumentsAction.java   View source code 5 votes vote down vote up
/**
 * can decide whether to have label with mnemonics or without it.
 */
public CloseAllDocumentsAction(boolean isContext) {
    this.isContext = isContext;
    String key;
    if (isContext) {
        key = "LBL_CloseAllDocumentsAction"; //NOI18N
    } else {
        key = "CTL_CloseAllDocumentsAction"; //NOI18N
    }
    putValue(NAME, NbBundle.getMessage(CloseAllDocumentsAction.class, key));
}
 
Example 30
Project: incubator-netbeans   File: SOAPComponentVisitor.java   View source code 5 votes vote down vote up
public void visit(SOAPFault fault) {
    String name = fault.getName();
    if (name == null) {
        results.add(
                new Validator.ResultItem(mValidator,
                Validator.ResultType.ERROR,
                fault,
                NbBundle.getMessage(SOAPComponentVisitor.class, "SOAPFaultValidator.Missing_name")));
    }
    
    Collection<String> encodingStyles = fault.getEncodingStyles();
    if (encodingStyles != null) {
        // This is optional.  Don't verify contents at this point.
    }
    
    String namespace = fault.getNamespace();
    if (namespace != null) {
        // This is optional.  We should verify that it is a valid URI, but
        // I don't want to be too restrictive at this point.
    }
    
    try {
        SOAPMessageBase.Use use = fault.getUse();
    } catch (Throwable th) {
        results.add(
                new Validator.ResultItem(mValidator,
                Validator.ResultType.ERROR,
                fault,
                NbBundle.getMessage(SOAPComponentVisitor.class, "SOAPFaultValidator.Unsupported_use_attribute")));
    }
}
 
Example 31
Project: incubator-netbeans   File: EncapsulateFieldRefactoringPlugin.java   View source code 5 votes vote down vote up
private Problem fastCheckParameters(String getter, String setter,
        Set<Modifier> methodModifier, Set<Modifier> fieldModifier,
        boolean alwaysUseAccessors) {

    if ((getter != null && !Utilities.isJavaIdentifier(getter))
            || (setter != null && !Utilities.isJavaIdentifier(setter))
            || (getter == null && setter == null)) {
        // user doesn't use valid java identifier, it cannot be used
        // as getter/setter name
        return new Problem(true, NbBundle.getMessage(EncapsulateFieldRefactoringPlugin.class, "ERR_EncapsulateMethods"));
    } else {
        // we have no problem :-)
        return null;
    }
}
 
Example 32
Project: incubator-netbeans   File: DetectPanel.java   View source code 5 votes vote down vote up
private void checkValid () {
    this.wiz.putProperty( WizardDescriptor.PROP_ERROR_MESSAGE, ""); //NOI18N
    final String name = this.component.getPlatformName ();
    boolean vld;
    switch (detected.get()) {
        case INVALID:
            this.wiz.putProperty( WizardDescriptor.PROP_ERROR_MESSAGE,NbBundle.getMessage(DetectPanel.class,"ERROR_NoSDKRegistry"));         //NOI18N
            vld = false;
            break;
        case UNKNOWN:
            vld = false;
            break;
        case VALID:
            vld = true;
            break;
        case UNSUPPORTED:
            this.wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, NbBundle.getMessage(DetectPanel.class,"ERROR_UnsupportedPlatform", SourceLevelQuery.MINIMAL_SOURCE_LEVEL));         //NOI18N
            vld = false;
            break;
        default:
            throw new IllegalStateException();
    }
    if (vld && name.length() == 0) {
        vld = false;
        this.wiz.putProperty( WizardDescriptor.PROP_ERROR_MESSAGE,NbBundle.getMessage(DetectPanel.class,"ERROR_InvalidDisplayName"));    //NOI18N
    }
    if (vld) {
        for (JavaPlatform platform : JavaPlatformManager.getDefault().getInstalledPlatforms()) {
            if (name.equals (platform.getDisplayName())) {
                vld = false;
                this.wiz.putProperty( WizardDescriptor.PROP_ERROR_MESSAGE,NbBundle.getMessage(DetectPanel.class,"ERROR_UsedDisplayName"));    //NOI18N
                break;
            }
        }
    }
    setValid(vld);
}
 
Example 33
Project: incubator-netbeans   File: NodePopupFactory.java   View source code 5 votes vote down vote up
void addNoFilterItem(ETable et, JPopupMenu popup) {
    if (showQuickFilter && et.getQuickFilterColumn() != -1) {
        String s = NbBundle.getMessage(NodePopupFactory.class, "LBL_QuickFilter");
        JMenu menu = new JMenu(s);
        JMenuItem noFilterItem = et.getQuickFilterNoFilterItem(et.getQuickFilterFormatStrings()[6]);
        menu.add(noFilterItem);
        popup.add(menu);
    }
}
 
Example 34
Project: incubator-netbeans   File: ReplaceTask.java   View source code 5 votes vote down vote up
/**
 */
public ReplaceTask(List<MatchingObject> matchingObjects,
        BasicReplaceResultsPanel panel) {
    this.matchingObjects = matchingObjects;
    this.panel = panel;
    
    problems = new ArrayList<String>(4);
    progressHandle = ProgressHandleFactory.createHandle(
            NbBundle.getMessage(getClass(), "LBL_Replacing"));      //NOI18N
}
 
Example 35
Project: incubator-netbeans   File: GitUtils.java   View source code 5 votes vote down vote up
public static void printInfo (StringBuilder sb, GitRevisionInfo info, boolean endWithNewLine) {
    String lbrevision = NbBundle.getMessage(CommitAction.class, "MSG_CommitAction.logCommit.revision");   // NOI18N
    String lbauthor = NbBundle.getMessage(CommitAction.class, "MSG_CommitAction.logCommit.author");      // NOI18N
    String lbcommitter = NbBundle.getMessage(CommitAction.class, "MSG_CommitAction.logCommit.committer");      // NOI18N
    String lbdate = NbBundle.getMessage(CommitAction.class, "MSG_CommitAction.logCommit.date");        // NOI18N
    String lbsummary = NbBundle.getMessage(CommitAction.class, "MSG_CommitAction.logCommit.summary");     // NOI18N

    String author = info.getAuthor().toString();
    String committer = info.getCommitter().toString();
    sb.append(NbBundle.getMessage(CommitAction.class, "MSG_CommitAction.logCommit.title")).append("\n"); //NOI18N
    sb.append(lbrevision);
    sb.append(info.getRevision());
    sb.append('\n'); // NOI18N
    sb.append(lbauthor);
    sb.append(author);
    sb.append('\n'); // NOI18N
    if (!author.equals(committer)) {
        sb.append(lbcommitter);
        sb.append(committer);
        sb.append('\n'); // NOI18N
    }
    sb.append(lbdate);
    sb.append(DateFormat.getDateTimeInstance().format(new Date(info.getCommitTime())));
    sb.append('\n'); // NOI18N
    sb.append(lbsummary);
    int prefixLen = lbsummary.length();
    sb.append(formatMultiLine(prefixLen, info.getFullMessage()));
    if (endWithNewLine) {
        sb.append('\n');
    }
}
 
Example 36
Project: incubator-netbeans   File: Utilities.java   View source code 5 votes vote down vote up
private static String getFileObjectLocalizedName( FileObject fo ) {
    Object o = fo.getAttribute("SystemFileSystem.localizingBundle"); // NOI18N
    if ( o instanceof String ) {
        String bundleName = (String)o;
        try {
            ResourceBundle rb = NbBundle.getBundle(bundleName);            
            String localizedName = rb.getString(fo.getPath());                
            return localizedName;
        }
        catch(MissingResourceException ex ) {
            // Do nothing return file path;
        }
    }
    return fo.getPath();
}
 
Example 37
Project: incubator-netbeans   File: SpringRefactoringElement.java   View source code 5 votes vote down vote up
@Override
public String getDisplayText() {
    if (oldSimpleName != null) {
        return NbBundle.getMessage(JavaElementRefModification.class, "MSG_UpdateReference", oldSimpleName);
    } else {
        return NbBundle.getMessage(JavaElementRefModification.class, "MSG_Update");
    }
}
 
Example 38
Project: incubator-netbeans   File: NBLoginPanel.java   View source code 5 votes vote down vote up
private boolean showLogin() {
    DialogDescriptor descriptor = new DialogDescriptor (
            this,
            NbBundle.getMessage(NBLoginPanel.class, "LBL_LOGIN_2_NBORG"),   // NOI18N
            true,
            new Object[] {login, cancel},
            login,
            DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.bugzilla.api.NBLoginPanel"),  // NOI18N
            null);
    return DialogDisplayer.getDefault().notify(descriptor) == login;
}
 
Example 39
Project: incubator-netbeans   File: EditClusterPanel.java   View source code 5 votes vote down vote up
/**
 * Shows Edit Cluster dialog for existing external cluster.
 * Browse button is disabled, user can only change src and javadoc.
 *
 * @param ci Original cluster info 
 * @return Updated cluster info or null if user cancelled the dialog
 */
static ClusterInfo showEditDialog(ClusterInfo ci, Project prj) {
    EditClusterPanel panel = new EditClusterPanel();
    panel.prjDir = FileUtil.toFile(prj.getProjectDirectory());
    panel.prj = prj;
    SourceRootsSupport srs = new SourceRootsSupport(
            ci.getSourceRoots() == null ? new URL[0] : ci.getSourceRoots(), null);
    panel.sourcesPanel.setSourceRootsProvider(srs);
    JavadocRootsSupport jrs = new JavadocRootsSupport(
            ci.getJavadocRoots() == null ? new URL[0] : ci.getJavadocRoots(), null);
    panel.javadocPanel.setJavadocRootsProvider(jrs);
    DialogDescriptor descriptor = new DialogDescriptor(
            panel,
            NbBundle.getMessage(EditClusterPanel.class, "CTL_EditCluster_Title"), // NOI18N
            true,
            new Object[] { panel.okButton, NotifyDescriptor.CANCEL_OPTION },
            panel.okButton,
            DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditClusterPanel"),
            null);
    descriptor.setClosingOptions(null);
    Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
    panel.clusterDirText.setText(ci.getClusterDir().toString());
    panel.updateDialog();
    panel.browseButton.setEnabled(false);
    dlg.setVisible(true);
    ClusterInfo retVal = null;
    if (descriptor.getValue() == panel.okButton) {
        retVal = ClusterInfo.createExternal(panel.getAbsoluteClusterPath(), 
                srs.getSourceRoots(), jrs.getJavadocRoots(), true);
    }
    dlg.dispose();
    return retVal;
}
 
Example 40
Project: incubator-netbeans   File: AbstractSearchResultsPanel.java   View source code 5 votes vote down vote up
/**
 * Set btnStopRefresh to show refresh icon.
 */
protected void showRefreshButton() {
    btnStopRefresh.setToolTipText(UiUtils.getText(
            "TEXT_BUTTON_CUSTOMIZE"));                              //NOI18N
    btnStopRefresh.setIcon(
            ImageUtilities.loadImageIcon(REFRESH_ICON, true));
    btnStopRefresh.getAccessibleContext().setAccessibleDescription(
            NbBundle.getMessage(ResultView.class,
            "ACS_TEXT_BUTTON_CUSTOMIZE"));                          //NOI18N
    btnStopRefreshInRefreshMode = true;
}