diff --git a/JavaProject/.project b/JavaProject/.project index 0d2f7a8..1d6438a 100644 --- a/JavaProject/.project +++ b/JavaProject/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1657555241817 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/JavaProject/bin/.project b/JavaProject/bin/.project index 0d2f7a8..1d6438a 100644 --- a/JavaProject/bin/.project +++ b/JavaProject/bin/.project @@ -14,4 +14,15 @@ org.eclipse.jdt.core.javanature + + + 1657555241817 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/JavaProject/bin/release/ScratchHome2.0.jar b/JavaProject/bin/release/ScratchHome2.0.jar index 227fb56..8b22f00 100644 Binary files a/JavaProject/bin/release/ScratchHome2.0.jar and b/JavaProject/bin/release/ScratchHome2.0.jar differ diff --git a/JavaProject/bin/release/ScratchHome2.0.zip b/JavaProject/bin/release/ScratchHome2.0.zip new file mode 100644 index 0000000..ce8fafb Binary files /dev/null and b/JavaProject/bin/release/ScratchHome2.0.zip differ diff --git a/JavaProject/bin/release/ScratchHome_Server.exe b/JavaProject/bin/release/ScratchHome_Server.exe new file mode 100644 index 0000000..0902e42 Binary files /dev/null and b/JavaProject/bin/release/ScratchHome_Server.exe differ diff --git a/JavaProject/bin/src/com/ScratchHome/ClassDiagramTest.ucls b/JavaProject/bin/src/com/ScratchHome/ClassDiagramTest.ucls new file mode 100644 index 0000000..cdc91c1 --- /dev/null +++ b/JavaProject/bin/src/com/ScratchHome/ClassDiagramTest.ucls @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JavaProject/bin/src/com/ScratchHome/ControlPanel$6.class b/JavaProject/bin/src/com/ScratchHome/ControlPanel$6.class index cb4449b..0ba1500 100644 Binary files a/JavaProject/bin/src/com/ScratchHome/ControlPanel$6.class and b/JavaProject/bin/src/com/ScratchHome/ControlPanel$6.class differ diff --git a/JavaProject/bin/src/com/ScratchHome/ScratchAction.class b/JavaProject/bin/src/com/ScratchHome/ScratchAction.class index 856f1bd..b2581a3 100644 Binary files a/JavaProject/bin/src/com/ScratchHome/ScratchAction.class and b/JavaProject/bin/src/com/ScratchHome/ScratchAction.class differ diff --git a/JavaProject/bin/src/com/ScratchHome/ScratchListener.class b/JavaProject/bin/src/com/ScratchHome/ScratchListener.class index 94dd239..5fecef7 100644 Binary files a/JavaProject/bin/src/com/ScratchHome/ScratchListener.class and b/JavaProject/bin/src/com/ScratchHome/ScratchListener.class differ diff --git a/JavaProject/release/ScratchHome2.0.jar b/JavaProject/release/ScratchHome2.0.jar index 120704e..8b22f00 100644 Binary files a/JavaProject/release/ScratchHome2.0.jar and b/JavaProject/release/ScratchHome2.0.jar differ diff --git a/JavaProject/release/ScratchHome2.0.zip b/JavaProject/release/ScratchHome2.0.zip index fac1698..ce8fafb 100644 Binary files a/JavaProject/release/ScratchHome2.0.zip and b/JavaProject/release/ScratchHome2.0.zip differ diff --git a/JavaProject/src/com/ScratchHome/ClassDiagramTest.ucls b/JavaProject/src/com/ScratchHome/ClassDiagramTest.ucls index 4167e4d..cdc91c1 100644 --- a/JavaProject/src/com/ScratchHome/ClassDiagramTest.ucls +++ b/JavaProject/src/com/ScratchHome/ClassDiagramTest.ucls @@ -55,36 +55,97 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + + + + + - + - - - - - + + + + + + + + - + - - - - + + + + + + + + + diff --git a/JavaProject/src/com/ScratchHome/ControlPanel.java b/JavaProject/src/com/ScratchHome/ControlPanel.java index 3c45a14..c532ec6 100644 --- a/JavaProject/src/com/ScratchHome/ControlPanel.java +++ b/JavaProject/src/com/ScratchHome/ControlPanel.java @@ -122,8 +122,8 @@ public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { chkDisable_Scratch.setSelected( false ); - chkEnable_SH3D.setSelected( false ); sendToScratch = false; + chkEnable_SH3D.setSelected( false ); String result = "automatic/true"; SendToScratch.sendMessage(result); } else if (e.getStateChange() == ItemEvent.DESELECTED) { diff --git a/JavaProject/src/com/ScratchHome/ScratchAction.java b/JavaProject/src/com/ScratchHome/ScratchAction.java index 6560de7..222723c 100644 --- a/JavaProject/src/com/ScratchHome/ScratchAction.java +++ b/JavaProject/src/com/ScratchHome/ScratchAction.java @@ -1,7 +1,5 @@ package src.com.ScratchHome; - - import java.util.HashMap; import com.eteks.sweethome3d.model.Home; @@ -53,7 +51,10 @@ public void execute() { */ public void closeListener() { scratchListener.terminate(); - processus1.destroy(); + if (processus1 != null && processus1.isAlive()) { + processus1.destroy(); + processus1 = null; + } } /** @@ -71,6 +72,7 @@ public void reInstanciate() { */ public void reupListener() { if (!scratchListener.isRunning()) { + scratchListener = new ScratchListener(home, controlPanel, language); thread = new Thread(scratchListener); thread.start(); @@ -112,13 +114,19 @@ public void reload(HashMap language) { * */ private void launchServer() { + String commandServer = System.getProperty("os.name").startsWith("Windows") ? ScratchHomePlugin.pluginsPath+"/ScratchHome_Server.exe" : "python3 "+ScratchHomePlugin.pluginsPath+"/ScratchHome_Server.py"; try{ - processus1 = Runtime.getRuntime().exec(commandServer); + if (processus1 != null && processus1.isAlive()) { + return; + }else { + processus1 = Runtime.getRuntime().exec(commandServer); + } }catch(Exception e){ e.printStackTrace(); } + } diff --git a/JavaProject/src/com/ScratchHome/ScratchListener.java b/JavaProject/src/com/ScratchHome/ScratchListener.java index dfc565d..6a07c19 100644 --- a/JavaProject/src/com/ScratchHome/ScratchListener.java +++ b/JavaProject/src/com/ScratchHome/ScratchListener.java @@ -171,31 +171,31 @@ private void doCommand(String cmdAndArgs) { int color = 0; cmd[2] = cmd[2].toLowerCase(); - if (cmd[2].equals(language.get("black").toLowerCase())) { + if (cmd[2].equals("black")) { color = -15000000; } - if (cmd[2].equals(language.get("blue").toLowerCase())) { + if (cmd[2].equals("blue")) { color = -16776961; } - if (cmd[2].equals(language.get("cyan").toLowerCase())) { + if (cmd[2].equals("cyan")) { color = -16711681; } - if (cmd[2].equals(language.get("grey").toLowerCase())) { + if (cmd[2].equals("grey")) { color = -7829368; } - if (cmd[2].equals(language.get("green").toLowerCase())) { + if (cmd[2].equals("green")) { color = -16711936; } - if (cmd[2].equals(language.get("magenta").toLowerCase())) { + if (cmd[2].equals("magenta")) { color = -65281; } - if (cmd[2].equals(language.get("red").toLowerCase())) { + if (cmd[2].equals("red")) { color = -65536; } - if (cmd[2].equals(language.get("white").toLowerCase())) { + if (cmd[2].equals("white")) { color = -1; } - if (cmd[2].equals(language.get("yellow").toLowerCase())) { + if (cmd[2].equals("yellow")) { color = -256; } controlpanel.changeMessage(cmd[0]+" -- "+name+" -- "+cmd[2]+" -- "+color); @@ -210,7 +210,7 @@ private void doCommand(String cmdAndArgs) { String modifier = ""; String hash = ""; String name = ""; - if(cmd[1].equals(language.get("On")) || cmd[1].equals(language.get("Off"))){ + if(cmd[1].equals("Switch On") || cmd[1].equals("Switch Off")){ cmd[2] = cmd[2].replaceAll("%..", ""); name = cmd[2].substring(0,cmd[2].indexOf("(")); @@ -225,10 +225,10 @@ private void doCommand(String cmdAndArgs) { } modifier = modifier.toLowerCase(); - if (modifier.equals(language.get("On").toLowerCase())) { + if (modifier.equals("switch on")) { color = -256; } - if (modifier.equals(language.get("Off").toLowerCase())) { + if (modifier.equals("switch off")) { color = -15000000; } controlpanel.changeMessage("switchOnOff -- "+modifier+" -- "+name);