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


Java ErrorManager.notify方法代码示例

本文整理汇总了Java中org.openide.ErrorManager.notify方法的典型用法代码示例。如果您正苦于以下问题:Java ErrorManager.notify方法的具体用法?Java ErrorManager.notify怎么用?Java ErrorManager.notify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.ErrorManager的用法示例。


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

示例1: setFiles

import org.openide.ErrorManager; //导入方法依赖的package包/类
protected final void setFiles(final Set<FileObject> files) {
    fileSystemListeners = new HashSet<FileStatusListener>();
    this.files = files;
    if (files == null) {
        return;
    }
    Set<FileSystem> hookedFileSystems = new HashSet<FileSystem>();
    for (FileObject fo: files) {
        try {
            FileSystem fs = fo.getFileSystem();
            if (hookedFileSystems.contains(fs)) {
                continue;
            }
            hookedFileSystems.add(fs);
            FileStatusListener fsl = FileUtil.weakFileStatusListener(this, fs);
            fs.addFileStatusListener(fsl);
            fileSystemListeners.add(fsl);
        } catch (FileStateInvalidException e) {
            ErrorManager err = ErrorManager.getDefault();
            err.annotate(e, "Cannot get " + fo + " filesystem, ignoring...");  // NOI18N
            err.notify(ErrorManager.INFORMATIONAL, e);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:AnnotatedNode.java

示例2: setFiles

import org.openide.ErrorManager; //导入方法依赖的package包/类
protected final void setFiles(final Set<FileObject> files) {
    fileSystemListeners = new HashSet<FileStatusListener>();
    this.files = files;
    if (files == null) {
        return;
    }
    Iterator<FileObject> it = files.iterator();
    Set<FileSystem> hookedFileSystems = new HashSet<FileSystem>();
    while (it.hasNext()) {
        FileObject fo = it.next();
        try {
            FileSystem fs = fo.getFileSystem();
            if (hookedFileSystems.contains(fs)) {
                continue;
            }
            hookedFileSystems.add(fs);
            FileStatusListener fsl = FileUtil.weakFileStatusListener(this, fs);
            fs.addFileStatusListener(fsl);
            fileSystemListeners.add(fsl);
        } catch (FileStateInvalidException e) {
            ErrorManager err = ErrorManager.getDefault();
            err.annotate(e, "Cannot get " + fo + " filesystem, ignoring...");  // NOI18N
            err.notify(ErrorManager.INFORMATIONAL, e);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AnnotatedNode.java

示例3: save

import org.openide.ErrorManager; //导入方法依赖的package包/类
/** Tries to save given data object using its save cookie.
 * Notifies user if excetions appear.
 */
private void save (DataObject dataObject) {
    try {
        SaveCookie sc = dataObject.getLookup().lookup(SaveCookie.class);
        if (sc != null) {
            sc.save();
        }
        listModel.removeElement(dataObject);
    } catch (IOException exc) {
        ErrorManager em = ErrorManager.getDefault();
        Throwable t = em.annotate(
            exc, NbBundle.getBundle(ExitDialog.class).getString("EXC_Save")
        );
        em.notify(ErrorManager.EXCEPTION, t);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ExitDialog.java

示例4: getAnnotateLine

import org.openide.ErrorManager; //导入方法依赖的package包/类
/**
 * Locates AnnotateLine associated with given line. The
 * line is translated to Element that is used as map lookup key.
 * The map is initially filled up with Elements sampled on
 * annotate() method.
 *
 * <p>Key trick is that Element's identity is maintained
 * until line removal (and is restored on undo).
 *
 * @param line
 * @return found AnnotateLine or <code>null</code>
 */
private VcsAnnotation getAnnotateLine(int line) {
    StyledDocument sd = (StyledDocument) doc;
    int lineOffset = NbDocument.findLineOffset(sd, line);
    Element element = sd.getParagraphElement(lineOffset);
    VcsAnnotation al = elementAnnotations.get(element);

    if (al != null) {
        int startOffset = element.getStartOffset();
        int endOffset = element.getEndOffset();
        try {
            int len = endOffset - startOffset;
            String text = doc.getText(startOffset, len -1);
            String content = al.getDocumentText();
            if (text.equals(content)) {
                return al;
            }
        } catch (BadLocationException e) {
            ErrorManager err = ErrorManager.getDefault();
            err.annotate(e, "CVS.AB: can not locate line annotation."); // NOI18N
            err.notify(ErrorManager.INFORMATIONAL, e);
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:AnnotationBar.java

示例5: resolveModuleElm

import org.openide.ErrorManager; //导入方法依赖的package包/类
/** reade codenamebase + revision */
private void resolveModuleElm(String codeName) {
    if (codeName != null) {
        int slash = codeName.indexOf("/"); // NOI18N
        if (slash == -1) {
            codeNameBase = codeName;
            codeNameRelease = -1;
        } else {
            codeNameBase = codeName.substring(0, slash);
            try {
                codeNameRelease = Integer.parseInt(codeName.substring(slash + 1));
            } catch (NumberFormatException ex) {
                ErrorManager emgr = ErrorManager.getDefault();
                emgr.annotate(ex, "Content: \n" + getFileContent(source)); // NOI18N
                emgr.annotate(ex, "Source: " + source); // NOI18N
                emgr.notify(ErrorManager.INFORMATIONAL, ex);
                codeNameRelease = -1;
            }
        }
    } else {
        codeNameBase = null;
        codeNameRelease = -1;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:SettingsRecognizer.java

示例6: parse

import org.openide.ErrorManager; //导入方法依赖的package包/类
/**
 * Converts to InputSource and pass it.
 */    
protected TreeDocumentRoot parse(FileObject fo) throws IOException, TreeException{
    
    try {
        URL url = fo.getURL();
        InputSource in = new InputSource(url.toExternalForm());  //!!! we could try ti get encoding from MIME content type
        in.setByteStream(fo.getInputStream());
        return parse(in);
        
    } catch (IOException ex) {
        ErrorManager emgr = ErrorManager.getDefault();
        emgr.annotate(ex, Util.THIS.getString("MSG_can_not_create_URL"));
        emgr.notify(ex);
    }           
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ParsingSupport.java

示例7: setFiles

import org.openide.ErrorManager; //导入方法依赖的package包/类
protected final void setFiles(final Set<FileObject> files) {
    fileSystemListeners = new HashSet<FileStatusListener>();
    this.files = files;
    if (files == null) {
        return;
    }
    Set<FileSystem> hookedFileSystems = new HashSet<FileSystem>();
    for (FileObject fo : files) {
        try {
            FileSystem fs = fo.getFileSystem();
            if (hookedFileSystems.contains(fs)) {
                continue;
            }
            hookedFileSystems.add(fs);
            FileStatusListener fsl = FileUtil.weakFileStatusListener(this, fs);
            fs.addFileStatusListener(fsl);
            fileSystemListeners.add(fsl);
        } catch (FileStateInvalidException e) {
            ErrorManager err = ErrorManager.getDefault();
            err.annotate(e, "Cannot get " + fo + " filesystem, ignoring...");  // NOI18N
            err.notify(ErrorManager.INFORMATIONAL, e);
        }
    }
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:25,代码来源:AnnotatedNode.java

示例8: doSave

import org.openide.ErrorManager; //导入方法依赖的package包/类
public static void doSave (DataObject dataObject) {
    try {
        SaveCookie sc = dataObject.getLookup().lookup(SaveCookie.class);
        if (sc != null) {
            sc.save();
        }
    } catch (IOException exc) {
        ErrorManager em = ErrorManager.getDefault();
        Throwable t = em.annotate(
            exc, NbBundle.getBundle(ExitDialog.class).getString("EXC_Save")
        );
        em.notify(ErrorManager.EXCEPTION, t);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ExitDialog.java

示例9: insertUpdate

import org.openide.ErrorManager; //导入方法依赖的package包/类
public void insertUpdate(DocumentEvent e) {
    int start = e.getOffset();
    int len = e.getLength();
    try {
        String s = e.getDocument().getText(start + len - 1, 1);
        lastInsertedChar = s.charAt(0);
    } catch (BadLocationException e1) {
        ErrorManager err = ErrorManager.getDefault();
        err.notify(e1);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:XMLSyntaxSupport.java

示例10: equals

import org.openide.ErrorManager; //导入方法依赖的package包/类
public boolean equals(Object o) {
    if (this == o) return true;

    if (o instanceof DiskFileKey) {

        DiskFileKey key = (DiskFileKey) o;

        if (hashCode != key.hashCode) return false;
        FileObject fo2 = key.fileObject;
        FileObject fo = fileObject;

        if (fo == fo2) return true;

        try {
            FileSystem fs = fo.getFileSystem();
            FileSystem fs2 = fo2.getFileSystem();
            if (fs.equals(fs2)) {
                return fo.equals(fo2);
            } else {
                // fallback use absolute paths (cache them)
                if (absolutePath == null) {
                    File f = FileUtil.toFile(fo);
                    absolutePath = f.getAbsolutePath();
                }
                if (key.absolutePath == null) {
                    File f2 = FileUtil.toFile(fo2);
                    key.absolutePath = f2.getAbsolutePath();
                }
                return absolutePath.equals(key.absolutePath);
            }
        } catch (FileStateInvalidException e) {
            ErrorManager err = ErrorManager.getDefault();
            err.notify(e);
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:DiskFileKey.java

示例11: testErrorManagerCompatibilityAsDescribedInIssue79227

import org.openide.ErrorManager; //导入方法依赖的package包/类
public void testErrorManagerCompatibilityAsDescribedInIssue79227() throws Exception {
    MockDD.lastDescriptor = null;

    Exception ex = new ClassNotFoundException();
    ErrorManager em = ErrorManager.getDefault();
    String msg = "LocMsg";
    em.annotate(ex, msg);
    em.notify(ErrorManager.USER, ex); // Issue 65116 - don't show the exception to the user

    waitEQ();
    assertNotNull("Mock descriptor called", MockDD.lastDescriptor);
    assertEquals("Info msg", NotifyDescriptor.INFORMATION_MESSAGE, MockDD.lastDescriptor.getMessageType());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:NbErrorManagerTest.java

示例12: notifyException

import org.openide.ErrorManager; //导入方法依赖的package包/类
/**
 * Notify annotated exception to user. Just shortcut to ErrorManager.
 */    
public static void notifyException (String desc, Throwable ex) {
    ErrorManager err = ErrorManager.getDefault();
    if (desc != null) {
        err.annotate (ex, desc);
    }
    err.notify (err.EXCEPTION, ex);  // show stack trace to user
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:GuiUtil.java

示例13: removeBackups

import org.openide.ErrorManager; //导入方法依赖的package包/类
/** Removes the backup copies of files upon the successful application 
 * of a patch (.orig files).
 * @param files a list of files, to which the patch was successfully applied
 * @param backups a map of a form original file -> backup file
 */
private static void removeBackups(List<FileObject> files, Map<FileObject, FileObject> backups, boolean onExit) {
    StringBuffer filenames=new StringBuffer(), 
                 exceptions=new StringBuffer();
    for (int i = 0; i < files.size(); i++) {
        FileObject targetFileObject = files.get(i);
        FileObject backup= backups.get(targetFileObject);

        // delete files that become empty and they have a backup file
        if (targetFileObject != null && targetFileObject.getSize() == 0) {
            if (backup != null && backup.isValid() && backup.getSize() > 0) {
                if (onExit) {
                    deleteOnExit(targetFileObject);
                } else {
                    try {
                        targetFileObject.delete();
                    } catch (IOException e) {
                        ErrorManager err = ErrorManager.getDefault();
                        err.annotate(e, "Patch can not delete file, skipping...");
                        err.notify(ErrorManager.INFORMATIONAL, e);
                    }
                }
            }
        }

        if (backup != null && backup.isValid()) {
            if (onExit) {
                deleteOnExit(backup);
            } else {
                try {
                    backup.delete();
                }
                catch (IOException ex) {
                    filenames.append(FileUtil.getFileDisplayName(backup));
                    filenames.append('\n');
                    exceptions.append(ex.getLocalizedMessage());
                    exceptions.append('\n');
                }
            }
        }
    }
    if (filenames.length()>0)
        ErrorManager.getDefault().notify(
            ErrorManager.getDefault().annotate(new IOException(),
                NbBundle.getMessage(PatchAction.class, 
                    "EXC_CannotRemoveBackup", filenames, exceptions)));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:PatchAction.java

示例14: debug

import org.openide.ErrorManager; //导入方法依赖的package包/类
/**
 * Write the exception into log.
 */
public static void debug(Throwable t) {
    ErrorManager err = ErrorManager.getDefault();
    err.notify(err.INFORMATIONAL, t);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:Util.java


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