Skip to content

Commit

Permalink
Delete Forge 1.x remains
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Apr 24, 2015
1 parent d2c1228 commit a1fa2a6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 206 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,31 @@

public enum ForgeConsoleManager {
INSTANCE;

private List<ForgeConsole> consoles = new ArrayList<ForgeConsole>();

private ForgeConsoleManager() {
createConsoles();
}

private void createConsoles() {
consoles = new ArrayList<ForgeConsole>();
for (ForgeRuntime runtime : ForgeCorePreferences.INSTANCE.getRuntimes()) {
ForgeConsole console = null;
if (runtime.getVersion().startsWith("1.")) {
console = new org.jboss.tools.forge.ui.internal.console.F1Console(runtime);
} else {
console = new org.jboss.tools.forge.ui.internal.console.F2Console(runtime);
}
ForgeConsole console = new org.jboss.tools.forge.ui.internal.console.F2Console(
runtime);
int index = calculateIndex(console);
consoles.add(index, console);
}
}

public ForgeConsole[] getConsoles() {
return consoles.toArray(new ForgeConsole[consoles.size()]);
}

public ForgeConsole getDefaultConsole() {
return getConsole(ForgeCorePreferences.INSTANCE.getDefaultRuntime());
}

public ForgeConsole getConsole(ForgeRuntime runtime) {
for (ForgeConsole console : getConsoles()) {
if (console.getRuntime() == runtime) {
Expand All @@ -51,7 +47,7 @@ public ForgeConsole getConsole(ForgeRuntime runtime) {
}
return null;
}

private int calculateIndex(ForgeConsole forgeConsole) {
ForgeRuntime runtime = forgeConsole.getRuntime();
String newVersion = runtime.getVersion();
Expand All @@ -63,12 +59,13 @@ private int calculateIndex(ForgeConsole forgeConsole) {
}
return consoles.size();
}

private boolean isNewer(String first, String second) {
String[] firstValues = first.split("\\.|-");
String[] secondValues = second.split("\\.|-");
for (int i = 0; i < 2; i++) {
if (Integer.valueOf(firstValues[i]) < Integer.valueOf(secondValues[i])) {
if (Integer.valueOf(firstValues[i]) < Integer
.valueOf(secondValues[i])) {
return false;
}
}
Expand Down

0 comments on commit a1fa2a6

Please sign in to comment.