Skip to content

Commit 6b1ffc7

Browse files
author
jantje
committed
#1268 introduce otherproperties that currently contains the version flag
Also needs next checkin as there hes been some refactoring
1 parent 33314ec commit 6b1ffc7

File tree

8 files changed

+295
-68
lines changed

8 files changed

+295
-68
lines changed

io.sloeber.core/src/io/sloeber/core/api/BoardDescription.java

+3-14
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class BoardDescription extends Common {
8787
private String myProgrammer = Defaults.getDefaultUploadProtocol();
8888
private String myBoardID = EMPTY;
8989
private Map<String, String> myOptions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
90-
private boolean myIsVersionControlled = false;
90+
9191

9292
/*
9393
* Stuff to make things work
@@ -108,7 +108,7 @@ public class BoardDescription extends Common {
108108
private final String KEY_SLOEBER_UPLOAD_PORT = "UPLOAD.PORT"; //$NON-NLS-1$
109109
private final String KEY_SLOEBER_UPLOAD_TOOL = "UPLOAD.TOOL"; //$NON-NLS-1$
110110
private final String KEY_SLOEBER_MENU_SELECTION = "BOARD.MENU"; //$NON-NLS-1$
111-
private final String KEY_SLOEBER_IS_VERSION_CONTROLLED = "IS_VERSION_CONTROLLED"; //$NON-NLS-1$
111+
112112

113113
@Override
114114
public String toString() {
@@ -449,9 +449,8 @@ public void setUploadPort(String newUploadPort) {
449449
this.myUploadPort = newUploadPort;
450450
}
451451

452-
public void setUploadProtocol(String newUploadProtocol) {
452+
public void setProgrammer(String newUploadProtocol) {
453453
this.myProgrammer = newUploadProtocol;
454-
455454
}
456455

457456
public void setBoardID(String boardID) {
@@ -759,7 +758,6 @@ private Map<String, String> getEnvVarsTxt() {
759758
this.myUploadPort = section.getValue(KEY_SLOEBER_UPLOAD_PORT);
760759
this.myUploadTool = section.getValue(KEY_SLOEBER_UPLOAD_TOOL);
761760
KeyValueTree optionsTree = section.getChild(KEY_SLOEBER_MENU_SELECTION);
762-
myIsVersionControlled = Const.TRUE.equalsIgnoreCase(section.getValue(KEY_SLOEBER_IS_VERSION_CONTROLLED));
763761
Map<String, String> options = optionsTree.toKeyValues(EMPTY, false);
764762

765763
myreferencingBoardsFile = new File(board_txt);
@@ -804,7 +802,6 @@ public Map<String, String> getEnvVarsConfig(String prefix) {
804802
allVars.put(prefix + KEY_SLOEBER_BOARD_TXT, board_txt);
805803
allVars.put(prefix + KEY_SLOEBER_UPLOAD_PORT, myUploadPort);
806804
allVars.put(prefix + KEY_SLOEBER_UPLOAD_TOOL, myUploadTool);
807-
allVars.put(prefix + KEY_SLOEBER_IS_VERSION_CONTROLLED, Boolean.valueOf(myIsVersionControlled).toString());
808805

809806
for (Entry<String, String> curOption : myOptions.entrySet()) {
810807
allVars.put(prefix + KEY_SLOEBER_MENU_SELECTION + DOT + curOption.getKey(), curOption.getValue());
@@ -1093,17 +1090,9 @@ public static BoardDescription getFromCDT(ICConfigurationDescription confDesc) {
10931090
ret.myreferencingBoardsFile = new File(getOldWayEnvVar(confDesc, "JANTJE.boards_file"));
10941091
ret.myBoardID = getOldWayEnvVar(confDesc, "JANTJE.board_ID");
10951092
ret.myTxtFile = new BoardTxtFile(ret.myreferencingBoardsFile);
1096-
ret.myIsVersionControlled = false;
10971093
String optinconcat = getOldWayEnvVar(confDesc, "JANTJE.menu");
10981094
ret.myOptions = KeyValue.makeMap(optinconcat);
10991095
return null;
11001096
}
11011097

1102-
public boolean IsVersionControlled() {
1103-
return myIsVersionControlled;
1104-
}
1105-
1106-
public void setVersionControlled(boolean myIsVersionControlled) {
1107-
this.myIsVersionControlled = myIsVersionControlled;
1108-
}
11091098
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package io.sloeber.core.api;
2+
3+
import java.util.Map;
4+
import java.util.TreeMap;
5+
6+
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
7+
8+
import io.sloeber.core.common.Const;
9+
import io.sloeber.core.txt.KeyValueTree;
10+
import io.sloeber.core.txt.TxtFile;
11+
12+
public class OtherDescription {
13+
private final String KEY_SLOEBER_IS_VERSION_CONTROLLED = "IS_VERSION_CONTROLLED"; //$NON-NLS-1$
14+
15+
private boolean myIsVersionControlled = false;
16+
17+
OtherDescription(TxtFile configFile, String prefix) {
18+
19+
KeyValueTree tree = configFile.getData();
20+
KeyValueTree section = tree.getChild(prefix);
21+
myIsVersionControlled = Const.TRUE.equalsIgnoreCase(section.getValue(KEY_SLOEBER_IS_VERSION_CONTROLLED));
22+
}
23+
24+
public OtherDescription() {
25+
// nothing needs to be done
26+
}
27+
28+
public Map<String, String> getEnvVars() {
29+
return getEnvVarsConfig(Const.EMPTY);
30+
}
31+
32+
public Map<String, String> getEnvVarsConfig(String prefix) {
33+
Map<String, String> allVars = new TreeMap<>();
34+
35+
allVars.put(prefix + KEY_SLOEBER_IS_VERSION_CONTROLLED, Boolean.valueOf(myIsVersionControlled).toString());
36+
37+
return allVars;
38+
}
39+
40+
public static OtherDescription getFromCDT(ICConfigurationDescription confDesc) {
41+
OtherDescription ret = new OtherDescription();
42+
ret.myIsVersionControlled = false;
43+
return ret;
44+
}
45+
46+
public boolean IsVersionControlled() {
47+
return myIsVersionControlled;
48+
}
49+
50+
public void setVersionControlled(boolean myIsVersionControlled) {
51+
this.myIsVersionControlled = myIsVersionControlled;
52+
}
53+
}

0 commit comments

Comments
 (0)