++
решение проблемы совместимости с java 1.8._4xx
This commit is contained in:
@@ -4,9 +4,9 @@ import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.DBTableColumn;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.*;
|
||||
|
||||
95
src/Common/Utils/Pair.java
Normal file
95
src/Common/Utils/Pair.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package Common.Utils;
|
||||
import java.io.Serializable;
|
||||
public class Pair<K, V> implements Serializable {
|
||||
/**
|
||||
* Key of this <code>Pair</code>.
|
||||
*/
|
||||
private K key;
|
||||
/**
|
||||
* Value of this this <code>Pair</code>.
|
||||
*/
|
||||
private V value;
|
||||
/**
|
||||
* Creates a new pair
|
||||
*
|
||||
* @param key The key for this pair
|
||||
* @param value The value to use for this pair
|
||||
*/
|
||||
public Pair(K key, V value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
/**
|
||||
* Gets the key for this pair.
|
||||
*
|
||||
* @return key for this pair
|
||||
*/
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
/**
|
||||
* Gets the value for this pair.
|
||||
*
|
||||
* @return value for this pair
|
||||
*/
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* <p><code>String</code> representation of this
|
||||
* <code>Pair</code>.</p>
|
||||
*
|
||||
* <p>The default name/value delimiter '=' is always used.</p>
|
||||
*
|
||||
* @return <code>String</code> representation of this <code>Pair</code>
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + "=" + value;
|
||||
}
|
||||
/**
|
||||
* <p>Generate a hash code for this <code>Pair</code>.</p>
|
||||
*
|
||||
* <p>The hash code is calculated using both the name and
|
||||
* the value of the <code>Pair</code>.</p>
|
||||
*
|
||||
* @return hash code for this <code>Pair</code>
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// name's hashCode is multiplied by an arbitrary prime number (13)
|
||||
// in order to make sure there is a difference in the hashCode between
|
||||
// these two parameters:
|
||||
// name: a value: aa
|
||||
// name: aa value: a
|
||||
return key.hashCode() * 13 + (value == null ? 0 : value.hashCode());
|
||||
}
|
||||
/**
|
||||
* <p>Test this <code>Pair</code> for equality with another
|
||||
* <code>Object</code>.</p>
|
||||
*
|
||||
* <p>If the <code>Object</code> to be tested is not a
|
||||
* <code>Pair</code> or is <code>null</code>, then this method
|
||||
* returns <code>false</code>.</p>
|
||||
*
|
||||
* <p>Two <code>Pair</code>s are considered equal if and only if
|
||||
* both the names and values are equal.</p>
|
||||
*
|
||||
* @param o the <code>Object</code> to test for
|
||||
* equality with this <code>Pair</code>
|
||||
* @return <code>true</code> if the given <code>Object</code> is
|
||||
* equal to this <code>Pair</code> else <code>false</code>
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o instanceof Pair) {
|
||||
Pair pair = (Pair) o;
|
||||
if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
|
||||
if (value != null ? !value.equals(pair.value) : pair.value != null) return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package Common.Visual.Editor;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Menus.StyledPopupMenu;
|
||||
import Common.Visual.Menus.TextEditorMenu;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Visual.Syntax.SPFEditorTheme;
|
||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
|
||||
@@ -15,6 +17,7 @@ import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.net.URI;
|
||||
import java.util.Vector;
|
||||
public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogFields {
|
||||
protected final StyledPopupMenu menu;
|
||||
// protected int changesCount = 0;
|
||||
@@ -153,4 +156,20 @@ public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogF
|
||||
menu.applyTheme();
|
||||
//меню связано с редактором. поэтому тема меняется только вместе с ним.
|
||||
}
|
||||
//--
|
||||
public Vector<Pair<Integer, Integer>> getErrorsForHightlight() {
|
||||
Vector<Pair<Integer, Integer>> res = new Vector<>();
|
||||
for (int i = 0; i < this.getLineCount(); ++i) {
|
||||
try {
|
||||
int start = getLineStartOffset(i);
|
||||
int end = getLineEndOffset(i);
|
||||
String line = this.getText(start, end);
|
||||
if (Utils.isCrushedLine(line))
|
||||
res.add(new Pair<>(start, end));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user