mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 09:55:29 +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:
parent
ce6a031731
commit
2340a50b07
2 changed files with 18 additions and 17 deletions
|
@ -22,8 +22,8 @@ import org.eclipse.ui.console.IConsole;
|
|||
*/
|
||||
public class TerminalConsoleUtility {
|
||||
/**
|
||||
* Opens a dialog to allow selection of an IRemoteConnection,
|
||||
* encoding, etc. and then open a console to it.
|
||||
* Opens a dialog to allow selection of an IRemoteConnection,
|
||||
* encoding, etc. and then open a console to it.
|
||||
*/
|
||||
public void openConsole() {
|
||||
new TerminalConsoleFactory().openConsole();
|
||||
|
@ -31,19 +31,21 @@ public class TerminalConsoleUtility {
|
|||
|
||||
/**
|
||||
* Open a specific IRemoteConnection and encoding combination.
|
||||
*
|
||||
* @param connection
|
||||
* @param 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
|
||||
*
|
||||
* @param connection
|
||||
* @return
|
||||
*/
|
||||
public static List<IConsole> findConsole(IRemoteConnection connection) {
|
||||
return new TerminalConsoleFactory().findConsole(connection);
|
||||
return TerminalConsoleFactory.findConsole(connection);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,25 +47,24 @@ public class TerminalConsoleFactory implements IConsoleFactory {
|
|||
};
|
||||
j.schedule();
|
||||
}
|
||||
|
||||
private static IStatus openConsoleImplementation( final IRemoteConnection connection,
|
||||
final String encoding, IProgressMonitor monitor) {
|
||||
|
||||
private static IStatus openConsoleImplementation(final IRemoteConnection connection, final String encoding,
|
||||
IProgressMonitor monitor) {
|
||||
IRemoteCommandShellService commandShellService = connection.getService(IRemoteCommandShellService.class);
|
||||
if (commandShellService == null) {
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
try {
|
||||
IConsole ret = createConsole(connection, encoding, commandShellService, monitor);
|
||||
createConsole(connection, encoding, commandShellService, monitor);
|
||||
return Status.OK_STATUS;
|
||||
} catch(RemoteConnectionException rce) {
|
||||
} catch (RemoteConnectionException rce) {
|
||||
return rce.getStatus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static IConsole createConsole( final IRemoteConnection connection,
|
||||
final String encoding, IRemoteCommandShellService service,
|
||||
IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
|
||||
private static IConsole createConsole(final IRemoteConnection connection, final String encoding,
|
||||
IRemoteCommandShellService service, IProgressMonitor monitor) throws RemoteConnectionException {
|
||||
if (!connection.isOpen()) {
|
||||
connection.open(monitor);
|
||||
}
|
||||
|
@ -81,7 +80,7 @@ public class TerminalConsoleFactory implements IConsoleFactory {
|
|||
consoleManager.showConsoleView(terminalConsole);
|
||||
return terminalConsole;
|
||||
}
|
||||
|
||||
|
||||
private static int findNextIndex(IConsoleManager consoleManager, IRemoteConnection connection) {
|
||||
IConsole[] consoles = consoleManager.getConsoles();
|
||||
boolean[] indices = new boolean[consoles.length];
|
||||
|
@ -99,7 +98,7 @@ public class TerminalConsoleFactory implements IConsoleFactory {
|
|||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
public static List<IConsole> findConsole(IRemoteConnection connection) {
|
||||
ArrayList<IConsole> ret = new ArrayList<IConsole>();
|
||||
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
|
||||
|
@ -114,5 +113,5 @@ public class TerminalConsoleFactory implements IConsoleFactory {
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue