Перенос.
This commit is contained in:
134
src/GlobalData/Compiler/UI/CompilerFields.form
Normal file
134
src/GlobalData/Compiler/UI/CompilerFields.form
Normal file
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="GlobalData.Compiler.UI.CompilerFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="7" column-count="3" 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="87831" class="javax.swing.JTextField" binding="tfHome" 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>
|
||||
<vspacer id="44b33">
|
||||
<constraints>
|
||||
<grid row="6" 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="627cc" 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="48916" class="javax.swing.JButton" binding="bBrowse">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<enabled value="true"/>
|
||||
<icon value="icons/LastOpened.png"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d58a0" class="javax.swing.JTextField" binding="tfCallCommand" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="2" 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>
|
||||
<component id="f3f87" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" 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="87234" class="javax.swing.JTextField" binding="tfDescription" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" 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>
|
||||
<component id="d1e8b" 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="ac56f" class="javax.swing.JTextField" binding="tfVersionCommand" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="3" 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>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="34097" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="3" 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="b2235" class="javax.swing.JTextField" binding="tfHelpCommand" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="4" 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>
|
||||
<editable value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8982d" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" 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="запрос help"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="19a71" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="5" 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="673a2" class="javax.swing.JComboBox" binding="cbCompilerType" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="5" 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>
|
||||
<toolTipText value="выберите тип компилятора"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
93
src/GlobalData/Compiler/UI/CompilerFields.java
Normal file
93
src/GlobalData/Compiler/UI/CompilerFields.java
Normal file
@@ -0,0 +1,93 @@
|
||||
package GlobalData.Compiler.UI;
|
||||
import Common.Current;
|
||||
import Common.UI.TextField.StyledTextField;
|
||||
import Common.UI.UI;
|
||||
import Common.UI.Windows.Dialog.DialogFields;
|
||||
import Common.Utils.Files.VDirectoryChooser;
|
||||
import GlobalData.Compiler.CompilerType;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
public class CompilerFields implements DialogFields {
|
||||
public JPanel content;
|
||||
public JTextField tfHome;
|
||||
public JButton bBrowse;
|
||||
public JTextField tfDescription;
|
||||
public JTextField tfCallCommand;
|
||||
public JTextField tfVersionCommand;
|
||||
public JTextField tfHelpCommand;
|
||||
public JComboBox<CompilerType> cbCompilerType;
|
||||
public boolean events_on = false;
|
||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки dvm системы");
|
||||
public CompilerFields() {
|
||||
bBrowse.addActionListener(e -> {
|
||||
CompilerType type = (CompilerType) cbCompilerType.getSelectedItem();
|
||||
if (type == CompilerType.dvm) {
|
||||
String dst = null;
|
||||
if (Current.getMachine().type.equals(MachineType.Local)) {
|
||||
File file = directoryChooser.ShowDialog();
|
||||
if (file != null)
|
||||
dst = file.getAbsolutePath();
|
||||
} else {
|
||||
if (Pass_2021.passes.get(PassCode_2021.SelectRemoteFile).Do(true))
|
||||
dst = Current.getRemoteFile().full_name;
|
||||
}
|
||||
if (dst != null)
|
||||
tfHome.setText(dst);
|
||||
} else
|
||||
UI.Info("Назначение домашней папки поддерживается только для dvm системы.");
|
||||
});
|
||||
tfHome.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
TryRestoreCallCommand();
|
||||
}
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
TryRestoreCallCommand();
|
||||
}
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
}
|
||||
}
|
||||
);
|
||||
cbCompilerType.addActionListener(e -> {
|
||||
if (Objects.requireNonNull(cbCompilerType.getSelectedItem()) == CompilerType.dvm) {
|
||||
tfVersionCommand.setText("ver");
|
||||
tfHelpCommand.setText("help");
|
||||
} else {
|
||||
tfVersionCommand.setText("--version");
|
||||
tfHelpCommand.setText("--help");
|
||||
}
|
||||
});
|
||||
}
|
||||
public void TryRestoreCallCommand() {
|
||||
if (events_on && (cbCompilerType.getSelectedItem() != null) && cbCompilerType.getSelectedItem().equals(CompilerType.dvm))
|
||||
tfCallCommand.setText(tfHome.getText() +
|
||||
(tfHome.getText().endsWith("/") ? "" : "/") +
|
||||
"bin/dvm_drv");
|
||||
}
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
tfDescription = new StyledTextField();
|
||||
tfHome = new StyledTextField();
|
||||
tfCallCommand = new StyledTextField();
|
||||
tfVersionCommand = new StyledTextField();
|
||||
tfHelpCommand = new StyledTextField();
|
||||
cbCompilerType = new JComboBox<>();
|
||||
cbCompilerType.addItem(CompilerType.dvm);
|
||||
cbCompilerType.addItem(CompilerType.intel);
|
||||
cbCompilerType.addItem(CompilerType.gnu);
|
||||
}
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user