Skip to content

Commit

Permalink
adapt Java project to MultiLanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
kimokipo committed Jul 11, 2022
1 parent 8fe33b3 commit f49f67e
Show file tree
Hide file tree
Showing 15 changed files with 288 additions and 38 deletions.
11 changes: 11 additions & 0 deletions JavaProject/.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1657555241817</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
11 changes: 11 additions & 0 deletions JavaProject/bin/.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1657555241817</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Binary file modified JavaProject/bin/release/ScratchHome2.0.jar
Binary file not shown.
Binary file added JavaProject/bin/release/ScratchHome2.0.zip
Binary file not shown.
Binary file added JavaProject/bin/release/ScratchHome_Server.exe
Binary file not shown.
159 changes: 159 additions & 0 deletions JavaProject/bin/src/com/ScratchHome/ClassDiagramTest.ucls
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<class-diagram version="1.2.4" icons="true" always-add-relationships="false" generalizations="true" realizations="true"
associations="true" dependencies="false" nesting-relationships="true" router="FAN">
<class id="1" language="java" name="src.com.ScratchHome.ScratchListener" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/ScratchListener.java" binary="false" corner="BOTTOM_RIGHT">
<position height="349" width="322" x="52" y="286"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="2" language="java" name="src.com.ScratchHome.ScratchAction" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/ScratchAction.java" binary="false" corner="BOTTOM_RIGHT">
<position height="259" width="248" x="395" y="-13"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="3" language="java" name="src.com.ScratchHome.JSONAction" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/JSONAction.java" binary="false" corner="BOTTOM_RIGHT">
<position height="259" width="371" x="-16" y="-13"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="4" language="java" name="src.com.ScratchHome.ControlPanel" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/ControlPanel.java" binary="false" corner="BOTTOM_RIGHT">
<position height="223" width="281" x="395" y="675"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="5" language="java" name="src.com.ScratchHome.ScratchHomePlugin" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/ScratchHomePlugin.java" binary="false" corner="BOTTOM_RIGHT">
<position height="133" width="261" x="683" y="-13"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="6" language="java" name="src.com.ScratchHome.HomeModifier" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/HomeModifier.java" binary="false" corner="BOTTOM_RIGHT">
<position height="97" width="191" x="984" y="-13"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="7" language="java" name="src.com.ScratchHome.CameraListener" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/CameraListener.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="812" y="217"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="8" language="java" name="src.com.ScratchHome.SendToScratch" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/SendToScratch.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="1047" y="217"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="9" language="java" name="src.com.ScratchHome.PositionCameraListener" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/PositionCameraListener.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="1282" y="217"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="10" language="java" name="src.com.ScratchHome.ClickListener" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/ClickListener.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="1538" y="253"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="11" language="java" name="src.com.ScratchHome.ObserverInfo" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/ObserverInfo.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="1763" y="280"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<association id="12">
<bendpoint x="425" y="286"/>
<end type="SOURCE" refId="4" navigable="false">
<attribute id="13" name="sa">
<position height="0" width="0" x="0" y="0"/>
</attribute>
<multiplicity id="14" minimum="0" maximum="1">
<position height="0" width="0" x="0" y="0"/>
</multiplicity>
</end>
<end type="TARGET" refId="2" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="15">
<end type="SOURCE" refId="1" navigable="false">
<attribute id="16" name="controlpanel">
<position height="0" width="0" x="0" y="0"/>
</attribute>
<multiplicity id="17" minimum="0" maximum="1">
<position height="0" width="0" x="0" y="0"/>
</multiplicity>
</end>
<end type="TARGET" refId="4" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="18">
<end type="SOURCE" refId="2" navigable="false">
<attribute id="19" name="scratchListener">
<position height="0" width="0" x="0" y="0"/>
</attribute>
<multiplicity id="20" minimum="0" maximum="1">
<position height="0" width="0" x="0" y="0"/>
</multiplicity>
</end>
<end type="TARGET" refId="1" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="21">
<bendpoint x="404" y="286"/>
<end type="SOURCE" refId="2" navigable="false">
<attribute id="22" name="controlPanel">
<position height="0" width="0" x="0" y="0"/>
</attribute>
<multiplicity id="23" minimum="0" maximum="1">
<position height="0" width="0" x="0" y="0"/>
</multiplicity>
</end>
<end type="TARGET" refId="4" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</classifier-display>
<association-display labels="true" multiplicity="true"/>
</class-diagram>
Binary file modified JavaProject/bin/src/com/ScratchHome/ControlPanel$6.class
Binary file not shown.
Binary file modified JavaProject/bin/src/com/ScratchHome/ScratchAction.class
Binary file not shown.
Binary file modified JavaProject/bin/src/com/ScratchHome/ScratchListener.class
Binary file not shown.
Binary file modified JavaProject/release/ScratchHome2.0.jar
Binary file not shown.
Binary file modified JavaProject/release/ScratchHome2.0.zip
Binary file not shown.
103 changes: 82 additions & 21 deletions JavaProject/src/com/ScratchHome/ClassDiagramTest.ucls
Original file line number Diff line number Diff line change
Expand Up @@ -55,36 +55,97 @@
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<association id="7">
<bendpoint x="404" y="286"/>
<end type="SOURCE" refId="2" navigable="false">
<attribute id="8" name="controlPanel"/>
<multiplicity id="9" minimum="0" maximum="1"/>
<class id="7" language="java" name="src.com.ScratchHome.CameraListener" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/CameraListener.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="812" y="217"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="8" language="java" name="src.com.ScratchHome.SendToScratch" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/SendToScratch.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="1047" y="217"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="9" language="java" name="src.com.ScratchHome.PositionCameraListener" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/PositionCameraListener.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="1282" y="217"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="10" language="java" name="src.com.ScratchHome.ClickListener" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/ClickListener.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="1538" y="253"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="11" language="java" name="src.com.ScratchHome.ObserverInfo" project="JavaProject"
file="/JavaProject/src/com/ScratchHome/ObserverInfo.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="1763" y="280"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<association id="12">
<bendpoint x="425" y="286"/>
<end type="SOURCE" refId="4" navigable="false">
<attribute id="13" name="sa">
<position height="0" width="0" x="0" y="0"/>
</attribute>
<multiplicity id="14" minimum="0" maximum="1">
<position height="0" width="0" x="0" y="0"/>
</multiplicity>
</end>
<end type="TARGET" refId="4" navigable="true"/>
<end type="TARGET" refId="2" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="10">
<end type="SOURCE" refId="2" navigable="false">
<attribute id="11" name="scratchListener"/>
<multiplicity id="12" minimum="0" maximum="1"/>
<association id="15">
<end type="SOURCE" refId="1" navigable="false">
<attribute id="16" name="controlpanel">
<position height="0" width="0" x="0" y="0"/>
</attribute>
<multiplicity id="17" minimum="0" maximum="1">
<position height="0" width="0" x="0" y="0"/>
</multiplicity>
</end>
<end type="TARGET" refId="1" navigable="true"/>
<end type="TARGET" refId="4" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="13">
<bendpoint x="425" y="286"/>
<end type="SOURCE" refId="4" navigable="false">
<attribute id="14" name="sa"/>
<multiplicity id="15" minimum="0" maximum="1"/>
<association id="18">
<end type="SOURCE" refId="2" navigable="false">
<attribute id="19" name="scratchListener">
<position height="0" width="0" x="0" y="0"/>
</attribute>
<multiplicity id="20" minimum="0" maximum="1">
<position height="0" width="0" x="0" y="0"/>
</multiplicity>
</end>
<end type="TARGET" refId="2" navigable="true"/>
<end type="TARGET" refId="1" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="16">
<end type="SOURCE" refId="1" navigable="false">
<attribute id="17" name="controlpanel"/>
<multiplicity id="18" minimum="0" maximum="1"/>
<association id="21">
<bendpoint x="404" y="286"/>
<end type="SOURCE" refId="2" navigable="false">
<attribute id="22" name="controlPanel">
<position height="0" width="0" x="0" y="0"/>
</attribute>
<multiplicity id="23" minimum="0" maximum="1">
<position height="0" width="0" x="0" y="0"/>
</multiplicity>
</end>
<end type="TARGET" refId="4" navigable="true"/>
<display labels="true" multiplicity="true"/>
Expand Down
2 changes: 1 addition & 1 deletion JavaProject/src/com/ScratchHome/ControlPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 12 additions & 4 deletions JavaProject/src/com/ScratchHome/ScratchAction.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package src.com.ScratchHome;



import java.util.HashMap;

import com.eteks.sweethome3d.model.Home;
Expand Down Expand Up @@ -53,7 +51,10 @@ public void execute() {
*/
public void closeListener() {
scratchListener.terminate();
processus1.destroy();
if (processus1 != null && processus1.isAlive()) {
processus1.destroy();
processus1 = null;
}
}

/**
Expand All @@ -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();
Expand Down Expand Up @@ -112,13 +114,19 @@ public void reload(HashMap<String, String> 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();
}

}


Expand Down
Loading

0 comments on commit f49f67e

Please sign in to comment.