промежуточный. внедрение наборов флагов в параметры тестирования двм. сделал добавление и редактирование.
This commit is contained in:
@@ -2,7 +2,7 @@ package _VisualDVM.GlobalData.Compiler;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.GlobalData.CompilerEnvironment.CompilerEnvironmentsSet;
|
||||
import _VisualDVM.GlobalData.CompilerOption.CompilerOptionsSet;
|
||||
import _VisualDVM.GlobalData.CompilerOption.RawCompilerOptionsSet;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
@@ -29,7 +29,7 @@ public class Compiler extends iDBObject {
|
||||
@Description("IGNORE")
|
||||
public String versionText = "";
|
||||
//-
|
||||
public CompilerOptionsSet options = new CompilerOptionsSet();
|
||||
public RawCompilerOptionsSet options = new RawCompilerOptionsSet();
|
||||
public CompilerEnvironmentsSet environments = new CompilerEnvironmentsSet();
|
||||
//-
|
||||
public Compiler() {
|
||||
|
||||
@@ -12,4 +12,12 @@ public class CompilerEnvironmentsSet extends DataSet<String, CompilerEnvironment
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new CompilerEnvironmentsForm(this, mountPanel);
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "переменные окружения";
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "переменная окружения";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Vector;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
public class CompilerOption extends DBObject {
|
||||
@Description("PRIMARY KEY, UNIQUE")
|
||||
public String name = "";
|
||||
public String parameterSeparator = "";
|
||||
public String parameterName = "";
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.GlobalData.CompilerOption.UI.CompilerOptionsForm;
|
||||
|
||||
import javax.swing.*;
|
||||
public class CompilerOptionsSet extends DataSet<String, CompilerOption> {
|
||||
public CompilerOptionsSet() {
|
||||
super(String.class, CompilerOption.class);
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new CompilerOptionsForm(this, mountPanel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption.Json;
|
||||
import _VisualDVM.GlobalData.CompilerOption.CompilerOption;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class OptionJson {
|
||||
@Expose
|
||||
public String name; //в том числе и с разделителем если есть. поиск по startswith
|
||||
@Expose
|
||||
public String value; //значение без кавычек
|
||||
public OptionJson(CompilerOption src){
|
||||
name= src.name+src.parameterSeparator;
|
||||
value = src.parameterValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption.Json;
|
||||
import Common.Utils.Utils_;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class OptionsJson {
|
||||
@Expose
|
||||
public List<OptionJson> values = new Vector<>();
|
||||
public String toLine(){
|
||||
Vector<String> res = new Vector<>();
|
||||
for (OptionJson optionJson: values){
|
||||
res.add(optionJson.name+
|
||||
|
||||
(optionJson.value.contains(" ")? Utils_.DQuotes(optionJson.value): optionJson.value));
|
||||
}
|
||||
return String.join(" ", res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption.Json;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class OptionsSetJson {
|
||||
@Expose
|
||||
public List<OptionsJson> values = new Vector<>();
|
||||
public OptionsSetJson(){
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
||||
public class OptionsLine extends iDBObject {
|
||||
public OptionsJson json;
|
||||
public OptionsLine(OptionsJson json_in){
|
||||
json = json_in;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsSetJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.UI.OptionsLinesForm;
|
||||
|
||||
import javax.swing.*;
|
||||
public class OptionsLinesSet extends DataSet<Integer, OptionsLine> {
|
||||
public int maxId = 1;
|
||||
public OptionsLinesSet() {
|
||||
super(Integer.class, OptionsLine.class);
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "набор опций компиляции";
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "наборы опций компиляции";
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new OptionsLinesForm(this,mountPanel);
|
||||
}
|
||||
public OptionsSetJson toJson(){
|
||||
OptionsSetJson res= new OptionsSetJson();
|
||||
for (OptionsLine optionsLine: Data.values()){
|
||||
res.values.add(optionsLine.json);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.UI.CompilerOptionsForm;
|
||||
|
||||
import javax.swing.*;
|
||||
//нужно для опций компиляции получаемых из хелпа
|
||||
public class RawCompilerOptionsSet extends DataSet<String, CompilerOption> {
|
||||
public RawCompilerOptionsSet() {
|
||||
super(String.class, CompilerOption.class);
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return new CompilerOptionsForm(this, mountPanel);
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "опции компиляции";
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "опция компиляции";
|
||||
}
|
||||
public CompilerOption findByJson(OptionJson json){
|
||||
for (CompilerOption compilerOption: Data.values()){
|
||||
if (json.name.equals(compilerOption.name+compilerOption.parameterSeparator))
|
||||
return compilerOption;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void Reset(){
|
||||
for (CompilerOption option: Data.values()){
|
||||
option.select(false);
|
||||
option.parameterValue="";
|
||||
}
|
||||
}
|
||||
public void Synchronize(OptionsJson json){
|
||||
for (OptionJson option_json: json.values){
|
||||
// найти опцию по началу
|
||||
CompilerOption compilerOption = findByJson(option_json);
|
||||
if (compilerOption!=null){
|
||||
compilerOption.select(true);
|
||||
compilerOption.parameterValue = option_json.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class CompilerOptionsForm extends DataSetControlForm<CompilerOption> {
|
||||
new ColumnInfo<CompilerOption>("Параметр") {
|
||||
@Override
|
||||
public Object getFieldAt(CompilerOption object) {
|
||||
return object.parameterName + object.parameterSeparator;
|
||||
return object.parameterName;
|
||||
}
|
||||
@Override
|
||||
public Class getRendererClass() {
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package _VisualDVM.GlobalData.CompilerOption.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.CompilerOption.Json.OptionsJson;
|
||||
import _VisualDVM.GlobalData.CompilerOption.OptionsLine;
|
||||
import _VisualDVM.GlobalData.CompilerOption.OptionsLinesSet;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import javax.swing.*;
|
||||
public class OptionsLinesForm extends DataSetControlForm<OptionsLine> {
|
||||
public OptionsLinesForm(OptionsLinesSet dataSource_in, JPanel mountPanel_in) {
|
||||
super(dataSource_in, mountPanel_in);
|
||||
}
|
||||
@Override
|
||||
protected void createColumns() {
|
||||
AddColumns(new ColumnInfo<OptionsLine>("") {
|
||||
@Override
|
||||
public Object getFieldAt(OptionsLine object) {
|
||||
return object.json.toLine();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected boolean hasCheckBox() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean isPKVisible() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected DataMenuBar createMenuBar() {
|
||||
DataMenuBar res = super.createMenuBar();
|
||||
res.addPasses(
|
||||
new Pass<OptionsLine>(){
|
||||
@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.PickCompilerOptions);
|
||||
if (pass.Do(Global.mainModule.getDb().compilers.getUI().getCurrent())){
|
||||
target= new OptionsLine((OptionsJson) pass.target);
|
||||
target.id = ((OptionsLinesSet)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<OptionsLine>(){
|
||||
@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.PickCompilerOptions);
|
||||
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());
|
||||
}
|
||||
}
|
||||
);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
||||
import _VisualDVM.GlobalData.Machine.Machine;
|
||||
import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import _VisualDVM.GlobalData.Module.Module;
|
||||
@@ -39,9 +40,9 @@ public class ModuleAnchestorFields implements DialogFields {
|
||||
BPickOptions.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Pass<String> pass = Global.mainModule.getPass(PassCode.PickCompilerOptions);
|
||||
Pass pass = Global.mainModule.getPass(PassCode.PickCompilerOptions);
|
||||
if (pass.Do(compiler)) {
|
||||
UI.TrySelect(cbFlags, pass.target);
|
||||
UI.TrySelect(cbFlags, ((OptionsJson)pass.target).toLine());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user