}
public static MessageConsole getApplicationConsole(CloudFoundryServer server,
CloudFoundryApplicationModule appModule, int instanceIndex) {
MessageConsole appConsole = null;
String consoleName = getConsoleId(server.getServer(), appModule, instanceIndex);
for (IConsole console : ConsolePlugin.getDefault().getConsoleManager().getConsoles()) {
if (console instanceof MessageConsole && console.getName().equals(consoleName)) {
appConsole = (MessageConsole) console;
}
}
if (appConsole == null) {
appConsole = new MessageConsole(getConsoleDisplayName(server, appModule, instanceIndex),
CloudFoundryFileConsole.CONSOLE_TYPE, null, true);
appConsole.setAttribute(CloudFoundryFileConsole.ATTRIBUTE_SERVER, server);
appConsole.setAttribute(CloudFoundryFileConsole.ATTRIBUTE_APP, appModule);
appConsole.setAttribute(CloudFoundryFileConsole.ATTRIBUTE_INSTANCE, instanceIndex);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { appConsole });
}
return appConsole;
}