本文整理汇总了Java中org.openide.util.Exceptions类的典型用法代码示例。如果您正苦于以下问题:Java Exceptions类的具体用法?Java Exceptions怎么用?Java Exceptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Exceptions类属于org.openide.util包,在下文中一共展示了Exceptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTopComponent
import org.openide.util.Exceptions; //导入依赖的package包/类
/** This is called by the multiview elements whenever they are created
* (and given a observer knowing their multiview TopComponent). It is
* important during deserialization and clonig the multiview - i.e. during
* the operations we have no control over. But anytime a multiview is
* created, this method gets called.
*/
private void setTopComponent(TopComponent topComp) {
multiviewTC = (CloneableTopComponent)topComp;
updateMVTCName();
if (topComponentsListener == null) {
topComponentsListener = new TopComponentsListener();
TopComponent.getRegistry().addPropertyChangeListener(topComponentsListener);
}
opened.add(this);
try {
addStatusListener(getDataObject().getPrimaryFile().getFileSystem());
} catch (FileStateInvalidException fsiex) {
Exceptions.printStackTrace(fsiex);
}
}
示例2: updateSettings
import org.openide.util.Exceptions; //导入依赖的package包/类
/**
* Updates settings used by this generator. It should be called outside locks.
* @param file a file where the generated content will be added
*/
public void updateSettings(FileObject file) {
DataObject dobj = null;
DataFolder folder = null;
try {
dobj = DataObject.find(file);
folder = dobj.getFolder();
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
if (dobj == null || folder == null) {
return;
}
for (CreateFromTemplateAttributesProvider provider
: Lookup.getDefault().lookupAll(CreateFromTemplateAttributesProvider.class)) {
Map<String, ?> attrs = provider.attributesFor(dobj, folder, "XXX"); // NOI18N
if (attrs == null) {
continue;
}
Object aName = attrs.get("user"); // NOI18N
if (aName != null) {
author = aName.toString();
break;
}
}
}
示例3: hideInfo
import org.openide.util.Exceptions; //导入依赖的package包/类
private void hideInfo() {
watcherLogger.finer("hideInfo()"); //NOI18N
txtComp.setEnabled(true);
try {
ignoreFileNamePatternChanges = true;
if (doc.getText(0, doc.getLength()).equals(getInfoText())) {
doc.remove(0, doc.getLength());
}
} catch (BadLocationException ex) {
Exceptions.printStackTrace(ex);
} finally {
ignoreFileNamePatternChanges = false;
txtComp.setForeground(foregroundColor);
infoDisplayed = false;
}
}
示例4: createMockTextDetail
import org.openide.util.Exceptions; //导入依赖的package包/类
private TextDetail createMockTextDetail(String line, String match) {
FileSystem fs = FileUtil.createMemoryFileSystem();
try {
FileObject fo = fs.getRoot().createData("mockMatch.txt");
SearchPattern sp = SearchPattern.create(match, false, false, false);
DataObject dob = DataObject.find(fo);
TextDetail td = new TextDetail(dob, sp);
td.setLine(1);
int col0 = line.indexOf(match) + 1;
td.setColumn(col0);
td.setMatchedText(match);
td.setMarkLength(match.length());
td.setStartOffset(col0);
td.setEndOffset(col0 + match.length());
td.setLineText(line);
return td;
} catch (Exception e) {
Exceptions.printStackTrace(e);
return null;
}
}
示例5: loadForm
import org.openide.util.Exceptions; //导入依赖的package包/类
public boolean loadForm() {
if (!formLoaded) {
Runnable r = new Runnable() {
@Override
public void run() {
loadFormData();
}
};
if (java.awt.EventQueue.isDispatchThread()) {
r.run();
} else { // loading must be done in AWT event dispatch thread
try {
java.awt.EventQueue.invokeAndWait(r);
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
}
}
return formLoaded;
}
示例6: focused
import org.openide.util.Exceptions; //导入依赖的package包/类
void focused(FileObject fo, JTextComponent target) {
Project project = FileOwnerQuery.getOwner(fo);
if (project != null) {
CoverageProvider provider = getProvider(project);
if (provider != null && provider.isEnabled()) {
try {
EditorCookie ec = DataLoadersBridge.getDefault().getCookie(fo, EditorCookie.class);
if (ec != null) {
Document doc = ec.getDocument();
if (doc == null) {
return;
}
doc.putProperty(COVERAGE_DOC_PROPERTY, null);
CoverageHighlightsContainer container = CoverageHighlightsLayerFactory.getContainer(target);
if (container != null) {
container.refresh();
}
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
}
示例7: postCloseCleanup
import org.openide.util.Exceptions; //导入依赖的package包/类
private void postCloseCleanup() {
try {
// try to close the dataobject
DataObject d = DataObject.find(getConsoleFile());
EditorCookie cake = d.getLookup().lookup(EditorCookie.class);
cake.close();
// discard the dataobject
synchronized (this) {
if (document == null) {
return;
}
document = null;
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
if (controlsIO) {
inputOutput.closeInputOutput();
}
ShellRegistry.get().closed(this);
}
示例8: resolveModuleElm
import org.openide.util.Exceptions; //导入依赖的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) {
Exceptions.attachLocalizedMessage(ex,
"Content: \n" +
getFileContent(source)); // NOI18N
Exceptions.attachLocalizedMessage(ex,
"Source: " + source); // NOI18N
Logger.getLogger(XMLSettingsSupport.class.getName()).log(Level.WARNING, null, ex);
codeNameRelease = -1;
}
}
} else {
codeNameBase = null;
codeNameRelease = -1;
}
}
示例9: findRtJar
import org.openide.util.Exceptions; //导入依赖的package包/类
@CheckForNull
private static URL findRtJar() {
final String boot = System.getProperty("sun.boot.class.path"); //NOI18N
if (boot != null) {
for (String part : boot.split(File.pathSeparator)) {
if (part.contains("rt.jar")) { //NOI18N
final File rtJar = FileUtil.normalizeFile(new File(part));
try {
return FileUtil.getArchiveRoot(BaseUtilities.toURI(rtJar).toURL());
} catch (MalformedURLException e) {
Exceptions.printStackTrace(e);
}
}
}
}
return null;
}
示例10: sync
import org.openide.util.Exceptions; //导入依赖的package包/类
/**
* Propagate text of the first region into all other regions.
*/
public void sync() {
String firstRegionText = getFirstRegionText();
if (firstRegionText != null) {
int regionCount = getRegionCount();
for (int i = 1; i < regionCount; i++) {
MutablePositionRegion region = getRegion(i);
int offset = region.getStartOffset();
int length = region.getEndOffset() - offset;
try {
if (!CharSequenceUtilities.textEquals(firstRegionText, DocumentUtilities.getText(doc, offset, length))) {
if (firstRegionText.length() > 0) {
doc.insertString(offset, firstRegionText, null);
}
doc.remove(offset + firstRegionText.length(), length);
}
} catch (BadLocationException e) {
Exceptions.printStackTrace(e);
}
}
}
}
示例11: getJavaDocFor
import org.openide.util.Exceptions; //导入依赖的package包/类
private ElementJavadoc getJavaDocFor(
@NonNull final ElementNode node,
@NullAllowed final Callable<Boolean> cancel) {
ElementNode root = getRootNode();
if ( root == null ) {
return null;
}
final ElementHandle<? extends Element> eh = node.getDescritption().getElementHandle();
if (eh == null) {
return null;
}
final JavaSource js = JavaSource.forFileObject( root.getDescritption().fileObject );
if (js == null) {
return null;
}
final JavaDocCalculator calculator = new JavaDocCalculator(eh, cancel);
try {
js.runUserActionTask( calculator, true );
} catch( IOException ioE ) {
Exceptions.printStackTrace( ioE );
return null;
}
return calculator.doc;
}
示例12: shutDown
import org.openide.util.Exceptions; //导入依赖的package包/类
/**
* Shuts down the connection, may be called for local or remote close.
*/
void shutDown() {
try {
LOG.log(Level.FINE, "notifyShutdown: closing control socket: {0}", controlSocket);
if (controlSocket != null) {
// assumes both input and output terminate
controlSocket.close();
}
ostm.close();
istm.close();
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
} finally {
synchronized (this) {
closed = true;
notify();
}
}
}
示例13: generate
import org.openide.util.Exceptions; //导入依赖的package包/类
private void generate(final Document doc, final Descriptor desc, final JTextComponent jtc) throws BadLocationException {
final Indent ie = Indent.get(doc);
try {
ie.lock();
NbDocument.runAtomicAsUser((StyledDocument) doc, new Runnable() {
public void run() {
try {
int caretPos = jtc.getCaretPosition();
generateJavadoc(doc, desc, ie);
// move caret
jtc.setCaretPosition(caretPos);
} catch (BadLocationException ex) {
Exceptions.printStackTrace(ex);
}
}
});
} finally {
ie.unlock();
}
}
示例14: open
import org.openide.util.Exceptions; //导入依赖的package包/类
@Override
public void open() {
FileObject fo = getFileObject();
SpringConfigModel model = SpringConfigModel.forFileObject(fo);
if (model == null) {
return;
}
try {
model.runReadAction(new Action<SpringBeans>() {
public void run(SpringBeans beans) {
SpringBean bean = beans.findBean(getSimpleName());
if (bean == null) {
return;
}
SpringBeansUIs.createGoToBeanAction(bean).invoke();
}
});
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
示例15: stopDebuggerRemoteService
import org.openide.util.Exceptions; //导入依赖的package包/类
private void stopDebuggerRemoteService(JPDADebugger d) {
ClassObjectReference serviceClass = RemoteServices.getServiceClass(d, RemoteServices.ServiceType.AWT);
if (serviceClass == null) {
return ;
}
try {
ReferenceType serviceType = serviceClass.reflectedType();
Field awtAccessLoop = serviceType.fieldByName("awtAccessLoop"); // NOI18N
if (awtAccessLoop != null) {
((ClassType) serviceType).setValue(awtAccessLoop, serviceClass.virtualMachine().mirrorOf(false));
}
serviceClass.enableCollection();
} catch (VMDisconnectedException vdex) {
// Ignore
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
}