本文整理汇总了Java中org.openide.util.Exceptions.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java Exceptions.printStackTrace方法的具体用法?Java Exceptions.printStackTrace怎么用?Java Exceptions.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.Exceptions
的用法示例。
在下文中一共展示了Exceptions.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileSystemFromCache
import org.openide.util.Exceptions; //导入方法依赖的package包/类
private static FileSystem getFileSystemFromCache(Map<String,Reference<RemoteFileSystem>> cache, String key, Callable<RemoteFileSystem> create) {
synchronized (cache) {
RemoteFileSystem fs = cache.containsKey(key) ? cache.get(key).get() : null;
if (fs == null) {
try {
fs = create.call();
if (fs == null) {
return null;
}
cache.put(key, new WeakReference<RemoteFileSystem>(fs));
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
return FileUtil.createMemoryFileSystem();
}
}
return fs;
}
}
示例2: verificarCaracteristicasEscenarioSeleccionado
import org.openide.util.Exceptions; //导入方法依赖的package包/类
public boolean verificarCaracteristicasEscenarioSeleccionado ( File ficheroSeleccionado,String orgModelo,int numRobots ){
try {
escenarioSimulComp = itfPersistenciaSimul.obtenerInfoEscenarioSimulacion(ficheroSeleccionado.getName());
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
if(escenarioSimulComp == null ) return false;
identEquipoActual=escenarioSimulComp.getIdentEscenario();
numeroRobots = escenarioSimulComp.getNumRobots();
modeloOrganizativo= escenarioSimulComp.getmodeloOrganizativo();
if(this.numeroRobots==numRobots &&this.modeloOrganizativo.equalsIgnoreCase(orgModelo)){
// se envia notificacion al agente controlador con el computacional obtenido
escenarioSimulComp.setGestorEscenarios(gestionEscComp);
escenarioValidoObtenido = true;
return true;
}else {
visorControlSim.visualizarConsejo("Fichero seleccionado No valido ", "El modelo organizativo del fichero seleccionado: "+orgModelo
+ " o el numero de Robots = : "+ numRobots + " No coinciden ", "Seleccione otro fichero o cree uno nuevo ");
return false;
}
}
示例3: getActionPerformer
import org.openide.util.Exceptions; //导入方法依赖的package包/类
static ActionPerformer getActionPerformer(Action action) {
// Not a nice way of retrieval of the original action performer:
try {
Class<?> asClass = Class.forName(Models.class.getName() + "$ActionSupport");
if (!asClass.isInstance(action)) {
return null;
}
Field performerField = asClass.getDeclaredField("performer");
performerField.setAccessible(true);
Object performer = performerField.get(action);
return (ActionPerformer) performer;
} catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
Exceptions.printStackTrace(ex);
return null;
}
}
示例4: windowClosed
import org.openide.util.Exceptions; //导入方法依赖的package包/类
public void windowClosed(WindowEvent e) {
optionsPanel.storeUserSize();
// store location of dialog
NbPreferences.forModule(OptionsDisplayerImpl.class).putInt("OptionsX", originalDialog.getX());//NOI18N
NbPreferences.forModule(OptionsDisplayerImpl.class).putInt("OptionsY", originalDialog.getY());//NOI18N
try {
FileUtil.getConfigRoot().getFileSystem().removeFileChangeListener(fcl);
} catch (FileStateInvalidException ex) {
Exceptions.printStackTrace(ex);
}
if (optionsPanel.needsReinit()) {
synchronized (lookupListener) {
descriptorRef = new WeakReference<DialogDescriptor>(null);
}
}
if (this.originalDialog == dialog) {
dialog = null;
}
log.fine("Options Dialog - windowClosed"); //NOI18N
}
示例5: testWaitFinished0WaitsUntilFinished
import org.openide.util.Exceptions; //导入方法依赖的package包/类
public void testWaitFinished0WaitsUntilFinished() throws Exception {
Task task = new Task(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
}
}
});
Thread thread = new Thread(task);
thread.start();
task.waitFinished(0);
assertTrue ("Should be finished", task.isFinished());
}
示例6: getStdOut
import org.openide.util.Exceptions; //导入方法依赖的package包/类
public OutputWriter getStdOut() {
if (Controller.LOG) {
Controller.log("NbIOProvider.getStdOut");
}
NbIO stdout = (NbIO) getIO(STDOUT, false);
NbWriter out = stdout.writer();
NbIO.post(new IOEvent(stdout, IOEvent.CMD_CREATE, true));
//ensure it is not closed
if (out != null && out.isClosed()) {
try {
out.reset();
out = (NbWriter) stdout.getOut();
} catch (IOException e) {
Exceptions.printStackTrace(e);
stdout = (NbIO) getIO(STDOUT, true);
out = (NbWriter) stdout.getOut();
}
} else {
out = (NbWriter) stdout.getOut();
}
return out;
}
示例7: run
import org.openide.util.Exceptions; //导入方法依赖的package包/类
public synchronized void run() {
notify();
try {
wait();
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
}
}
示例8: apply
import org.openide.util.Exceptions; //导入方法依赖的package包/类
@Override
public void apply(Diagram d) {
try {
ScriptEngineManager sem = new ScriptEngineManager();
ScriptEngine e = sem.getEngineByName("ECMAScript");
e.eval(getJsHelperText());
Bindings b = e.getContext().getBindings(ScriptContext.ENGINE_SCOPE);
b.put("graph", d);
b.put("IO", System.out);
e.eval(code, b);
} catch (ScriptException ex) {
Exceptions.printStackTrace(ex);
}
}
示例9: getColumnsForTable
import org.openide.util.Exceptions; //导入方法依赖的package包/类
/**
* Returns Column information for the given table defined under the given
* configuration.
*
* @param tableName the tablename.
* @param hibernateConfiguration the database configuration to be used.
* @return list of TableColumn objects.
*/
public static List<TableColumn> getColumnsForTable(String tableName, HibernateConfiguration hibernateConfiguration) {
List<TableColumn> columnNames = new ArrayList<TableColumn>();
try {
java.sql.Connection connection = getJDBCConnection(hibernateConfiguration);
if (connection != null) {
java.sql.Statement stmt = connection.createStatement();
java.sql.ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName); //NOI18N
java.sql.ResultSetMetaData rsMetadata = rs.getMetaData();
java.sql.DatabaseMetaData dbMetadata = connection.getMetaData();
java.sql.ResultSet rsDBMetadata = dbMetadata.getPrimaryKeys(null, null, tableName);
List<String> primaryColumns = new ArrayList<String>();
while (rsDBMetadata.next()) {
primaryColumns.add(rsDBMetadata.getString("COLUMN_NAME")); //NOI18N
}
for (int i = 1; i <= rsMetadata.getColumnCount(); i++) {
TableColumn tableColumn = new TableColumn();
tableColumn.setColumnName(rsMetadata.getColumnName(i));
if (primaryColumns.contains(tableColumn.getColumnName())) {
tableColumn.setPrimaryKey(true);
}
columnNames.add(tableColumn);
}
} else {
//TODO Cannot connect to the database.
// Need to handle this gracefully and display the error message.
// throw new DatabaseException("Cannot connect to the database");
}
} catch (DatabaseException ex) {
Exceptions.printStackTrace(ex);
} catch (SQLException sQLException) {
Exceptions.printStackTrace(sQLException);
}
return columnNames;
}
示例10: instantiate
import org.openide.util.Exceptions; //导入方法依赖的package包/类
@Override
public Set<FileObject> instantiate() throws IOException {
try {
Set<FileObject> resultSet = importWorker.get();
return resultSet;
} catch (InterruptedException | ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
return new HashSet<>();
}
示例11: ModifiedPreferences
import org.openide.util.Exceptions; //导入方法依赖的package包/类
public ModifiedPreferences(ModifiedPreferences parent, String name, Preferences node) {
this(parent, name); // NOI18N
try {
for (java.lang.String key : node.keys()) {
put(key, node.get(key, null));
}
for (String child : node.childrenNames()) {
subNodes.put(child, new ModifiedPreferences(this, node.name(), node.node(child)));
}
}
catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
}
}
示例12: getPropertyDescriptors
import org.openide.util.Exceptions; //导入方法依赖的package包/类
/** No properties.
* @return array of hidden properties
*/
public PropertyDescriptor[] getPropertyDescriptors () {
try {
PropertyDescriptor name = new PropertyDescriptor ("name", SystemOption.class, "getName", null);
name.setHidden (true);
PropertyDescriptor helpCtx = new PropertyDescriptor ("helpCtx", SystemOption.class, "getHelpCtx", null);
helpCtx.setHidden (true);
return new PropertyDescriptor[] { name, helpCtx };
} catch (IntrospectionException ie) {
Exceptions.printStackTrace(ie);
return null;
}
}
示例13: fillListModel
import org.openide.util.Exceptions; //导入方法依赖的package包/类
/**
* Reads the lines from the supplied reader and fills the supplied
* model with the lines.
* @param r
* @param model
*/
static void fillListModel(BufferedReader r, DefaultListModel model) {
String currentLine;
String lastLine = null;
try {
while ((currentLine = r.readLine()) != null) {
currentLine = currentLine.trim();
if (StackLineAnalyser.matches(currentLine)) {
if (lastLine != null) {
model.addElement(lastLine);
}
model.addElement(currentLine);
lastLine = null;
} else {
if (lastLine == null) {
lastLine = currentLine;
} else {
if (lastLine.endsWith("at")) { // NOI18N
lastLine += " "; // NOI18N
}
String together = lastLine + currentLine;
if (StackLineAnalyser.matches(together)) {
model.addElement(together);
lastLine = null;
} else {
model.addElement(lastLine);
lastLine = currentLine;
}
}
}
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
示例14: checkPath
import org.openide.util.Exceptions; //导入方法依赖的package包/类
private static String checkPath(FileObject jarRoot, FileObject fo) {
String toRet = null;
FileObject root = JavadocAndSourceRootDetection.findSourceRoot(jarRoot);
try {
if (root != null && !root.equals(jarRoot)) {
toRet = FileUtil.getRelativePath(jarRoot, root);
fo.setAttribute(ATTR_PATH, toRet);
}
fo.setAttribute(ATTR_STAMP, new Date());
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
return toRet;
}
示例15: release
import org.openide.util.Exceptions; //导入方法依赖的package包/类
void release() {
String firstRegionText = getFirstRegionText();
if (firstRegionText != null) {
int regionCount = regions.size();
for (int i = 1; i < regionCount; i++) {
MutablePositionRegion region = regions.get(i);
int offset = region.getStartOffset();
int length = region.getEndOffset() - offset;
try {
final CharSequence old = DocumentUtilities.getText(doc, offset, length);
if (!CharSequenceUtilities.textEquals(firstRegionText, old)) {
int res = -1;
for(int k = 0; k < Math.min(old.length(), firstRegionText.length()); k++) {
if (old.charAt(k) == firstRegionText.charAt(k)) {
res = k;
} else {
break;
}
}
String insert = firstRegionText.substring(res+1);
CharSequence remove = old.subSequence(res + 1, old.length());
if (insert.length() > 0) {
doc.insertString(offset + res + 1, insert, null);
}
if (remove.length() > 0) {
doc.remove(offset + res + 1 + insert.length(), remove.length());
}
}
} catch (BadLocationException e) {
Exceptions.printStackTrace(e);
}
}
}
}