Lines 7-17
Link Here
|
7 |
* http://www.sun.com/ |
7 |
* http://www.sun.com/ |
8 |
* |
8 |
* |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun |
11 |
* Microsystems, Inc. All Rights Reserved. |
11 |
* Microsystems, Inc. All Rights Reserved. |
12 |
*/ |
12 |
*/ |
13 |
|
13 |
|
14 |
|
|
|
15 |
package org.netbeans.core.output; |
14 |
package org.netbeans.core.output; |
16 |
|
15 |
|
17 |
import java.util.WeakHashMap; |
16 |
import java.util.WeakHashMap; |
Lines 75-86
Link Here
|
75 |
import org.netbeans.core.compiler.*; |
74 |
import org.netbeans.core.compiler.*; |
76 |
|
75 |
|
77 |
import org.netbeans.lib.terminalemulator.*; |
76 |
import org.netbeans.lib.terminalemulator.*; |
|
|
77 |
|
78 |
/** |
78 |
/** |
79 |
* |
|
|
80 |
* @author Pavel Buzek, Ales Kemr, Radek Matous |
79 |
* @author Pavel Buzek, Ales Kemr, Radek Matous |
81 |
* |
|
|
82 |
*/ |
80 |
*/ |
83 |
|
|
|
84 |
public class OutputTabTerm extends TopComponent |
81 |
public class OutputTabTerm extends TopComponent |
85 |
implements InputOutput, WellKnownModeNames, TopComponentListener { |
82 |
implements InputOutput, WellKnownModeNames, TopComponentListener { |
86 |
|
83 |
|
Lines 136-142
Link Here
|
136 |
fos.write(s.getBytes()); |
133 |
fos.write(s.getBytes()); |
137 |
fos.close(); |
134 |
fos.close(); |
138 |
} catch (java.io.IOException e) { |
135 |
} catch (java.io.IOException e) { |
139 |
e.printStackTrace(); |
136 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
140 |
} |
137 |
} |
141 |
} |
138 |
} |
142 |
|
139 |
|
Lines 404-410
Link Here
|
404 |
try { |
401 |
try { |
405 |
inReader = new PipedReader(inWriter); |
402 |
inReader = new PipedReader(inWriter); |
406 |
} catch (java.io.IOException ex) { |
403 |
} catch (java.io.IOException ex) { |
407 |
TopManager.getDefault().notifyException(ex); |
404 |
ErrorManager.getDefault().notify(ex); |
408 |
return null; |
405 |
return null; |
409 |
} |
406 |
} |
410 |
return inReader; |
407 |
return inReader; |
Lines 1147-1153
Link Here
|
1147 |
if ( redirWriter != null ) |
1144 |
if ( redirWriter != null ) |
1148 |
try { |
1145 |
try { |
1149 |
redirWriter.flush(); |
1146 |
redirWriter.flush(); |
1150 |
} catch (IOException e) {} |
1147 |
} catch (IOException e) { |
|
|
1148 |
// XXX really ignore? |
1149 |
} |
1151 |
} |
1150 |
} |
1152 |
|
1151 |
|
1153 |
public void close() { |
1152 |
public void close() { |
Lines 1159-1183
Link Here
|
1159 |
/** ----------------- Private helper methods -----------------*/ |
1158 |
/** ----------------- Private helper methods -----------------*/ |
1160 |
|
1159 |
|
1161 |
private void redirOpen() { |
1160 |
private void redirOpen() { |
|
|
1161 |
File redirFile = null; |
1162 |
try { |
1162 |
try { |
1163 |
File redirDirFile = outputSettings ().getDirectory(); |
1163 |
File redirDirFile = outputSettings ().getDirectory(); |
1164 |
|
1164 |
|
1165 |
String name = ""; |
1165 |
String name = ""; |
1166 |
if (tab != null) { |
1166 |
if (tab != null) { |
1167 |
name = tab.getName(); |
1167 |
name = tab.getName(); |
1168 |
int ispace = tab.getName().indexOf(' '); |
1168 |
int ispace = name.indexOf(' '); |
1169 |
if (ispace > 0) |
1169 |
if (ispace > 0) |
1170 |
name = name.substring( 0, ispace ); |
1170 |
name = name.substring( 0, ispace ); |
1171 |
} |
1171 |
} |
|
|
1172 |
name = name.replace(File.separatorChar, '_'); |
1172 |
name = name + REDIR_EXT; |
1173 |
name = name + REDIR_EXT; |
1173 |
File redirFile = new File (redirDirFile, name); |
1174 |
redirFile = new File (redirDirFile, name); |
1174 |
|
1175 |
|
1175 |
redirFile.createNewFile(); |
1176 |
redirFile.createNewFile(); |
1176 |
redirWriter = new FileWriter(redirFile.getAbsolutePath(),true); |
1177 |
redirWriter = new FileWriter(redirFile.getAbsolutePath(),true); |
1177 |
|
1178 |
|
1178 |
redirOpened = true; |
1179 |
redirOpened = true; |
1179 |
} catch (Exception e) { |
1180 |
} catch (Exception e) { |
1180 |
e.printStackTrace(); |
1181 |
ErrorManager.getDefault().annotate(e, ErrorManager.UNKNOWN, "Redir file: " + redirFile, null, null, null); // NOI18N |
|
|
1182 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
1181 |
} |
1183 |
} |
1182 |
} |
1184 |
} |
1183 |
|
1185 |
|
Lines 1187-1213
Link Here
|
1187 |
redirWriter.close(); |
1189 |
redirWriter.close(); |
1188 |
redirWriter = null; |
1190 |
redirWriter = null; |
1189 |
} catch (IOException e) { |
1191 |
} catch (IOException e) { |
1190 |
e.printStackTrace(); |
1192 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
1191 |
} |
1193 |
} |
1192 |
} |
1194 |
} |
1193 |
|
1195 |
|
1194 |
private void redirPrint(char[] chars,int offs, int len) { |
1196 |
private void redirPrint(char[] chars,int offs, int len) { |
1195 |
if ( redirWriter == null ) |
1197 |
if ( redirWriter == null ) |
1196 |
redirOpen(); |
1198 |
redirOpen(); |
|
|
1199 |
if (redirWriter == null) return; |
1197 |
try { |
1200 |
try { |
1198 |
redirWriter.write(chars, offs, len); |
1201 |
redirWriter.write(chars, offs, len); |
1199 |
} catch (IOException e) { |
1202 |
} catch (IOException e) { |
1200 |
e.printStackTrace(); |
1203 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
1201 |
} |
1204 |
} |
1202 |
} |
1205 |
} |
1203 |
|
1206 |
|
1204 |
private void redirPrint(String str) { |
1207 |
private void redirPrint(String str) { |
1205 |
if ( redirWriter == null ) |
1208 |
if ( redirWriter == null ) |
1206 |
redirOpen(); |
1209 |
redirOpen(); |
|
|
1210 |
if (redirWriter == null) return; |
1207 |
try { |
1211 |
try { |
1208 |
redirWriter.write(str); |
1212 |
redirWriter.write(str); |
1209 |
} catch (IOException e) { |
1213 |
} catch (IOException e) { |
1210 |
e.printStackTrace(); |
1214 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
1211 |
} |
1215 |
} |
1212 |
} |
1216 |
} |
1213 |
|
1217 |
|
Lines 1327-1333
Link Here
|
1327 |
if (aterm.getHistoryBuffSize () - aterm.getHistorySize () > 0) { |
1331 |
if (aterm.getHistoryBuffSize () - aterm.getHistorySize () > 0) { |
1328 |
try { |
1332 |
try { |
1329 |
reset (); |
1333 |
reset (); |
1330 |
} catch (Exception exc) {} |
1334 |
} catch (Exception exc) { |
|
|
1335 |
// XXX really ignore? |
1336 |
} |
1331 |
} |
1337 |
} |
1332 |
|
1338 |
|
1333 |
} |
1339 |
} |
Lines 1450-1461
Link Here
|
1450 |
try { |
1456 |
try { |
1451 |
tab.inWriter.write(c); |
1457 |
tab.inWriter.write(c); |
1452 |
} catch (Exception x) { |
1458 |
} catch (Exception x) { |
|
|
1459 |
// XXX really ignore? |
1453 |
} |
1460 |
} |
1454 |
} |
1461 |
} |
1455 |
public void sendChars(char[] c, int offset, int n) { |
1462 |
public void sendChars(char[] c, int offset, int n) { |
1456 |
try { |
1463 |
try { |
1457 |
tab.inWriter.write(c, offset, n); |
1464 |
tab.inWriter.write(c, offset, n); |
1458 |
} catch (Exception x) { |
1465 |
} catch (Exception x) { |
|
|
1466 |
// XXX really ignore? |
1459 |
} |
1467 |
} |
1460 |
} |
1468 |
} |
1461 |
} |
1469 |
} |
Lines 1465-1470
Link Here
|
1465 |
updateCopyCutAction (); |
1473 |
updateCopyCutAction (); |
1466 |
if (csa == null) { |
1474 |
if (csa == null) { |
1467 |
try { |
1475 |
try { |
|
|
1476 |
// XXX what is wrong with SystemAction.get(PopupAction.class)? |
1468 |
Class popup = Class.forName("org.openide.actions.PopupAction"); // NOI18N |
1477 |
Class popup = Class.forName("org.openide.actions.PopupAction"); // NOI18N |
1469 |
csa = (CallbackSystemAction) CallbackSystemAction.get(popup); |
1478 |
csa = (CallbackSystemAction) CallbackSystemAction.get(popup); |
1470 |
} catch (ClassNotFoundException e) { |
1479 |
} catch (ClassNotFoundException e) { |