Skip to content

Commit

Permalink
Discard UIManager Look & Feel Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ME1312 committed Dec 11, 2019
1 parent bc42400 commit c4dd27d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions GalaxiEngine/src/net/ME1312/Galaxi/Engine/GalaxiEngine.java
Expand Up @@ -17,7 +17,6 @@
import net.ME1312.Galaxi.Plugin.App;
import net.ME1312.Galaxi.Plugin.Plugin;
import net.ME1312.Galaxi.Plugin.PluginInfo;
import org.jline.reader.LineReader;
import org.json.JSONObject;

import javax.swing.*;
Expand Down Expand Up @@ -102,7 +101,7 @@ private GalaxiEngine(PluginInfo app) throws Exception {
engine.setSignature(new Version(manifest.getMainAttributes().getValue("Implementation-Version")));
engine.setIcon(GalaxiEngine.class.getResourceAsStream("/net/ME1312/Galaxi/Engine/Library/Files/GalaxiIcon.png"));

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Util.isException(() -> UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()));
pluginManager.findClasses(engine.get().getClass());
pluginManager.findClasses(this.app.get().getClass());

Expand Down
Expand Up @@ -354,7 +354,7 @@ private ParsedCommand parse(String command) {
return parser.parse(command, (int) command.codePoints().count(), false);
}

private class Parser implements org.jline.reader.Parser {
private final class Parser implements org.jline.reader.Parser {
@Override
public ParsedCommand parse(final String LINE, final int CURSOR, ParseContext ctx) throws SyntaxError {
return parse(LINE, CURSOR, false);
Expand Down Expand Up @@ -384,7 +384,10 @@ public ParsedCommand parse(final String LINE, final int CURSOR, boolean command)
break;
} else {
if (ch == '\'') { // Begin, end, or skip a literal block
if (literal && i + 1 < LINE.codePoints().count() && LINE.codePointAt(i + 1) == '\'') part.appendCodePoint(ch);
if (literal && i + 1 < LINE.codePoints().count() && LINE.codePointAt(i + 1) == '\'') {
part.appendCodePoint(ch);
if (CURSOR > i) wcursor++;
}
literal = !literal;
} else if (literal) { // Accept characters literally
if (CURSOR > i) wcursor++;
Expand All @@ -404,7 +407,10 @@ public ParsedCommand parse(final String LINE, final int CURSOR, boolean command)
between = false;
switch (ch) {
case '\"': // Begin, end, or skip a whitespaced block
if (whitespaced && i + 1 < LINE.codePoints().count() && LINE.codePointAt(i + 1) == '\"') part.appendCodePoint(ch);
if (whitespaced && i + 1 < LINE.codePoints().count() && LINE.codePointAt(i + 1) == '\"') {
part.appendCodePoint(ch);
if (CURSOR > i) wcursor++;
}
whitespaced = !whitespaced;
continue;
case '$': // Replace java system variables
Expand All @@ -427,8 +433,8 @@ public ParsedCommand parse(final String LINE, final int CURSOR, boolean command)
if (CURSOR > i) rwcursor++;
}
} else {
if (CURSOR > i) wcursor++;
part.appendCodePoint(ch);
if (CURSOR > i) wcursor++;
}
continue;
case '%': // Replace environment variables
Expand All @@ -450,8 +456,8 @@ public ParsedCommand parse(final String LINE, final int CURSOR, boolean command)
if (CURSOR > i) rwcursor++;
}
} else {
if (CURSOR > i) wcursor++;
part.appendCodePoint(ch);
if (CURSOR > i) wcursor++;
}
continue;
case '\\': // Parse escape sequences
Expand Down

0 comments on commit c4dd27d

Please sign in to comment.