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


Java Message类代码示例

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


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


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