本文整理汇总了Java中org.openide.NotifyDescriptor.Message类的典型用法代码示例。如果您正苦于以下问题:Java Message类的具体用法?Java Message怎么用?Java Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Message类属于org.openide.NotifyDescriptor包,在下文中一共展示了Message类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findMatches
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
private List<InputNode> findMatches(String name, String value, InputGraph inputGraph, SearchResponse response) {
try {
RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE);
Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<>(inputGraph.getNodes());
List<InputNode> matches = selector.selectMultiple(matcher);
return matches.size() == 0 ? null : matches;
} catch (Exception e) {
final String msg = e.getMessage();
response.addResult(new Runnable() {
@Override
public void run() {
Message desc = new NotifyDescriptor.Message("An exception occurred during the search, "
+ "perhaps due to a malformed query string:\n" + msg,
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(desc);
}
},
"(Error during search)"
);
}
return null;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:NodeQuickSearch.java
示例2: jButton1ActionPerformed
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(AndroidSdkTool.class);
builder.setTitle("Please select Android SDK Folder");
builder.setDirectoriesOnly(true);
File file = builder.showOpenDialog();
if (file != null) {
FileObject folder = FileUtil.toFileObject(file);
if (folder.getFileObject("tools") == null) {
Message msg = new NotifyDescriptor.Message(
"Not a valid SDK folder!",
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
} else {
String name = file.getPath();
jTextField1.setText(name);
}
}
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:20,代码来源:MobilePanel.java
示例3: copyToClipboard
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
/**
* Joins a list of strings using a separator and copies the result to the
* system clipboard.
*
* @param resultList
* @param endOfLineSeparator
*/
public void copyToClipboard(final java.util.List<java.lang.String> resultList, String endOfLineSeparator) {
if (null != resultList && !resultList.isEmpty()) {
// copy collected fqns to clipboard
String text = StringUtils.join(resultList, endOfLineSeparator);
int size = resultList.size();
StringSelection content = new StringSelection(text);
if (size >= 2) {
StatusDisplayer.getDefault().setStatusText("Copied " + size + " fully qualified names to clipboard");
} else {
StatusDisplayer.getDefault().setStatusText("Copied '" + text + "' to clipboard");
}
clipboard.setContents(content, null);
} else {
// if (null == fqn || "".equals(fqn)) {
Message message = new NotifyDescriptor.Message("No fully qualified name for selected element found.");
DialogDisplayer.getDefault().notify(message);
// }
}
}
开发者ID:markiewb,项目名称:nb-copy-fqn,代码行数:28,代码来源:Clipboard.java
示例4: handleError
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
@Override
public void handleError(String msg, Throwable t) {
progressHandle.finish();
if (msg == null) {
return;
}
if (!started) {
SceneViewerTopComponent.showOpenGLError(msg);
Exceptions.printStackTrace(t);
} else {
if (lastError != null && !lastError.equals(msg)) {
Message mesg = new NotifyDescriptor.Message(
"Error in scene!\n"
+ "(" + t + ")",
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notifyLater(mesg);
Exceptions.printStackTrace(t);
lastError = msg;
}
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:22,代码来源:SceneApplication.java
示例5: notifyOutOfContext
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
private static void notifyOutOfContext(String refactoringNameKey, Lookup context) {
for (Node node : context.lookupAll(Node.class)) {
for (FileObject file : node.getLookup().lookupAll(FileObject.class)) {
if (!isFileInOpenProject(file)) {
DialogDisplayer.getDefault().notify(new Message(
NbBundle.getMessage(CopyAction.class, "ERR_ProjectNotOpened", file.getNameExt())));
return;
}
}
}
String refactoringName = NbBundle.getMessage(CopyAction.class, refactoringNameKey);
DialogDisplayer.getDefault().notify(new Message(
NbBundle.getMessage(CopyAction.class, "MSG_CantApplyRefactoring", refactoringName)));
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ActionsImplementationFactory.java
示例6: annotationsAvailable
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
@Messages("ActionRegistrationHinter.missing_org.openide.awt=You must add a dependency on org.openide.awt (7.27+) before using this fix.")
private boolean annotationsAvailable(Context ctx) {
if (ctx.canAccess("org.openide.awt.ActionReferences")) {
return true;
} else {
DialogDisplayer.getDefault().notify(new Message(ActionRegistrationHinter_missing_org_openide_awt(), NotifyDescriptor.WARNING_MESSAGE));
return false;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ActionRegistrationHinter.java
示例7: dropNotSuccesfull
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
/** Notifies user that the drop was not succesfull. */
static void dropNotSuccesfull() {
DialogDisplayer.getDefault().notify(
new Message(
NbBundle.getMessage(TreeViewDropSupport.class, "MSG_NoPasteTypes"),
NotifyDescriptor.WARNING_MESSAGE
)
);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:DragDropUtilities.java
示例8: duplicateProfile
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
private String duplicateProfile() {
String newName = null;
InputLine il = new InputLine(
KeymapPanel.loc("CTL_Create_New_Profile_Message"), // NOI18N
KeymapPanel.loc("CTL_Create_New_Profile_Title") // NOI18N
);
String profileToDuplicate =(String) profilesList.getSelectedValue();
il.setInputText(profileToDuplicate);
DialogDisplayer.getDefault().notify(il);
if (il.getValue() == NotifyDescriptor.OK_OPTION) {
newName = il.getInputText();
for (String s : getKeymapPanel().getMutableModel().getProfiles()) {
if (newName.equals(s)) {
Message md = new Message(
KeymapPanel.loc("CTL_Duplicate_Profile_Name"), // NOI18N
Message.ERROR_MESSAGE);
DialogDisplayer.getDefault().notify(md);
return null;
}
}
MutableShortcutsModel currentModel = getKeymapPanel().getMutableModel();
String currrentProfile = currentModel.getCurrentProfile();
getKeymapPanel().getMutableModel().setCurrentProfile(profileToDuplicate);
getKeymapPanel().getMutableModel().cloneProfile(newName);
currentModel.setCurrentProfile(currrentProfile);
model.addItem(newName);
profilesList.setSelectedValue(il.getInputText(), true);
}
return newName;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:ProfilesPanel.java
示例9: actionPerformed
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
@NbBundle.Messages({
"# {0} - error message",
"ERR_RunPlatformShell=Error starting Java Shell: {0}"
})
@Override
public void actionPerformed(ActionEvent e) {
JavaPlatform platform = options.getSelectedPlatform();
if (platform == null) {
NotifyDescriptor.Confirmation conf = new NotifyDescriptor.Confirmation(
Bundle.ERR_NoShellPlatform(), NotifyDescriptor.Confirmation.OK_CANCEL_OPTION
);
Object result = DialogDisplayer.getDefault().notify(conf);
if (result == NotifyDescriptor.Confirmation.OK_OPTION) {
OptionsDisplayer.getDefault().open("Java/JShell", true);
}
platform = options.getSelectedPlatform();
if (platform == null) {
return;
}
}
try {
JShellEnvironment env = ShellRegistry.get().openDefaultSession(platform);
env.open();
} catch (IOException ex) {
Message msg = new Message(Bundle.ERR_RunPlatformShell(ex.getLocalizedMessage()), Message.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:PlatformShellAction.java
示例10: actionPerformed
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
public void actionPerformed (ActionEvent e) {
if (!listen) return;
if (e.getSource () == bDuplicate) {
InputLine il = new InputLine (
loc ("CTL_Create_New_Profile_Message"), // NOI18N
loc ("CTL_Create_New_Profile_Title") // NOI18N
);
il.setInputText (currentProfile);
DialogDisplayer.getDefault ().notify (il);
if (il.getValue () == NotifyDescriptor.OK_OPTION) {
String newScheme = il.getInputText ();
for (int i = 0; i < cbProfile.getItemCount(); i++)
if (newScheme.equals (cbProfile.getItemAt(i))) {
Message md = new Message (
loc ("CTL_Duplicate_Profile_Name"), // NOI18N
Message.ERROR_MESSAGE
);
DialogDisplayer.getDefault ().notify (md);
return;
}
setCurrentProfile (newScheme);
listen = false;
cbProfile.addItem (il.getInputText ());
cbProfile.setSelectedItem (il.getInputText ());
listen = true;
}
return;
}
if (e.getSource () == bDelete) {
deleteCurrentProfile ();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:FontAndColorsPanel.java
示例11: getSdkPath
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
/**
* Returns a String with the path to the SDK or null if none is specified.
* @return
*/
public static String getSdkPath() {
String path = NbPreferences.forModule(AndroidSdkTool.class).get("sdk_path", null);
if (path == null) {
FileChooserBuilder builder = new FileChooserBuilder(AndroidSdkTool.class);
builder.setTitle("Please select Android SDK Folder");
builder.setDirectoriesOnly(true);
File file = builder.showOpenDialog();
if (file != null) {
FileObject folder = FileUtil.toFileObject(file);
if (folder.getFileObject("tools") == null) {
Message msg = new NotifyDescriptor.Message(
"Not a valid SDK folder!",
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
} else {
String name = file.getPath();
NbPreferences.forModule(AndroidSdkTool.class).put("sdk_path", name);
return name;
}
}
} else {
return path;
}
return null;
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:31,代码来源:AndroidSdkTool.java
示例12: getSdkPath
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
/**
* Returns a String with the path to the SDK or null if none is specified.
* @return
*/
public static String getSdkPath() {
String path = NbPreferences.forModule(AndroidSdkTool.class).get("sdk_path", null);
if (path == null) {
FileChooserBuilder builder = new FileChooserBuilder(AndroidSdkTool.class);
builder.setTitle("Please select Android SDK Folder");
builder.setDirectoriesOnly(true);
File file = builder.showOpenDialog();
if (file != null) {
FileObject folder = FileUtil.toFileObject(file);
if (folder.getFileObject("tools") == null) {
Message msg = new NotifyDescriptor.Message(
"Not a valid SDK folder!",
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
} else {
String name = file.getPath();
NbPreferences.forModule(AndroidSdkTool.class).put("sdk_path", name);
return name;
}
}
} else {
return path;
}
return null;
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:31,代码来源:AndroidSdkTool.java
示例13: showOpenGLError
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
public static void showOpenGLError(String e) {
Message msg = new NotifyDescriptor.Message(
"Error opening OpenGL window!\n"
+ "Error: " + e,
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:8,代码来源:SceneViewerTopComponent.java
示例14: findAndModifyDeclaration
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
/**
* Tries to find the Java declaration of an instance attribute, and if successful, runs a task to modify it.
* @param instanceAttribute the result of {@link FileObject#getAttribute} on a {@code literal:*} key (or {@link #instanceAttribute})
* @param task a task to run (may modify Java sources and layer objects; all will be saved for you)
* @throws IOException in case of problem (will instead show a message and return early if the type could not be found)
*/
@Messages({
"# {0} - layer attribute", "Hinter.missing_instance_class=Could not find Java source corresponding to {0}.",
"Hinter.do_not_edit_layer=Do not edit layer.xml until the hint has had a chance to run."
})
public void findAndModifyDeclaration(@NullAllowed final Object instanceAttribute, final ModifyDeclarationTask task) throws IOException {
FileObject java = findDeclaringSource(instanceAttribute);
if (java == null) {
DialogDisplayer.getDefault().notify(new Message(Hinter_missing_instance_class(instanceAttribute), NotifyDescriptor.WARNING_MESSAGE));
return;
}
JavaSource js = JavaSource.forFileObject(java);
if (js == null) {
throw new IOException("No source info for " + java);
}
js.runModificationTask(new Task<WorkingCopy>() {
public @Override void run(WorkingCopy wc) throws Exception {
wc.toPhase(JavaSource.Phase.RESOLVED);
if (DataObject.find(layer.getLayerFile()).isModified()) { // #207077
DialogDisplayer.getDefault().notify(new Message(Hinter_do_not_edit_layer(), NotifyDescriptor.WARNING_MESSAGE));
return;
}
Element decl = findDeclaration(wc, instanceAttribute);
if (decl == null) {
DialogDisplayer.getDefault().notify(new Message(Hinter_missing_instance_class(instanceAttribute), NotifyDescriptor.WARNING_MESSAGE));
return;
}
ModifiersTree mods;
if (decl.getKind() == ElementKind.CLASS) {
mods = wc.getTrees().getTree((TypeElement) decl).getModifiers();
} else {
mods = wc.getTrees().getTree((ExecutableElement) decl).getModifiers();
}
task.run(wc, decl, mods);
saveLayer();
}
}).commit();
SaveCookie sc = DataObject.find(java).getLookup().lookup(SaveCookie.class);
if (sc != null) {
sc.save();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:48,代码来源:Hinter.java
示例15: performAction
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
/** Actually performs action. */
public void performAction () {
final Dialog[] dialogs = new Dialog[1];
final CustomZoomPanel zoomPanel = new CustomZoomPanel();
zoomPanel.setEnlargeFactor(1);
zoomPanel.setDecreaseFactor(1);
DialogDescriptor dd = new DialogDescriptor(
zoomPanel,
NbBundle.getBundle(CustomZoomAction.class).getString("LBL_CustomZoomAction"),
true,
DialogDescriptor.OK_CANCEL_OPTION,
DialogDescriptor.OK_OPTION,
new ActionListener() {
public void actionPerformed(ActionEvent ev) {
if (ev.getSource() == DialogDescriptor.OK_OPTION) {
int enlargeFactor = 1, decreaseFactor = 1;
try {
enlargeFactor = zoomPanel.getEnlargeFactor();
decreaseFactor = zoomPanel.getDecreaseFactor();
} catch (NumberFormatException nfe) {
notifyInvalidInput();
return;
}
// Invalid values.
if(enlargeFactor == 0 || decreaseFactor == 0) {
notifyInvalidInput();
return;
}
performZoom(enlargeFactor, decreaseFactor);
dialogs[0].setVisible(false);
dialogs[0].dispose();
} else {
dialogs[0].setVisible(false);
dialogs[0].dispose();
}
}
private void notifyInvalidInput() {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
NbBundle.getBundle(CustomZoomAction.class).getString("MSG_InvalidValues"),
NotifyDescriptor.ERROR_MESSAGE
));
}
} // End of annonymnous ActionListener.
);
dialogs[0] = DialogDisplayer.getDefault().createDialog(dd);
dialogs[0].setVisible(true);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:57,代码来源:CustomZoomAction.java
示例16: showError
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
private void showError(String e) {
Message msg = new NotifyDescriptor.Message(
e,
NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg);
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:7,代码来源:ImportWorldForgeAction.java
示例17: displayInfo
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
public void displayInfo(String info) {
Message msg = new NotifyDescriptor.Message(info);
DialogDisplayer.getDefault().notifyLater(msg);
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:5,代码来源:SceneEditorController.java
示例18: genOpenedHook
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
private ProjectOpenedHook genOpenedHook(final Project context) {
return new ProjectOpenedHook() {
@Override
protected void projectClosed() {
}
@Override
protected void projectOpened() {
if (context instanceof J2SEProject) {
EditableProperties properties = getProperties(context);
if (properties.getProperty("assets.folder.name") != null) {
manager.checkExtension(context);
String version = properties.getProperty("jme.project.version");
String projectName = ProjectUtils.getInformation(context).getDisplayName();
if (version == null) {
if (UpgradeProjectWizardAction.isJME31(context)) { /* Upgrade project.properties */
logger.log(Level.WARNING, "[" + projectName + "] Found 3.1 project, upgrading project.properties");
FileObject prProp = context.getProjectDirectory().getFileObject("nbproject/project.properties");
if (prProp != null && prProp.isValid()) {
FileLock lock = null;
try {
lock = prProp.lock();
InputStream in = prProp.getInputStream();
EditableProperties edProps = new EditableProperties(true);
edProps.load(in);
in.close();
edProps.setProperty("jme.project.version", "3.1"); // Silently accept them.
OutputStream out = prProp.getOutputStream(lock);
edProps.store(out);
out.close();
} catch (Exception e) {
logger.log(Level.WARNING, "Error when trying to write project.properties. Exception: {0}", e.getMessage());
} finally {
if (lock != null) {
lock.releaseLock();
}
}
}
} else {
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message("The project \"" + projectName + "\" is not compatible with the current SDK.\nIt has to be updated before you can use it.\nRight Click on the Project and select \"Upgrade Project\" (You can choose to keep 3.0 compatibility!)", Message.ERROR_MESSAGE));
}
}
}
}
}
};
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:52,代码来源:AssetsLookupProvider.java
示例19: requestFileAndSave
import org.openide.NotifyDescriptor.Message; //导入依赖的package包/类
private void requestFileAndSave() {
FileChooserBuilder builder = new FileChooserBuilder(ImageEditorComponent.class);
builder.addFileFilter(FileFilters.JPG);
builder.addFileFilter(FileFilters.TGA);
builder.addFileFilter(FileFilters.PNG);
JFileChooser fc = builder.createFileChooser();
fc.setFileSelectionMode(JFileChooser.SAVE_DIALOG);
fc.setAcceptAllFileFilterUsed(false);
int a = fc.showOpenDialog(COMPONENT);
if (a == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
String name = file.getName().toLowerCase();
String type;
if (name.endsWith(".png")) {
type = "png";
} else if (name.endsWith(".jpg") || name.endsWith(".jpeg")) {
type = "jpg";
} else if (name.endsWith(".bmp")) {
type = "bmp";
} else if (name.endsWith(".tga")) {
type = "tga";
} else {
ExtensionFileFilter filter = (ExtensionFileFilter) fc.getFileFilter();
file = new File(file.getParentFile(), file.getName() + filter.getExtension());
type = filter.getExtension().substring(1);
}
if (file.exists()) {
a = JOptionPane.showConfirmDialog(COMPONENT, "Overwrite existing file?", "Confirm", JOptionPane.YES_NO_OPTION);
if (a != JOptionPane.YES_OPTION) {
return;
}
}
try {
IOModule.create().store(editedImage, type, file);
Message msg = new NotifyDescriptor.Message("Image saved.");
DialogDisplayer.getDefault().notify(msg);
editedFile = FileUtil.toFileObject(file);
newFile = false;
owner.setName("PixelHead - " + editedFile.getName());
disableSaving();
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
}
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:51,代码来源:ImageEditorComponent.java
注:本文中的org.openide.NotifyDescriptor.Message类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论