mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
Terminal: Fix findbugs warnings
This commit is contained in:
parent
d0a8f76ace
commit
86420140f4
2 changed files with 27 additions and 4 deletions
|
@ -26,9 +26,10 @@ import org.eclipse.jface.resource.ImageRegistry;
|
|||
import org.eclipse.tm.internal.terminal.control.actions.ImageConsts;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.Logger;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class TerminalPlugin extends AbstractUIPlugin {
|
||||
protected static TerminalPlugin fDefault;
|
||||
private static TerminalPlugin plugin;
|
||||
public static final String PLUGIN_ID = "org.eclipse.tm.terminal"; //$NON-NLS-1$
|
||||
public static final String HELP_VIEW = PLUGIN_ID + ".terminal_view"; //$NON-NLS-1$
|
||||
|
||||
|
@ -36,13 +37,28 @@ public class TerminalPlugin extends AbstractUIPlugin {
|
|||
* The constructor.
|
||||
*/
|
||||
public TerminalPlugin() {
|
||||
fDefault = this;
|
||||
}
|
||||
/**
|
||||
* Returns the shared instance.
|
||||
*/
|
||||
public static TerminalPlugin getDefault() {
|
||||
return fDefault;
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
public static boolean isLogInfoEnabled() {
|
||||
|
|
|
@ -987,12 +987,19 @@ public class VT100Emulator implements ControlListener {
|
|||
String positionReport = "\u001b[" + (relativeCursorLine() + 1) + ";" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
(getCursorColumn() + 1) + "R"; //$NON-NLS-1$
|
||||
|
||||
OutputStreamWriter streamWriter = null;
|
||||
try {
|
||||
OutputStreamWriter streamWriter = new OutputStreamWriter(terminal.getOutputStream(), "ISO-8859-1"); //$NON-NLS-1$
|
||||
streamWriter = new OutputStreamWriter(terminal.getOutputStream(), "ISO-8859-1"); //$NON-NLS-1$
|
||||
streamWriter.write(positionReport, 0, positionReport.length());
|
||||
streamWriter.flush();
|
||||
} catch (IOException ex) {
|
||||
Logger.log("Caught IOException!"); //$NON-NLS-1$
|
||||
} finally {
|
||||
if (streamWriter != null) {
|
||||
try {
|
||||
streamWriter.close();
|
||||
} catch (IOException e) { /* ignored on purpose */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue