本文整理匯總了Java中org.openide.util.NbBundle.Messages類的典型用法代碼示例。如果您正苦於以下問題:Java Messages類的具體用法?Java Messages怎麽用?Java Messages使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Messages類屬於org.openide.util.NbBundle包,在下文中一共展示了Messages類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages({
"CosChecker.no_test_cos.title=Not using Compile on Save",
"CosChecker.no_test_cos.details=Compile on Save mode can speed up single test execution for many projects."
})
static void warnNoTestCoS(RunConfig config) {
if (warnedNoCoS) {
return;
}
final Project project = config.getProject();
if (project == null) {
return;
}
final Notification n = NotificationDisplayer.getDefault().notify(CosChecker_no_test_cos_title(), ImageUtilities.loadImageIcon(SUGGESTION, true), CosChecker_no_test_cos_details(), new ActionListener() {
@Override public void actionPerformed(ActionEvent e) {
showCompilePanel(project);
}
}, NotificationDisplayer.Priority.LOW);
RequestProcessor.getDefault().post(new Runnable() {
@Override public void run() {
n.clear();
}
}, 15 * 1000);
warnedNoCoS = true;
}
示例2: getDisplayName
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Override
@Messages("LBL_Site_Pages=Project Site")
public String getDisplayName() {
if (isTopLevelNode) {
String s = LBL_Site_Pages();
DataObject dob = getOriginal().getLookup().lookup(DataObject.class);
FileObject file = dob.getPrimaryFile();
try {
s = file.getFileSystem().getDecorator().annotateName(s, Collections.singleton(file));
} catch (FileStateInvalidException e) {
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
}
return s;
}
return getOriginal().getDisplayName();
}
示例3: notifyWarning
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages({"writePermission=You don't have permission to install JUnit Library into the installation directory which is recommended.",
"showDetails=Show details"})
private static void notifyWarning(final OperationContainer<InstallSupport> oc, final UpdateElement jUnitElement, final UpdateUnit jUnitLib) {
// lack of privileges for writing
ActionListener onMouseClickAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Runnable r = new Runnable() {
@Override
public void run() {
try {
install(oc, jUnitElement, jUnitLib, true);
} catch (OperationException ex) {
LOG.log(Level.INFO, "While installing " + jUnitLib + " thrown " + ex, ex);
}
}
};
showWritePermissionDialog(r);
}
};
String title = writePermission();
String description = showDetails();
NotificationDisplayer.getDefault().notify(title,
ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/pluginimporter/resources/warning.gif", false), // NOI18N
description, onMouseClickAction, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING);
}
示例4: work
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages({"# {0} - server label", "# {1} - job name", "search_response=Hudson job {1} on {0}"})
private void work(String text, SearchResponse response) {
for (final HudsonInstance instance : HudsonManager.getAllInstances()) {
for (HudsonJob job : instance.getJobs()) {
final String name = job.getName();
// XXX could also search for text in instance name, and/or Maven modules
if (name.toLowerCase(Locale.ENGLISH).contains(text.toLowerCase(Locale.ENGLISH))) {
if (!response.addResult(new Runnable() {
@Override public void run() {
UI.selectNode(instance.getUrl(), name);
}
}, Bundle.search_response(instance.getName(), name))) {
return;
}
}
}
}
}
示例5: showCustomizer
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
/**
* Shows libraries customizer displaying all currently open library managers.
* @return true if user pressed OK and libraries were sucessfully modified
*/
@Messages("TXT_LibrariesManager=Ant Library Manager")
private static boolean showCustomizer () {
AllLibrariesCustomizer customizer =
new AllLibrariesCustomizer();
DialogDescriptor descriptor = new DialogDescriptor(customizer, TXT_LibrariesManager());
Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
try {
dlg.setVisible(true);
if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
return customizer.apply();
} else {
return false;
}
} finally {
dlg.dispose();
}
}
示例6: ConfirmationPanel
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages({
"LBL_FormattingQuestion=Recursively format the selected files and folders?",
"LBL_FormattingInProgress=Formatting:"
})
public ConfirmationPanel(ProgressHandle handle) {
initComponents();
setLayout(new CardLayout());
add(new JLabel(Bundle.LBL_FormattingQuestion()), PANEL_QUESTION);
JPanel progress = new JPanel(new BorderLayout());
JLabel inProgressLabel = new JLabel(Bundle.LBL_FormattingInProgress());
inProgressLabel.setBorder(new EmptyBorder(0, 0, 6, 0));
progress.add(inProgressLabel, BorderLayout.NORTH);
progress.add(ProgressHandleFactory.createProgressComponent(handle), BorderLayout.CENTER);
add(progress, PANEL_PROGRESS);
((CardLayout) getLayout()).show(this, PANEL_QUESTION);
}
示例7: lambda2Class
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Hint(displayName="#DN_lambda2Class", description="#DESC_lambda2Class", category="suggestions", hintKind=Hint.Kind.ACTION,
minSourceVersion = "8")
@Messages({
"DN_lambda2Class=Convert Lambda Expression to Anonymous Innerclass",
"DESC_lambda2Class=Converts lambda expressions to anonymous inner classes",
"ERR_lambda2Class=Anonymous class can be used"
})
@TriggerTreeKind(Kind.LAMBDA_EXPRESSION)
public static ErrorDescription lambda2Class(HintContext ctx) {
TypeMirror samType = ctx.getInfo().getTrees().getTypeMirror(ctx.getPath());
if (samType == null || samType.getKind() != TypeKind.DECLARED) {
return null;
}
return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), Bundle.ERR_lambda2Class(), new Lambda2Anonymous(ctx.getInfo(), ctx.getPath()).toEditorFix());
}
示例8: computeSize
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages({
"# {0} - number of bytes",
"TXT_Bytes={0} bytes",
"# {0} - number of kilo bytes",
"TXT_kb={0} kb",
"# {0} - number of mega bytes",
"TXT_Mb={0} Mb"
})
private String computeSize(long size) {
long kbytes = size / 1024;
if (kbytes == 0) {
return TXT_Bytes(size);
}
long mbytes = kbytes / 1024;
if (mbytes == 0) {
return TXT_kb(kbytes);
}
return TXT_Mb(mbytes);
}
示例9: getListCellRendererComponent
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages({"LBL_RunAllAnalyzers=All Analyzers", "# {0} - the analyzer that should be run", "LBL_RunAnalyzer={0}"})
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value == null) {
value = Bundle.LBL_RunAllAnalyzers();
} else if (value instanceof AnalyzerFactory) {
value = Bundle.LBL_RunAnalyzer(SPIAccessor.ACCESSOR.getAnalyzerDisplayName((AnalyzerFactory) value));
} else if (value instanceof Configuration) {
value = ((Configuration) value).getDisplayName();
} else if (value instanceof String) {
setFont(getFont().deriveFont(Font.ITALIC));
setText((String) value);
setEnabled(false);
setBackground(list.getBackground());
setForeground(UIManager.getColor("Label.disabledForeground"));
return this;
}
if (index == list.getModel().getSize()-5 && list.getModel() instanceof ConfigurationsComboModel && ((ConfigurationsComboModel) list.getModel()).canModify()) {
setBorder(new Separator(list.getForeground()));
} else {
setBorder(null);
}
return super.getListCellRendererComponent(list, (indent ? " " : "") + value, index, isSelected, cellHasFocus);
}
示例10: actionPerformed
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages({"# {0} - module display name", "CTL_EditModuleDependencyTitle=Edit \"{0}\" Dependency"})
public @Override void actionPerformed(ActionEvent ev) {
final EditTestDependencyPanel editTestPanel = new EditTestDependencyPanel(testDep);
DialogDescriptor descriptor = new DialogDescriptor(editTestPanel,
CTL_EditModuleDependencyTitle(testDep.getModule().getLocalizedName()));
descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditTestDependencyPanel"));
Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
d.setVisible(true);
if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
TestModuleDependency editedDep = editTestPanel.getEditedDependency();
try {
ProjectXMLManager pxm = new ProjectXMLManager(project);
pxm.removeTestDependency(testType, testDep.getModule().getCodeNameBase());
pxm.addTestDependency(testType, editedDep);
ProjectManager.getDefault().saveProject(project);
} catch (IOException e) {
Exceptions.attachMessage(e, "Cannot store dependency: " + editedDep); // NOI18N
Exceptions.printStackTrace(e);
}
}
d.dispose();
}
示例11: editModuleDependency
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages("CTL_EditModuleDependencyTitle=Edit Module Dependency")
private void editModuleDependency(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editModuleDependency
ModuleDependency origDep = getDepListModel().getDependency(
dependencyList.getSelectedIndex());
EditDependencyPanel editPanel = new EditDependencyPanel(
origDep, getProperties().getActivePlatform());
DialogDescriptor descriptor = new DialogDescriptor(editPanel,
CTL_EditModuleDependencyTitle());
descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditDependencyPanel"));
Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
d.setVisible(true);
if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
getDepListModel().editDependency(origDep, editPanel.getEditedDependency());
}
d.dispose();
dependencyList.requestFocusInWindow();
}
示例12: package
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages("MSG_PublicPackagesAddedFmt=Exported {0} public package(s).\nList of public packages can be further customized on \"API Versioning\" tab.")
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed
int[] selectedIndices = emListComp.getSelectedIndices();
List<File> jars = new ArrayList<File>();
DefaultListModel listModel = getProperties().getWrappedJarsListModel();
for (int i : selectedIndices) {
Item item = (Item) listModel.getElementAt(i);
if (item.getType() == Item.TYPE_JAR) {
jars.add(item.getResolvedFile());
}
}
if (jars.size() > 0) {
int dif = getProperties().exportPackagesFromJars(jars);
NotifyDescriptor.Message msg = new NotifyDescriptor.Message(
MSG_PublicPackagesAddedFmt(dif));
DialogDisplayer.getDefault().notify(msg);
for (File jar : jars) {
isJarExportedMap.put(jar, Boolean.TRUE);
}
}
exportButton.setEnabled(false);
}
示例13: browseActionPerformed
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages("LBL_Browse=Browse Inspections")
private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed
Object selectedInspection = inspectionCombo.getSelectedItem();
AnalyzerFactory analyzerToSelect;
String warningToSelect;
if (selectedInspection instanceof AnalyzerAndWarning) {
analyzerToSelect = ((AnalyzerAndWarning) selectedInspection).analyzer;
warningToSelect = SPIAccessor.ACCESSOR.getWarningId(((AnalyzerAndWarning) selectedInspection).wd);
} else {
analyzerToSelect = null;
warningToSelect = "";
}
AdjustConfigurationPanel panel = showConfigurationPanel(analyzerToSelect, warningToSelect, null);
if (panel != null) {
inspectionCombo.setSelectedItem(warningId2Description.get(panel.getIdToRun()));
}
}
示例14: canRunNoLock
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
/**
* Checks if a given command can be run at the moment from the perspective of the test userdir lock file.
* Cf. #63652, #72397, #141069, #207530.
* @param command as in {@link ActionProvider}
* @param lock from {@link NbModuleProject#getTestUserDirLockFile} or {@link SuiteProject#getTestUserDirLockFile}
* @return true if the command is unrelated, there is no lock file, or the lock file is stale and can be safely deleted;
* false (after showing a warning dialog) if the command must not proceed
*/
@Messages({
"ERR_module_already_running=The application is already running within the test user directory. You must shut it down before trying to run it again.",
"ERR_ModuleIsBeingRun=Cannot copy/move/rename/delete a module or suite while the application is running; shut it down first."
})
static boolean canRunNoLock(String command, File lock) {
if (command.equals(ActionProvider.COMMAND_RUN) ||
command.equals(ActionProvider.COMMAND_DEBUG) ||
command.equals(ActionProvider.COMMAND_PROFILE)) {
if (isLocked(lock)) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(ERR_module_already_running()));
return false;
}
} else if (ActionProvider.COMMAND_DELETE.equals(command) ||
ActionProvider.COMMAND_RENAME.equals(command) ||
ActionProvider.COMMAND_MOVE.equals(command) ||
ActionProvider.COMMAND_COPY.equals(command)) {
if (isLocked(lock)) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(ERR_ModuleIsBeingRun()));
return false;
}
}
return true;
}
示例15: promptForPublicPackagesToDocument
import org.openide.util.NbBundle.Messages; //導入依賴的package包/類
@Messages({
"TITLE_javadoc_disabled=No Public Packages",
"ERR_javadoc_disabled=<html>Javadoc cannot be produced for this module.<br>It is not yet configured to export any packages to other modules.",
"LBL_configure_pubpkg=Configure Public Packages..."
})
private void promptForPublicPackagesToDocument() {
// #61372: warn the user, rather than disabling the action.
if (ApisupportAntUIUtils.showAcceptCancelDialog(
TITLE_javadoc_disabled(),
ERR_javadoc_disabled(),
LBL_configure_pubpkg(),
null,
NotifyDescriptor.WARNING_MESSAGE)) {
CustomizerProviderImpl cpi = project.getLookup().lookup(CustomizerProviderImpl.class);
cpi.showCustomizer(CustomizerProviderImpl.CATEGORY_VERSIONING, CustomizerProviderImpl.SUBCATEGORY_VERSIONING_PUBLIC_PACKAGES);
}
}