本文整理汇总了Java中org.openide.ErrorManager类的典型用法代码示例。如果您正苦于以下问题:Java ErrorManager类的具体用法?Java ErrorManager怎么用?Java ErrorManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorManager类属于org.openide包,在下文中一共展示了ErrorManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupNameProperty
import org.openide.ErrorManager; //导入依赖的package包/类
private static void setupNameProperty(RADComponent metacomp, boolean set, boolean recursive) {
FormProperty nameProp = getNameProperty(metacomp);
if (nameProp != null) {
try {
if (set && !nameProp.isChanged()) {
nameProp.setValue(metacomp.getName());
}
else if (!set && nameProp.isChanged()
&& metacomp.getName().equals(nameProp.getValue()))
{ // property value corresponds to the component name
nameProp.restoreDefaultValue();
}
}
catch (Exception ex) { // getValue, setValue, restoreValue - should not fail here
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
}
}
if (recursive && metacomp instanceof ComponentContainer) {
for (RADComponent subcomp : ((ComponentContainer)metacomp).getSubBeans()) {
setupNameProperty(subcomp, set, recursive);
}
}
}
示例2: btnProjectActionPerformed
import org.openide.ErrorManager; //导入依赖的package包/类
private void btnProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProjectActionPerformed
JFileChooser chooser = ProjectChooser.projectChooser();
int res = chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this));
if (res == JFileChooser.APPROVE_OPTION) {
File fil = chooser.getSelectedFile();
FileObject fo = FileUtil.toFileObject(fil);
if (fo != null) {
try {
Project p = ProjectManager.getDefault().findProject(fo);
DefaultComboBoxModel model = (DefaultComboBoxModel)comProject.getModel();
model.addElement(p);
model.setSelectedItem(p);
if (EMPTY == model.getElementAt(0)) {
model.removeElement(EMPTY);
}
} catch (IOException exc) {
ErrorManager.getDefault().notify(exc);
}
}
}
}
示例3: findUnitTestInTestRoot
import org.openide.ErrorManager; //导入依赖的package包/类
/**
* Copied from JUnit module implementation in 4.1 and modified
*/
private static FileObject findUnitTestInTestRoot(ClassPath cp, FileObject selectedFO, URL testRoot) {
ClassPath testClassPath = null;
if (testRoot == null) { //no tests, use sources instead
testClassPath = cp;
} else {
try {
List<PathResourceImplementation> cpItems = new ArrayList<PathResourceImplementation>();
cpItems.add(ClassPathSupport.createResource(testRoot));
testClassPath = ClassPathSupport.createClassPath(cpItems);
} catch (IllegalArgumentException ex) {
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
testClassPath = cp;
}
}
String testName = getTestName(cp, selectedFO);
return testClassPath.findResource(testName + ".java"); // NOI18N
}
示例4: takeSnapshotHit
import org.openide.ErrorManager; //导入依赖的package包/类
private String takeSnapshotHit() {
LoadedSnapshot loadedSnapshot = null;
String snapshotFilename = null;
loadedSnapshot = takeSnapshot();
if (loadedSnapshot != null) {
try {
FileObject snapshotDirectory = getSnapshotDirectory();
FileObject profFile = snapshotDirectory.createData(ResultsManager.getDefault()
.getDefaultSnapshotFileName(loadedSnapshot),
ResultsManager.SNAPSHOT_EXTENSION);
ResultsManager.getDefault().saveSnapshot(loadedSnapshot, profFile); // Also updates list of snapshots in ProfilerControlPanel2
snapshotFilename = FileUtil.toFile(profFile).toURI().toURL().toExternalForm();
} catch (IOException e) {
ErrorManager.getDefault().notify(ErrorManager.ERROR, e);
}
}
return (snapshotFilename == null) ? Bundle.TriggeredTakeSnapshotProfilingPoint_NoDataAvailableMsg() : snapshotFilename;
}
示例5: testAddedInfo
import org.openide.ErrorManager; //导入依赖的package包/类
public void testAddedInfo() throws Exception {
MissingResourceException mre = new MissingResourceException("msg1", "the.class.Name", "the-key");
err.notify(ErrorManager.INFORMATIONAL, mre);
String s = readLog();
assertTrue(s.indexOf("java.util.MissingResourceException: msg1") != -1);
assertTrue(s.indexOf("the.class.Name") != -1);
assertTrue(s.indexOf("the-key") != -1);
SAXParseException saxpe = new SAXParseException("msg2", "pub-id", "sys-id", 313, 424);
err.notify(ErrorManager.INFORMATIONAL, saxpe);
s = readLog();
assertTrue(s.indexOf("org.xml.sax.SAXParseException") != -1);
assertTrue(s.indexOf("msg2") != -1);
assertTrue(s.indexOf("pub-id") != -1);
assertTrue(s.indexOf("sys-id") != -1);
assertTrue(s.indexOf("313") != -1);
assertTrue(s.indexOf("424") != -1);
}
示例6: save
import org.openide.ErrorManager; //导入依赖的package包/类
static void save (final FileObject fo, final String content) {
if (fo == null) throw new NullPointerException ();
if (content == null) throw new NullPointerException ();
requestProcessor.post (new Runnable () {
public void run () {
try {
FileLock lock = fo.lock ();
try {
OutputStream os = fo.getOutputStream (lock);
Writer writer = new OutputStreamWriter (os, "UTF-8"); // NOI18N
try {
writer.write (content);
} finally {
writer.close ();
}
} finally {
lock.releaseLock ();
}
} catch (IOException ex) {
ErrorManager.getDefault ().notify (ex);
}
}
});
}
示例7: getPropertyDescriptors
import org.openide.ErrorManager; //导入依赖的package包/类
/**
* @return Returns an array of PropertyDescriptors
* describing the editable properties supported by this bean. */
public PropertyDescriptor[] getPropertyDescriptors () {
try {
PropertyDescriptor p2 = new PropertyDescriptor(
"extensions", // NOI18N
PropertiesDataLoader.class,
"getExtensions", // NOI18N
"setExtensions"); // NOI18N
p2.setDisplayName(NbBundle.getBundle(PropertiesDataLoaderBeanInfo.class).getString("PROP_Ext"));
p2.setShortDescription(NbBundle.getBundle(PropertiesDataLoaderBeanInfo.class).getString("HINT_Ext"));
return new PropertyDescriptor[] {p2};
} catch(IntrospectionException ie) {
ErrorManager.getDefault().notify(ie);
return null;
}
}
示例8: attachStatusListener
import org.openide.ErrorManager; //导入依赖的package包/类
/**
*/
private void attachStatusListener() {
if (fsStatusListener != null) {
return; //already attached
}
FileSystem fs;
try {
fs = myEntry.getFile().getFileSystem();
} catch (FileStateInvalidException ex) {
ErrorManager.getDefault().notify(ErrorManager.ERROR, ex);
return;
}
fsStatusListener = new FsStatusListener();
fs.addFileStatusListener(
FileUtil.weakFileStatusListener(fsStatusListener, fs));
}
示例9: collectNestedResourceProperties
import org.openide.ErrorManager; //导入依赖的package包/类
private Collection<FormProperty> collectNestedResourceProperties(
FormProperty property, int valueType, Collection<FormProperty> col)
{
try {
return collectNestedResourceProperties(
property.getValue(), property, valueType, col);
}
catch (Exception ex) {
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
}
return col;
}
示例10: reset
import org.openide.ErrorManager; //导入依赖的package包/类
private void reset() {
if (!project.getProjectDirectoryFile().exists()) {
return; // recently deleted?
}
ProjectManager.mutex().readAccess(new Mutex.Action<Void>() {
public @Override Void run() {
final ModuleList moduleList;
try {
moduleList = project.getModuleList();
} catch (IOException e) {
Util.err.notify(ErrorManager.INFORMATIONAL, e);
// but leave old evaluator in place for now
return null;
}
synchronized (Evaluator.this) {
loadedModuleList = true;
delegate.removePropertyChangeListener(Evaluator.this);
delegate = createEvaluator(moduleList);
delegate.addPropertyChangeListener(Evaluator.this);
}
// XXX better to compute diff between previous and new values and fire just those
pcs.firePropertyChange(null, null, null);
return null;
}
});
}
示例11: requestUpdateData
import org.openide.ErrorManager; //导入依赖的package包/类
/**
* Schedules update of binary data from model.
* Property <I>modified</I> of the data object is true after update.
*/
public final void requestUpdateData() {
if (reloading == 0) {
synchronized (updateTask) {
finishUpdateTask.cancel();
if (!isUpdateLock()) {
try {
updateLock = takeLock();
} catch (IOException e) {
ErrorManager.getDefault().notify(e);
return;
}
}
updateTask.schedule(updateDelay);
}
}
}
示例12: addExtCluster
import org.openide.ErrorManager; //导入依赖的package包/类
private void addExtCluster(ClusterInfo ci) {
Set<String> disabledModuleCNB = new HashSet<String>(Arrays.asList(getProperties().getDisabledModules()));
Children.SortedArray moduleCh = new Children.SortedArray();
try {
ModuleList ml = ModuleList.scanCluster(ci.getClusterDir(), null, false, ci);
moduleCh.setComparator(MODULES_COMPARATOR);
for (ModuleEntry entry : ml.getAllEntries()) {
moduleCh.add(new Node[] { new BinaryModuleNode(entry,
! disabledModuleCNB.contains(entry.getCodeNameBase()) && ci.isEnabled()) });
extraBinaryModules.add(entry);
}
} catch (IOException e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
initNodes();
synchronized (libChildren.extraNodes) {
libChildren.extraNodes.add(new ClusterNode(ci, moduleCh));
}
libChildren.setMergedKeys();
}
示例13: runProjectWizard
import org.openide.ErrorManager; //导入依赖的package包/类
public static @CheckForNull NbModuleProject runProjectWizard(
final NewNbModuleWizardIterator iterator, final String titleBundleKey) {
WizardDescriptor wd = new WizardDescriptor(iterator);
wd.setTitleFormat(new MessageFormat("{0}")); // NOI18N
wd.setTitle(NbBundle.getMessage(ApisupportAntUIUtils.class, titleBundleKey));
Dialog dialog = DialogDisplayer.getDefault().createDialog(wd);
dialog.setVisible(true);
dialog.toFront();
NbModuleProject project = null;
boolean cancelled = wd.getValue() != WizardDescriptor.FINISH_OPTION;
if (!cancelled) {
FileObject folder = iterator.getCreateProjectFolder();
if (folder == null) {
return null;
}
try {
project = (NbModuleProject) ProjectManager.getDefault().findProject(folder);
OpenProjects.getDefault().open(new Project[] { project }, false);
} catch (IOException e) {
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
}
}
return project;
}
示例14: 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);
}
}
}
示例15: 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;
}