1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 05:15:43 +02:00

Fix warnings and static method access.

Change-Id: Ic3d4eda4ca1e982984787bd638e082489ae3b63b
Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
Greg Watson 2015-05-21 16:57:01 -04:00
parent ce6a031731
commit 2340a50b07
2 changed files with 18 additions and 17 deletions

View file

@ -22,8 +22,8 @@ import org.eclipse.ui.console.IConsole;
*/ */
public class TerminalConsoleUtility { public class TerminalConsoleUtility {
/** /**
* Opens a dialog to allow selection of an IRemoteConnection, * Opens a dialog to allow selection of an IRemoteConnection,
* encoding, etc. and then open a console to it. * encoding, etc. and then open a console to it.
*/ */
public void openConsole() { public void openConsole() {
new TerminalConsoleFactory().openConsole(); new TerminalConsoleFactory().openConsole();
@ -31,19 +31,21 @@ public class TerminalConsoleUtility {
/** /**
* Open a specific IRemoteConnection and encoding combination. * Open a specific IRemoteConnection and encoding combination.
*
* @param connection * @param connection
* @param encoding * @param encoding
*/ */
public static void openConsole(final IRemoteConnection connection, final String encoding) { public static void openConsole(final IRemoteConnection connection, final String encoding) {
new TerminalConsoleFactory().openConsole(connection, encoding); TerminalConsoleFactory.openConsole(connection, encoding);
} }
/** /**
* Find an existing console for the given IRemoteConnection * Find an existing console for the given IRemoteConnection
*
* @param connection * @param connection
* @return * @return
*/ */
public static List<IConsole> findConsole(IRemoteConnection connection) { public static List<IConsole> findConsole(IRemoteConnection connection) {
return new TerminalConsoleFactory().findConsole(connection); return TerminalConsoleFactory.findConsole(connection);
} }
} }

View file

@ -47,25 +47,24 @@ public class TerminalConsoleFactory implements IConsoleFactory {
}; };
j.schedule(); j.schedule();
} }
private static IStatus openConsoleImplementation( final IRemoteConnection connection, private static IStatus openConsoleImplementation(final IRemoteConnection connection, final String encoding,
final String encoding, IProgressMonitor monitor) { IProgressMonitor monitor) {
IRemoteCommandShellService commandShellService = connection.getService(IRemoteCommandShellService.class); IRemoteCommandShellService commandShellService = connection.getService(IRemoteCommandShellService.class);
if (commandShellService == null) { if (commandShellService == null) {
return Status.CANCEL_STATUS; return Status.CANCEL_STATUS;
} }
try { try {
IConsole ret = createConsole(connection, encoding, commandShellService, monitor); createConsole(connection, encoding, commandShellService, monitor);
return Status.OK_STATUS; return Status.OK_STATUS;
} catch(RemoteConnectionException rce) { } catch (RemoteConnectionException rce) {
return rce.getStatus(); return rce.getStatus();
} }
} }
private static IConsole createConsole( final IRemoteConnection connection, private static IConsole createConsole(final IRemoteConnection connection, final String encoding,
final String encoding, IRemoteCommandShellService service, IRemoteCommandShellService service, IProgressMonitor monitor) throws RemoteConnectionException {
IProgressMonitor monitor) throws RemoteConnectionException {
if (!connection.isOpen()) { if (!connection.isOpen()) {
connection.open(monitor); connection.open(monitor);
} }
@ -81,7 +80,7 @@ public class TerminalConsoleFactory implements IConsoleFactory {
consoleManager.showConsoleView(terminalConsole); consoleManager.showConsoleView(terminalConsole);
return terminalConsole; return terminalConsole;
} }
private static int findNextIndex(IConsoleManager consoleManager, IRemoteConnection connection) { private static int findNextIndex(IConsoleManager consoleManager, IRemoteConnection connection) {
IConsole[] consoles = consoleManager.getConsoles(); IConsole[] consoles = consoleManager.getConsoles();
boolean[] indices = new boolean[consoles.length]; boolean[] indices = new boolean[consoles.length];
@ -99,7 +98,7 @@ public class TerminalConsoleFactory implements IConsoleFactory {
} }
return index; return index;
} }
public static List<IConsole> findConsole(IRemoteConnection connection) { public static List<IConsole> findConsole(IRemoteConnection connection) {
ArrayList<IConsole> ret = new ArrayList<IConsole>(); ArrayList<IConsole> ret = new ArrayList<IConsole>();
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
@ -114,5 +113,5 @@ public class TerminalConsoleFactory implements IConsoleFactory {
} }
return ret; return ret;
} }
} }