Skip to content

Commit 3ba9847

Browse files
committed
Making the threads internal
1 parent 62c6a98 commit 3ba9847

File tree

3 files changed

+54
-50
lines changed

3 files changed

+54
-50
lines changed

src/main/java/com/neuronrobotics/bowlerstudio/BowlerStudioMenu.java

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -604,34 +604,38 @@ public void run() {
604604
}
605605

606606
public static void checkandDelete(String url) {
607-
Alert alert = new Alert(AlertType.CONFIRMATION);
608-
alert.setTitle("Are you sure you have published all your work?");
609-
alert.setHeaderText("This will wipe out the local cache for " + url);
610-
alert.setContentText("All files that are not published will be deleted");
611-
Node root = alert.getDialogPane();
612-
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
613-
stage.setOnCloseRequest(ev -> alert.hide());
614-
FontSizeManager.addListener(fontNum -> {
615-
int tmp = fontNum - 10;
616-
if (tmp < 12)
617-
tmp = 12;
618-
root.setStyle("-fx-font-size: " + tmp + "pt");
619-
alert.getDialogPane().applyCss();
620-
alert.getDialogPane().layout();
621-
stage.sizeToScene();
607+
BowlerStudio.runLater(() -> {
608+
609+
Alert alert = new Alert(AlertType.CONFIRMATION);
610+
alert.setTitle("Are you sure you have published all your work?");
611+
alert.setHeaderText("This will wipe out the local cache for " + url);
612+
alert.setContentText("All files that are not published will be deleted");
613+
Node root = alert.getDialogPane();
614+
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
615+
stage.setOnCloseRequest(ev -> alert.hide());
616+
FontSizeManager.addListener(fontNum -> {
617+
int tmp = fontNum - 10;
618+
if (tmp < 12)
619+
tmp = 12;
620+
root.setStyle("-fx-font-size: " + tmp + "pt");
621+
alert.getDialogPane().applyCss();
622+
alert.getDialogPane().layout();
623+
stage.sizeToScene();
624+
});
625+
Optional<ButtonType> result = alert.showAndWait();
626+
if (result.get() == ButtonType.OK) {
627+
new Thread(() -> {
628+
ScriptingEngine.deleteRepo(url);
629+
BowlerStudioMenuWorkspace.remove(url);
630+
BowlerStudio.runLater(() -> {
631+
BowlerStudioMenuWorkspace.sort();
632+
});
633+
}).start();
634+
} else {
635+
com.neuronrobotics.sdk.common.Log.error("Nothing was deleted");
636+
}
637+
622638
});
623-
Optional<ButtonType> result = alert.showAndWait();
624-
if (result.get() == ButtonType.OK) {
625-
new Thread(() -> {
626-
ScriptingEngine.deleteRepo(url);
627-
BowlerStudioMenuWorkspace.remove(url);
628-
BowlerStudio.runLater(() -> {
629-
BowlerStudioMenuWorkspace.sort();
630-
});
631-
}).start();
632-
} else {
633-
com.neuronrobotics.sdk.common.Log.error("Nothing was deleted");
634-
}
635639
}
636640

637641
private static MenuResettingEventHandler createLoadCommitsEvent(String url, Menu orgCommits) {
@@ -665,7 +669,7 @@ public void handle(Event event) {
665669
try {
666670
ScriptingEngine.checkout(url, branchName);
667671

668-
ScriptingEngine.openGit(url,git->{
672+
ScriptingEngine.openGit(url, git -> {
669673
Repository repo = git.getRepository();
670674
// com.neuronrobotics.sdk.common.Log.error("Commits of branch: " + branchName);
671675
// com.neuronrobotics.sdk.common.Log.error("-------------------------------------");
@@ -687,8 +691,8 @@ public void handle(Event event) {
687691
// RevCommit previous = null;
688692
for (RevCommit commit : commitsList) {
689693
String date = format.format(new Date(commit.getCommitTime() * 1000L));
690-
String fullData = commit.getName() + "\r\n" + commit.getAuthorIdent().getName() + "\r\n"
691-
+ date + "\r\n" + commit.getFullMessage() + "\r\n"
694+
String fullData = commit.getName() + "\r\n" + commit.getAuthorIdent().getName()
695+
+ "\r\n" + date + "\r\n" + commit.getFullMessage() + "\r\n"
692696
+ "---------------------------------------------------\r\n";// +
693697
// previous==null?"":getDiffOfCommit(previous,commit, repo, git);
694698

@@ -704,7 +708,8 @@ public void handle(Event event) {
704708
tmp.setOnAction(ev -> {
705709
new Thread() {
706710
public void run() {
707-
com.neuronrobotics.sdk.common.Log.error("Selecting \r\n\r\n" + fullData);
711+
com.neuronrobotics.sdk.common.Log
712+
.error("Selecting \r\n\r\n" + fullData);
708713

709714
String branch;
710715
try {
@@ -726,9 +731,11 @@ public void run() {
726731
ScriptingEngine.setCommitContentsAsCurrent(url,
727732
slugify, commit);
728733
} catch (IOException e) {
729-
exp.uncaughtException(Thread.currentThread(), e);
734+
exp.uncaughtException(Thread.currentThread(),
735+
e);
730736
} catch (GitAPIException e) {
731-
exp.uncaughtException(Thread.currentThread(), e);
737+
exp.uncaughtException(Thread.currentThread(),
738+
e);
732739
}
733740
}
734741
}.start();
@@ -745,8 +752,6 @@ public void run() {
745752
}
746753
});
747754

748-
749-
750755
BowlerStudio.runLater(() -> {
751756
orgCommits.hide();
752757
BowlerStudio.runLater(() -> {
@@ -1619,21 +1624,21 @@ public void onLogin(String arg0) {
16191624
try {
16201625
int i = currentIndex + 1;
16211626

1622-
double percent =((double)i)/((double)finalIndex)*100;
1623-
String x = intermediateShape.getName() + " " + type.trim() + " "+String.format("%.1f", percent)+"% finished : " + i + " of "
1624-
+ finalIndex;
1627+
double percent = ((double) i) / ((double) finalIndex) * 100;
1628+
String x = intermediateShape.getName() + " " + type.trim() + " " + String.format("%.1f", percent)
1629+
+ "% finished : " + i + " of " + finalIndex;
16251630
if (showCSGProgress.isSelected()) {
16261631
System.out.println(x);
1627-
if(finalIndex>50) {
1628-
if(percent>90) {
1632+
if (finalIndex > 50) {
1633+
if (percent > 90) {
16291634
SplashManager.closeSplash();
1630-
}else {
1631-
SplashManager.renderSplashFrame((int)percent, x);
1635+
} else {
1636+
SplashManager.renderSplashFrame((int) percent, x);
16321637
}
1633-
}else {
1638+
} else {
16341639
SplashManager.closeSplash();
16351640
}
1636-
}else
1641+
} else
16371642
com.neuronrobotics.sdk.common.Log.error(x);
16381643
} catch (Exception ex) {
16391644
ex.printStackTrace();
@@ -1655,8 +1660,8 @@ public void onLogin(String arg0) {
16551660
// }
16561661
// });
16571662
Runnable r = () -> {
1658-
boolean parseBoolean = Boolean
1659-
.parseBoolean(ConfigurationDatabase.getObject("MenueSettings", "CSG_Advanced_STL", CSG.isPreventNonManifoldTriangles()).toString());
1663+
boolean parseBoolean = Boolean.parseBoolean(ConfigurationDatabase
1664+
.getObject("MenueSettings", "CSG_Advanced_STL", CSG.isPreventNonManifoldTriangles()).toString());
16601665
CSG.setPreventNonManifoldTriangles(parseBoolean);
16611666
useAdvancedSTL.setSelected(parseBoolean);
16621667
showCSGProgress.setSelected(Boolean
@@ -1665,7 +1670,7 @@ public void onLogin(String arg0) {
16651670
new Thread(r).start();
16661671

16671672
CreatureLab3dController.getEngine().setControls(showRuler, idlespin, autohighlight);
1668-
WindowMenu.getItems().addAll(showRuler, idlespin, autohighlight, showCSGProgress,useAdvancedSTL);
1673+
WindowMenu.getItems().addAll(showRuler, idlespin, autohighlight, showCSGProgress, useAdvancedSTL);
16691674

16701675
new Thread() {
16711676
public void run() {

src/main/java/com/neuronrobotics/bowlerstudio/BowlerStudioMenuWorkspace.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ public static void loginEvent() {
6060
ScriptingEngine.setPrintProgress(false);
6161
com.neuronrobotics.sdk.common.Log.error("Pulling workspace " + o);
6262
try {
63-
if (!ScriptingEngine.isUrlAlreadyOpen(o))
64-
ScriptingEngine.pull(o);
63+
ScriptingEngine.pull(o);
6564
} catch(WrongRepositoryStateException ex) {
6665
// ignore, unsaved work
6766
}catch (Exception e) {

0 commit comments

Comments
 (0)