-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply code formatting with Spotless and palantir format #62
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 54 additions & 49 deletions
103
ice-adapter/src/main/java/com/faforever/iceadapter/debug/Debug.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,71 @@ | ||
package com.faforever.iceadapter.debug; | ||
|
||
import com.faforever.iceadapter.IceAdapter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.ExecutionException; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class Debug { | ||
//TODO | ||
public static boolean ENABLE_DEBUG_WINDOW_LOG_TEXT_AREA = false; // disabled as this causes high memory and cpu load, should be replaced by limiting the number of lines in the text area | ||
|
||
public static boolean ENABLE_DEBUG_WINDOW = false; | ||
public static boolean ENABLE_INFO_WINDOW = false; | ||
public static int DELAY_UI_MS = 0;//delays the launch of the user interface by X ms | ||
// TODO | ||
public static boolean ENABLE_DEBUG_WINDOW_LOG_TEXT_AREA = | ||
false; // disabled as this causes high memory and cpu load, should be replaced by limiting the number of | ||
// lines in the text area | ||
|
||
private final static DebugFacade debugFacade = new DebugFacade(); | ||
public static boolean ENABLE_DEBUG_WINDOW = false; | ||
public static boolean ENABLE_INFO_WINDOW = false; | ||
public static int DELAY_UI_MS = 0; // delays the launch of the user interface by X ms | ||
|
||
public static void register(Debugger debugger) { | ||
debugFacade.add(debugger); | ||
} | ||
private static final DebugFacade debugFacade = new DebugFacade(); | ||
|
||
public static void remove(Debugger debugger) { | ||
debugFacade.remove(debugger); | ||
} | ||
public static void register(Debugger debugger) { | ||
debugFacade.add(debugger); | ||
} | ||
|
||
public static void init() { | ||
new TelemetryDebugger(IceAdapter.TELEMETRY_SERVER, IceAdapter.gameId, IceAdapter.id); | ||
public static void remove(Debugger debugger) { | ||
debugFacade.remove(debugger); | ||
} | ||
|
||
// Debugger window is started and set to debugFuture when either window is requested as the info window can be used to open the debug window | ||
// This is not used anymore as the debug window is started and hidden in case it is requested via the tray icon | ||
if(! ENABLE_DEBUG_WINDOW && ! ENABLE_INFO_WINDOW) { | ||
return; | ||
} | ||
public static void init() { | ||
new TelemetryDebugger(IceAdapter.TELEMETRY_SERVER, IceAdapter.gameId, IceAdapter.id); | ||
|
||
if(isJavaFxSupported()) { | ||
new Thread(() -> { | ||
try { | ||
Class.forName("com.faforever.iceadapter.debug.DebugWindow").getMethod("launchApplication").invoke(null); | ||
} catch (IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) { | ||
e.printStackTrace(); | ||
log.error("Could not create DebugWindow. Running without debug window."); | ||
} | ||
}).start(); //Completes future once application started | ||
} else { | ||
log.info("No JavaFX support detected. Running without debug window."); | ||
} | ||
} | ||
// Debugger window is started and set to debugFuture when either window is requested as the info window can be | ||
// used to open the debug window | ||
// This is not used anymore as the debug window is started and hidden in case it is requested via the tray icon | ||
if (!ENABLE_DEBUG_WINDOW && !ENABLE_INFO_WINDOW) { | ||
return; | ||
} | ||
|
||
if (isJavaFxSupported()) { | ||
new Thread(() -> { | ||
try { | ||
Class.forName("com.faforever.iceadapter.debug.DebugWindow") | ||
.getMethod("launchApplication") | ||
.invoke(null); | ||
} catch (IllegalAccessException | ||
| ClassNotFoundException | ||
| NoSuchMethodException | ||
| InvocationTargetException e) { | ||
e.printStackTrace(); | ||
log.error("Could not create DebugWindow. Running without debug window."); | ||
} | ||
}) | ||
.start(); // Completes future once application started | ||
} else { | ||
log.info("No JavaFX support detected. Running without debug window."); | ||
} | ||
} | ||
|
||
public static Debugger debug() { | ||
return debugFacade; | ||
} | ||
public static Debugger debug() { | ||
return debugFacade; | ||
} | ||
|
||
public static boolean isJavaFxSupported() { | ||
try { | ||
Debug.class.getClassLoader().loadClass("javafx.application.Application"); | ||
return true; | ||
} catch(ClassNotFoundException e) { | ||
log.warn("Could not create debug window, no JavaFX found."); | ||
return false; | ||
} | ||
} | ||
public static boolean isJavaFxSupported() { | ||
try { | ||
Debug.class.getClassLoader().loadClass("javafx.application.Application"); | ||
return true; | ||
} catch (ClassNotFoundException e) { | ||
log.warn("Could not create debug window, no JavaFX found."); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it to check instead =)