-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugger.java
More file actions
52 lines (39 loc) · 1.54 KB
/
Debugger.java
File metadata and controls
52 lines (39 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package cpubug.debugger;
import javafx.scene.control.TabPane;
import javafx.scene.layout.Pane;
import lombok.Getter;
import lombok.Setter;
import me.david.sploty4.Sploty;
import me.david.sploty4.gui.tab.BrowserTab;
import java.util.ArrayList;
import java.util.List;
public class Debugger extends Pane {
@Getter private final BrowserTab browserTab;
@Getter @Setter private List<DebugTab> debugTabs = new ArrayList<>();
@Getter TabPane tabs = new TabPane();
public Debugger(final BrowserTab browserTab) {
this.browserTab = browserTab;
setVisible(false);
tabs.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE);
debugTabs.add(new DomExplorer(browserTab.getList().getWindow(), browserTab));
debugTabs.add(new Console(browserTab.getList().getWindow(), browserTab));
debugTabs.forEach(debugTab -> tabs.getTabs().add(debugTab));
getChildren().add(tabs);
}
public <T extends DebugTab> T getDebugTabByClass(Class<T> clazz) {
for (final DebugTab tab : debugTabs)
if (tab.getClass().equals(clazz))
return (T) tab;
Sploty.getLogger().warn("Count not find Debugging Tab named: '" + clazz.getSimpleName() + "'");
return null;
}
public void toggle() {
setVisible(!isVisible());
if (isVisible()) {
browserTab.getSplit().getItems().add(1, this);
browserTab.getSplit().setDividerPosition(1, 0.8);
} else browserTab.getSplit().getItems().remove(this);
layout();
requestLayout();
}
}