no message

This commit is contained in:
2024-10-09 22:21:57 +03:00
parent 54c80c516b
commit 6252af944e
699 changed files with 2634 additions and 1997 deletions

View File

@@ -0,0 +1,19 @@
package _VisualDVM.GlobalData.EnvironmentValue;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
public class EnvironmentValue extends iDBObject {
public String name = "";
public String value = "";
public int machine_id = CommonConstants.Nan; //для удаления машин
public int run_configuration_id = CommonConstants.Nan;
@Override
public boolean isVisible() {
return Current.HasRunConfiguration() && (run_configuration_id == Current.getRunConfiguration().id);
}
@Override
public String toString() {
return name + "=" + CommonUtils.DQuotes(value);
}
}

View File

@@ -0,0 +1,99 @@
package _VisualDVM.GlobalData.EnvironmentValue;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import _VisualDVM.Current;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.EnvironmentValue.UI.EnvironmentValueFields;
import _VisualDVM.GlobalData.GlobalDatabase;
public class EnvironmentValuesDBTable extends iDBTable<EnvironmentValue> {
public EnvironmentValuesDBTable() {
super(EnvironmentValue.class);
}
@Override
public String getSingleDescription() {
return "переменная окружения";
}
@Override
public String getPluralDescription() {
return "переменные окружения";
}
@Override
public DBObjectDialog<EnvironmentValue, EnvironmentValueFields> getDialog() {
return new DBObjectDialog<EnvironmentValue, EnvironmentValueFields>(EnvironmentValueFields.class) {
@Override
public void fillFields() {
CommonUI.TrySelect(fields.cbName, Result.name);
fields.tfValue.setText(Result.value);
}
//https://javarush.ru/groups/posts/regulyarnye-vyrazheniya-v-java
@Override
public void validateFields() {
String name = (String) fields.cbName.getSelectedItem();
String value = fields.tfValue.getText();
if (name.isEmpty())
Log.Writeln("Имя переменной окружения не может быть пустым.");
if (!name.matches("\\w*")) {
Log.Writeln("Имя переменной окружения может содержать только латинские буквы, цифры и подчёркивания");
}
if (Utils.isLinuxSystemCommand(name))
Log.Writeln(CommonUtils.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
if (value.contains("\"")) {
Log.Writeln("Значение переменной окружения не может содержать двойные кавычки");
}
for (EnvironmentValue env : ((GlobalDatabase)CommonUtils.db).environmentValues.Data.values()) {
if (env.isVisible() && (Result.id != env.id) && (env.name.equals(name))) {
Log.Writeln("В конфигурации запуска уже задана переменная окружения с именем " + CommonUtils.Brackets(name));
break;
}
}
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.run_configuration_id = Current.getRunConfiguration().id;
Result.name = (String) fields.cbName.getSelectedItem();
Result.value = fields.tfValue.getText();
}
@Override
public int getDefaultHeight() {
return 200;
}
};
}
@Override
protected DataSetControlForm createUI() {
return new DataSetControlForm(this){
@Override
protected void AdditionalInitColumns() {
columns.get(0).setVisible(false);
}
};
}
@Override
public String[] getUIColumnNames() {
return new String[]{"имя", "значение"};
}
@Override
public Object getFieldAt(EnvironmentValue object, int columnIndex) {
switch (columnIndex) {
case 1:
return object.name;
case 2:
return object.value;
}
return null;
}
@Override
public Current CurrentName() {
return Current.EnvironmentValue;
}
public EnvironmentValue getEnvByName(String name_in) {
for (EnvironmentValue environmentValue : Data.values())
if (environmentValue.name.equalsIgnoreCase(name_in)) return environmentValue;
return null;
}
}

View File

@@ -0,0 +1,12 @@
package _VisualDVM.GlobalData.EnvironmentValue;
import Common.Visual.Menus.DataMenuBar;
import Visual_DVM_2021.Passes.PassCode_2021;
public class EnvironmentValuesMenuBar extends DataMenuBar {
public EnvironmentValuesMenuBar() {
super("переменные окружения", PassCode_2021.AddEnvironmentValue,
PassCode_2021.EditEnvironmentValue,
PassCode_2021.DeleteEnvironmentValue,
PassCode_2021.PickCompilerEnvironments
);
}
}

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.GlobalData.EnvironmentValue.UI.EnvironmentValueFields">
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="4db5a" class="javax.swing.JComboBox" binding="cbName">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<editable value="true"/>
<font name="Times New Roman" size="16" style="0"/>
<model/>
<toolTipText value="Выберите из списка дополнительную команду компиляции ( актуально для DVM компиляторов)"/>
</properties>
</component>
<vspacer id="eb1a6">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="508af" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Times New Roman" size="16" style="2"/>
<text value="имя"/>
</properties>
</component>
<component id="1a477" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Times New Roman" size="16" style="2"/>
<text value="значение"/>
</properties>
</component>
<component id="abfff" class="javax.swing.JTextField" binding="tfValue" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>

View File

@@ -0,0 +1,22 @@
package _VisualDVM.GlobalData.EnvironmentValue.UI;
import Common.Visual.TextField.StyledTextField;
import Common.Visual.Windows.Dialog.DialogFields;
import javax.swing.*;
import java.awt.*;
public class EnvironmentValueFields implements DialogFields {
public JPanel content;
public JComboBox cbName;
public JTextField tfValue;
public EnvironmentValueFields() {
cbName.addItem("");
}
@Override
public Component getContent() {
return content;
}
private void createUIComponents() {
// TODO: place custom component creation code here
tfValue = new StyledTextField();
}
}