当前位置: 首页>>代码示例>>Java>>正文


Java NbBundle类代码示例

本文整理汇总了Java中org.openide.util.NbBundle的典型用法代码示例。如果您正苦于以下问题:Java NbBundle类的具体用法?Java NbBundle怎么用?Java NbBundle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NbBundle类属于org.openide.util包,在下文中一共展示了NbBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

import org.openide.util.NbBundle; //导入依赖的package包/类
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"));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TimestampType.java

示例2: performContextAction

import org.openide.util.NbBundle; //导入依赖的package包/类
@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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:DiffAction.java

示例3: getFormatedDate

import org.openide.util.NbBundle; //导入依赖的package包/类
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());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:Utils.java

示例4: selectPatchContext

import org.openide.util.NbBundle; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:IDEServicesImpl.java

示例5: setValue

import org.openide.util.NbBundle; //导入依赖的package包/类
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()));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:JPDAWatchImpl.java

示例6: createCommand

import org.openide.util.NbBundle; //导入依赖的package包/类
/** 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:Specification.java

示例7: doActivate

import org.openide.util.NbBundle; //导入依赖的package包/类
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();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DerbyActivator.java

示例8: fastCheckParameters

import org.openide.util.NbBundle; //导入依赖的package包/类
@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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ExtractInterfaceRefactoringPlugin.java

示例9: getMessageKey

import org.openide.util.NbBundle; //导入依赖的package包/类
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);

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:CssHintsProvider.java

示例10: onExportFilenameBrowseClick

import org.openide.util.NbBundle; //导入依赖的package包/类
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());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:MercurialOptionsPanelController.java

示例11: assignmentToForLoopParam

import org.openide.util.NbBundle; //导入依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:AssignmentIssues.java

示例12: showCustomizer

import org.openide.util.NbBundle; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:25,代码来源:SdksCustomizer.java

示例13: saveAs

import org.openide.util.NbBundle; //导入依赖的package包/类
/**
 * 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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:OutputTab.java

示例14: getRootLocalFolder

import org.openide.util.NbBundle; //导入依赖的package包/类
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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:PersistenceManager.java

示例15: implementInTransaction

import org.openide.util.NbBundle; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:PomModelUtils.java


注:本文中的org.openide.util.NbBundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。