аналогичная запаковка и распаковка окружения. осталось формирование задач и отображение в таблице
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.GlobalData.Compiler;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.CompilerEnvironmentsSet;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.RawCompilerEnvironmentsSet;
|
||||
import _VisualDVM.GlobalData.CompilerOption.RawCompilerOptionsSet;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
@@ -30,7 +30,7 @@ public class Compiler extends iDBObject {
|
||||
public String versionText = "";
|
||||
//-
|
||||
public RawCompilerOptionsSet options = new RawCompilerOptionsSet();
|
||||
public CompilerEnvironmentsSet environments = new CompilerEnvironmentsSet();
|
||||
public RawCompilerEnvironmentsSet environments = new RawCompilerEnvironmentsSet();
|
||||
//-
|
||||
public Compiler() {
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package _VisualDVM.GlobalData.CompilerEnvironment;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.UI.CompilerEnvironmentsForm;
|
||||
|
||||
import javax.swing.*;
|
||||
public class CompilerEnvironmentsSet extends DataSet<String, CompilerEnvironment> {
|
||||
public CompilerEnvironmentsSet() {
|
||||
super(String.class, CompilerEnvironment.class);
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new CompilerEnvironmentsForm(this, mountPanel);
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "переменные окружения";
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "переменная окружения";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package _VisualDVM.GlobalData.CompilerEnvironment;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentJson;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
||||
public class EnvironmentsLine extends iDBObject {
|
||||
public EnvironmentsJson json;
|
||||
public EnvironmentsLine(EnvironmentsJson json_in){
|
||||
json = json_in;
|
||||
}
|
||||
@Override
|
||||
public String getBDialogName() {
|
||||
return Utils_.Brackets(json.toLine());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package _VisualDVM.GlobalData.CompilerEnvironment;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsJson;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsSetJson;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.UI.EnvironmentsLinesForm;
|
||||
import _VisualDVM.GlobalData.CompilerOption.OptionsLine;
|
||||
|
||||
import javax.swing.*;
|
||||
public class EnvironmentsLinesSet extends DataSet<Integer, EnvironmentsLine> {
|
||||
public int maxId = 1;
|
||||
public EnvironmentsLinesSet() {
|
||||
super(Integer.class, EnvironmentsLine.class);
|
||||
}
|
||||
public EnvironmentsLinesSet(EnvironmentsSetJson json) {
|
||||
super(Integer.class, EnvironmentsLine.class);
|
||||
for (EnvironmentsJson environmentsJson: json.values) {
|
||||
EnvironmentsLine environmentsLine =new EnvironmentsLine(environmentsJson);
|
||||
environmentsLine.id = maxId++;
|
||||
put(environmentsLine.id, environmentsLine);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "набор переменных окружения";
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "наборы переменных окружения";
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new EnvironmentsLinesForm(this,mountPanel);
|
||||
}
|
||||
public EnvironmentsSetJson toJson(){
|
||||
EnvironmentsSetJson res= new EnvironmentsSetJson();
|
||||
for (EnvironmentsLine environmentsLine: Data.values()){
|
||||
res.values.add(environmentsLine.json);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package _VisualDVM.GlobalData.CompilerEnvironment.Json;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.CompilerEnvironment;
|
||||
import _VisualDVM.GlobalData.CompilerOption.CompilerOption;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class EnvironmentJson {
|
||||
@Expose
|
||||
public String name; //в том числе и с разделителем если есть. поиск по startswith
|
||||
@Expose
|
||||
public String value; //значение без кавычек
|
||||
public EnvironmentJson(CompilerEnvironment src){
|
||||
name= src.name;
|
||||
value = src.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package _VisualDVM.GlobalData.CompilerEnvironment.Json;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionJson;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class EnvironmentsJson {
|
||||
@Expose
|
||||
public List<EnvironmentJson> values = new Vector<>();
|
||||
public String toLine(){
|
||||
Vector<String> res = new Vector<>();
|
||||
for (EnvironmentJson environmentJson: values){
|
||||
res.add(environmentJson.name+"="+Utils_.DQuotes(environmentJson.value));
|
||||
}
|
||||
return String.join(" ", res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package _VisualDVM.GlobalData.CompilerEnvironment.Json;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class EnvironmentsSetJson {
|
||||
@Expose
|
||||
public List<EnvironmentsJson> values = new Vector<>();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package _VisualDVM.GlobalData.CompilerEnvironment;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentJson;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsJson;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.UI.CompilerEnvironmentsForm;
|
||||
import _VisualDVM.GlobalData.CompilerOption.CompilerOption;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionJson;
|
||||
import _VisualDVM.GlobalData.EnvironmentValue.EnvironmentValue;
|
||||
|
||||
import javax.swing.*;
|
||||
public class RawCompilerEnvironmentsSet extends DataSet<String, CompilerEnvironment> {
|
||||
public RawCompilerEnvironmentsSet() {
|
||||
super(String.class, CompilerEnvironment.class);
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new CompilerEnvironmentsForm(this, mountPanel);
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "переменные окружения";
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "переменная окружения";
|
||||
}
|
||||
public CompilerEnvironment findByJson(EnvironmentJson json){
|
||||
for (CompilerEnvironment compilerEnvironment: Data.values()){
|
||||
if (json.name.equals(compilerEnvironment.name))
|
||||
return compilerEnvironment;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void Reset() {
|
||||
for (CompilerEnvironment environment: Data.values()){
|
||||
environment.select(false);
|
||||
environment.value="";
|
||||
}
|
||||
}
|
||||
public void Synchronize(EnvironmentsJson json) {
|
||||
for (EnvironmentJson environmentJson: json.values){
|
||||
CompilerEnvironment compilerEnvironment = findByJson(environmentJson);
|
||||
if (compilerEnvironment!=null){
|
||||
compilerEnvironment.select(true);
|
||||
compilerEnvironment.value = environmentJson.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package _VisualDVM.GlobalData.CompilerEnvironment.UI;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.Tables.ColumnInfo;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.EnvironmentsLine;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.EnvironmentsLinesSet;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.OptionsLine;
|
||||
import _VisualDVM.GlobalData.CompilerOption.OptionsLinesSet;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import javax.swing.*;
|
||||
public class EnvironmentsLinesForm extends DataSetControlForm<EnvironmentsLine> {
|
||||
public EnvironmentsLinesForm(DataSet<?, EnvironmentsLine> dataSource_in, JPanel mountPanel_in) {
|
||||
super(dataSource_in, mountPanel_in);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCheckBox() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean isPKVisible() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void createColumns() {
|
||||
AddColumns(new ColumnInfo<EnvironmentsLine>("") {
|
||||
@Override
|
||||
public Object getFieldAt(EnvironmentsLine object) {
|
||||
return object.json.toLine();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected DataMenuBar createMenuBar() {
|
||||
DataMenuBar res = super.createMenuBar();
|
||||
res.addPasses(
|
||||
new Pass<EnvironmentsLine>(){
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/Common/icons/RedAdd.png";
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Добавление набора переменных окружения";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
Pass pass = Global.mainModule.getPass(PassCode.PickCompilerEnvironmentsForTesting);
|
||||
if (pass.Do(Global.mainModule.getDb().compilers.getUI().getCurrent())){
|
||||
target= new EnvironmentsLine((EnvironmentsJson) pass.target);
|
||||
target.id = ((EnvironmentsLinesSet)dataSource).maxId++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
dataSource.put(target.getPK(), target);
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
dataSource.ShowUI(target.getPK());
|
||||
}
|
||||
},
|
||||
new Pass<EnvironmentsLine>(){
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/Common/icons/Edit.png";
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Редактирование набора переменных окружения";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (dataSource.getUI().CheckCurrent(Log)) {
|
||||
target = dataSource.getUI().getCurrent();
|
||||
Pass pass = Global.mainModule.getPass(PassCode.PickCompilerEnvironmentsForTesting);
|
||||
if (pass.Do(Global.mainModule.getDb().compilers.getUI().getCurrent(), target.json)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
dataSource.ShowUI(target.getPK());
|
||||
}
|
||||
},
|
||||
new Pass<EnvironmentsLine>(){
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/Common/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Удаление набора переменных окружения";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (dataSource.getUI().CheckCurrent(Log)) {
|
||||
target = dataSource.getUI().getCurrent();
|
||||
return dataSource.getUI().ShowDeleteObjectDialog(target);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
dataSource.ClearUI();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
dataSource.Data.remove(target.getPK());
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
dataSource.ShowUI();
|
||||
}
|
||||
}
|
||||
);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsSetJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.UI.OptionsLinesForm;
|
||||
|
||||
@@ -10,6 +11,14 @@ public class OptionsLinesSet extends DataSet<Integer, OptionsLine> {
|
||||
public OptionsLinesSet() {
|
||||
super(Integer.class, OptionsLine.class);
|
||||
}
|
||||
public OptionsLinesSet(OptionsSetJson json){
|
||||
super(Integer.class, OptionsLine.class);
|
||||
for (OptionsJson optionsJson: json.values) {
|
||||
OptionsLine optionsLine =new OptionsLine(optionsJson);
|
||||
optionsLine.id = maxId++;
|
||||
put(optionsLine.id, optionsLine);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "набор опций компиляции";
|
||||
|
||||
@@ -117,7 +117,6 @@ public class OptionsLinesForm extends DataSetControlForm<OptionsLine> {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
System.out.println("datasource");
|
||||
if (dataSource.getUI().CheckCurrent(Log)) {
|
||||
target = dataSource.getUI().getCurrent();
|
||||
return dataSource.getUI().ShowDeleteObjectDialog(target);
|
||||
|
||||
Reference in New Issue
Block a user