доделано сравнение
This commit is contained in:
2025-03-26 02:43:58 +03:00
parent 2a30a42e77
commit fef75270a7
5 changed files with 63 additions and 10 deletions

3
.idea/workspace.xml generated
View File

@@ -8,6 +8,9 @@
<component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/ComparisonForm.form" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/ComparisonForm.form" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/ComparisonForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Windows/ComparisonForm.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />

View File

@@ -4,7 +4,7 @@
"ServerUserPassword": "mprit_2011",
"OfferRegistrationOnStart": true,
"Workspace": "E:\\Tests",
"ProjectsSearchDirectory": "E:\\Tests\\Downloads",
"ProjectsSearchDirectory": "E:\\BUG",
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
"VisualiserPath": "C:\\Users\\misha\\Downloads",
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",

View File

@@ -3,7 +3,7 @@ import Common.Utils.Vector_;
import java.util.Vector;
public class Constants {
public static final int version = 1227;
public static final int version = 1228;
public static final int planner_version = 24;
public static final int testingMaxKernels = 64;
//--

View File

@@ -51,6 +51,22 @@
<constraints/>
<properties/>
</component>
<component id="ef748" class="javax.swing.JButton" binding="bPrevious">
<constraints/>
<properties>
<icon value="Common/icons/Previous.png"/>
<text value=""/>
<toolTipText value="к предыдущему различию"/>
</properties>
</component>
<component id="bd9b3" class="javax.swing.JButton" binding="bNext">
<constraints/>
<properties>
<icon value="Common/icons/Next.png"/>
<text value=""/>
<toolTipText value="к следующему различию"/>
</properties>
</component>
<component id="42c3c" class="javax.swing.JButton" binding="bCompare">
<constraints/>
<properties>

View File

@@ -12,11 +12,13 @@ import _VisualDVM.Utils;
import com.github.difflib.text.DiffRow;
import com.github.difflib.text.DiffRowGenerator;
import javafx.util.Pair;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaHighlighter;
import org.fife.ui.rtextarea.RTextScrollPane;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.Highlighter;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import java.util.Vector;
public abstract class ComparisonForm<T> {
@@ -40,10 +42,12 @@ public abstract class ComparisonForm<T> {
private JPanel content;
private JPanel editorPanel;
private JButton bCompare;
private JButton bPrevious;
private JButton bNext;
private RTextScrollPane Scroll;
//-----
private boolean events_on = false;//относится только к мастеру, отвечает за скроллы.
private int current_diff_line = -1;
private int current_diff_num = -1;
final String separator = "\u200B";
final char cseparator = '\u200B';
//невидимый пробел https://translated.turbopages.org/proxy_u/en-ru.ru.898e1daf-67e318c0-3fccff8a-74722d776562/https/stackoverflow.com/questions/17978720/invisible-characters-ascii
@@ -51,6 +55,15 @@ public abstract class ComparisonForm<T> {
// protected Object ownScrollModel = null;
protected Vector<Pair<Integer, Integer>> diffs = new Vector<>();
//---<<
private void ShowCurrentDiff() {
try {
int diff_line = Body.getLineOfOffset(diffs.get(current_diff_num).getKey());
Body.gotoLine_(diff_line);
}
catch (Exception ex){
ex.printStackTrace();
}
}
public ComparisonForm(Class<T> t_in, ComparisonForm<T> slave_in) {
//-
Body = new BaseEditor();
@@ -95,6 +108,27 @@ public abstract class ComparisonForm<T> {
bClose.addActionListener(e -> {
onClose();
});
bPrevious.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (current_diff_num != CommonConstants.Nan) {
if (current_diff_num > 0)
current_diff_num--;
else
current_diff_num = diffs.size() - 1;
ShowCurrentDiff();
}
}
});
bNext.addActionListener(e -> {
if (current_diff_num != CommonConstants.Nan) {
if (current_diff_num < diffs.size() - 1)
current_diff_num++;
else
current_diff_num = 0;
ShowCurrentDiff();
}
});
}
public JPanel getContent() {
return content;
@@ -126,9 +160,6 @@ public abstract class ComparisonForm<T> {
applyObject();
showObject();
}
private void ShowCurrentDiff() {
// Body.gotoLine_(colors.get(current_diff_line).getKey());
}
private void getLines() {
lines.clear();
visible_lines.clear();
@@ -144,13 +175,13 @@ public abstract class ComparisonForm<T> {
//предполагаем что оба объекта есть и мы можем получить с них текст.
protected void Compare() throws Exception {
events_on = false;
current_diff_line = CommonConstants.Nan;
current_diff_num = CommonConstants.Nan;
slave.current_diff_num =CommonConstants.Nan;
//-----------------------------------------------------------------------------------------------
Body.setText("");
slave.Body.setText("");
Body.getHighlighter().removeAllHighlights();
slave.Body.getHighlighter().removeAllHighlights();
int d = 0;
getLines();
slave.getLines();
//--------------------------------------------------------------------
@@ -217,6 +248,8 @@ public abstract class ComparisonForm<T> {
}
}
}
if (!diffs.isEmpty())
current_diff_num=0;
}
public void colorDiffs() throws Exception{
Highlighter.HighlightPainter painter = isMaster()? SPFEditor.RedTextPainter: SPFEditor.GreenTextPainter;
@@ -226,7 +259,8 @@ public abstract class ComparisonForm<T> {
}
public void Show() throws Exception {
events_on = false;
current_diff_line = CommonConstants.Nan;
current_diff_num = CommonConstants.Nan;
slave.current_diff_num =CommonConstants.Nan;
//----------------------------------------------------------------------------------------------
Body.setText("");
slave.Body.setText("");