修改图标
parent
0aeee96817
commit
899be85cdf
|
|
@ -83,11 +83,7 @@ public class FileEditController {
|
||||||
private RecursiveFileList recursiveFileList = null;
|
private RecursiveFileList recursiveFileList = null;
|
||||||
|
|
||||||
private TabPane tabPane = null;
|
private TabPane tabPane = null;
|
||||||
|
|
||||||
private static String path = null;
|
|
||||||
private final ObservableList<Path> filePaths_list = FXCollections.observableArrayList();
|
private final ObservableList<Path> filePaths_list = FXCollections.observableArrayList();
|
||||||
private final SimpleIntegerProperty index = new SimpleIntegerProperty(0);
|
|
||||||
|
|
||||||
private final SimpleIntegerProperty text_size = new SimpleIntegerProperty(15);
|
private final SimpleIntegerProperty text_size = new SimpleIntegerProperty(15);
|
||||||
private final SimpleIntegerProperty icon_size = new SimpleIntegerProperty(15);
|
private final SimpleIntegerProperty icon_size = new SimpleIntegerProperty(15);
|
||||||
private static final Map<Path, Tab> map = new HashMap<>();
|
private static final Map<Path, Tab> map = new HashMap<>();
|
||||||
|
|
@ -99,9 +95,6 @@ public class FileEditController {
|
||||||
save.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCodeCombination.CONTROL_DOWN));
|
save.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCodeCombination.CONTROL_DOWN));
|
||||||
open_file.setAccelerator(new KeyCodeCombination(KeyCode.F, KeyCodeCombination.CONTROL_DOWN));
|
open_file.setAccelerator(new KeyCodeCombination(KeyCode.F, KeyCodeCombination.CONTROL_DOWN));
|
||||||
open_dir.setAccelerator(new KeyCodeCombination(KeyCode.D, KeyCodeCombination.CONTROL_DOWN));
|
open_dir.setAccelerator(new KeyCodeCombination(KeyCode.D, KeyCodeCombination.CONTROL_DOWN));
|
||||||
|
|
||||||
//读取本地加载记录
|
|
||||||
Properties s = config_path(false);
|
|
||||||
recursiveFileList = new RecursiveFileList(null);
|
recursiveFileList = new RecursiveFileList(null);
|
||||||
init_file_list();
|
init_file_list();
|
||||||
tabPane = new TabPane();
|
tabPane = new TabPane();
|
||||||
|
|
@ -160,9 +153,9 @@ public class FileEditController {
|
||||||
HBox hBox = new HBox(10);
|
HBox hBox = new HBox(10);
|
||||||
ImageView iv = null;
|
ImageView iv = null;
|
||||||
if (this.getTreeItem().isExpanded()) {
|
if (this.getTreeItem().isExpanded()) {
|
||||||
iv = new ImageView(new Image("image/向下.png"));
|
iv = new ImageView(new Image("image/close.png"));
|
||||||
} else {
|
} else {
|
||||||
iv = new ImageView(new Image("image/向右.png"));
|
iv = new ImageView(new Image("image/open.png"));
|
||||||
}
|
}
|
||||||
iv.setPreserveRatio(true);
|
iv.setPreserveRatio(true);
|
||||||
iv.setFitWidth(icon_size.get());
|
iv.setFitWidth(icon_size.get());
|
||||||
|
|
@ -245,7 +238,7 @@ public class FileEditController {
|
||||||
if (filePaths_list.contains(path)) {//size -1 ,szie -2
|
if (filePaths_list.contains(path)) {//size -1 ,szie -2
|
||||||
//切换到一打开的tab
|
//切换到一打开的tab
|
||||||
Tab tab = map.get(path);
|
Tab tab = map.get(path);
|
||||||
if (!tabPane.getTabs().contains(tab)){
|
if (!tabPane.getTabs().contains(tab)) {
|
||||||
tabPane.getTabs().add(tab);
|
tabPane.getTabs().add(tab);
|
||||||
}
|
}
|
||||||
tabPane.getSelectionModel().select(tab);
|
tabPane.getSelectionModel().select(tab);
|
||||||
|
|
@ -287,9 +280,9 @@ public class FileEditController {
|
||||||
});
|
});
|
||||||
tab.setContent(new VirtualizedScrollPane<>(codeArea));
|
tab.setContent(new VirtualizedScrollPane<>(codeArea));
|
||||||
filePaths_list.add(path);
|
filePaths_list.add(path);
|
||||||
tabPane.getTabs().add( tab);
|
tabPane.getTabs().add(tab);
|
||||||
tabPane.getSelectionModel().select(tab);
|
tabPane.getSelectionModel().select(tab);
|
||||||
map.put(path,tab);
|
map.put(path, tab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -381,8 +374,10 @@ public class FileEditController {
|
||||||
int lastKwEnd = 0;
|
int lastKwEnd = 0;
|
||||||
StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
|
StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
String styleClass =
|
String styleClass = "";
|
||||||
matcher.group("KEYWORD") != null ? "keyword" :
|
|
||||||
|
if (type.equals(Type.JAVA)) {
|
||||||
|
styleClass = matcher.group("KEYWORD") != null ? "keyword" :
|
||||||
matcher.group("PAREN") != null ? "paren" :
|
matcher.group("PAREN") != null ? "paren" :
|
||||||
matcher.group("BRACE") != null ? "brace" :
|
matcher.group("BRACE") != null ? "brace" :
|
||||||
matcher.group("BRACKET") != null ? "bracket" :
|
matcher.group("BRACKET") != null ? "bracket" :
|
||||||
|
|
@ -394,6 +389,38 @@ public class FileEditController {
|
||||||
matcher.group("METHOD") != null ? "method" :
|
matcher.group("METHOD") != null ? "method" :
|
||||||
matcher.group("KEYWORD2") != null ? "method2" :
|
matcher.group("KEYWORD2") != null ? "method2" :
|
||||||
null; /* never happens */
|
null; /* never happens */
|
||||||
|
}
|
||||||
|
if (type.equals(Type.GO)) {
|
||||||
|
styleClass = matcher.group("KEYWORD") != null ? "keyword" :
|
||||||
|
matcher.group("PAREN") != null ? "paren" :
|
||||||
|
matcher.group("BRACE") != null ? "brace" :
|
||||||
|
matcher.group("BRACKET") != null ? "bracket" :
|
||||||
|
matcher.group("SEMICOLON") != null ? "semicolon" :
|
||||||
|
matcher.group("STRING") != null ? "string" :
|
||||||
|
matcher.group("COMMENT") != null ? "comment" :
|
||||||
|
matcher.group("ANNOTATION") != null ? "annotation" :
|
||||||
|
matcher.group("PARAMS") != null ? "parameter" :
|
||||||
|
matcher.group("METHOD") != null ? "method" :
|
||||||
|
matcher.group("KEYWORD2") != null ? "method2" :
|
||||||
|
null; /* never happens */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.equals(Type.HTML)) {
|
||||||
|
styleClass = matcher.group("PAREN") != null ? "paren" :
|
||||||
|
matcher.group("BRACE") != null ? "brace" :
|
||||||
|
matcher.group("BRACKET") != null ? "bracket" :
|
||||||
|
matcher.group("SEMICOLON") != null ? "semicolon" :
|
||||||
|
matcher.group("STRING") != null ? "string" :
|
||||||
|
matcher.group("COMMENT") != null ? "comment" :
|
||||||
|
matcher.group("ANNOTATION") != null ? "annotation" :
|
||||||
|
matcher.group("PARAMS") != null ? "parameter" :
|
||||||
|
matcher.group("METHOD") != null ? "method" :
|
||||||
|
matcher.group("HTMLKEYWORDS") != null ? "html-keyword" : //html 标签
|
||||||
|
matcher.group("HTMLKEYWORDS2") != null ? "html-keyword2" : //html 属性
|
||||||
|
null; /* never happens */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
assert styleClass != null;
|
assert styleClass != null;
|
||||||
spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
|
spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
|
||||||
spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
|
spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
|
||||||
|
|
|
||||||
|
|
@ -9,20 +9,20 @@ import java.util.regex.Pattern;
|
||||||
*/
|
*/
|
||||||
public class ProcessHtml {
|
public class ProcessHtml {
|
||||||
|
|
||||||
public static final String[] KEYWORDS = new String[] {
|
public static final String[] HTMLKEYWORDS = new String[] {
|
||||||
"DOCTYPE","doctype", "html", "head", "body",
|
"DOCTYPE","doctype", "html", "head", "body",
|
||||||
"h1", "h2","h3","h4","h5","h6", "p", "br","meta",
|
"h1", "h2","h3","h4","h5","h6", "p", "br","meta",
|
||||||
"title","img", "hr", "a", "table","div","span",
|
"title","img", "hr", "a", "table","div","span",
|
||||||
"ul", "dl","dd","i","script","li","link"
|
"ul", "dl","dd","i","script","li","link"
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final String[] KEYWORDS2 = new String[] {
|
public static final String[] HTMLKEYWORDS2 = new String[] {
|
||||||
"href", "name", "style", "rel", "id", "src","media","content","http-equiv",
|
"href", "name", "style", "rel", "id", "src","media","content","http-equiv",
|
||||||
"return","class","target","charset","lay-filter","window","global","document"
|
"return","class","target","charset","lay-filter","window","global","document","var"
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final String KEYWORD_PATTERN = "\\b(" + String.join("|", KEYWORDS) + ")\\b";
|
public static final String HTMLKEYWORDS_PATTERN = "\\b(" + String.join("|", HTMLKEYWORDS) + ")\\b";
|
||||||
public static final String KEYWORD_PATTERN2 = "\\b(" + String.join("|", KEYWORDS2) + ")\\b";
|
public static final String HTMLKEYWORDS_PATTERN2 = "\\b(" + String.join("|", HTMLKEYWORDS2) + ")\\b";
|
||||||
public static final String PAREN_PATTERN = "\\(|\\)";
|
public static final String PAREN_PATTERN = "\\(|\\)";
|
||||||
public static final String BRACE_PATTERN = "\\{|\\}";
|
public static final String BRACE_PATTERN = "\\{|\\}";
|
||||||
public static final String BRACKET_PATTERN = "\\[|\\]";
|
public static final String BRACKET_PATTERN = "\\[|\\]";
|
||||||
|
|
@ -34,7 +34,7 @@ public class ProcessHtml {
|
||||||
public static final String METHOD_PATTERN = "\\w+\\((\\w+,\\s*)*\\w*\\)";
|
public static final String METHOD_PATTERN = "\\w+\\((\\w+,\\s*)*\\w*\\)";
|
||||||
|
|
||||||
public static final Pattern PATTERN = Pattern.compile(
|
public static final Pattern PATTERN = Pattern.compile(
|
||||||
"(?<KEYWORD>" + KEYWORD_PATTERN + ")"
|
"(?<HTMLKEYWORDS>" + HTMLKEYWORDS_PATTERN + ")"
|
||||||
+ "|(?<PAREN>" + PAREN_PATTERN + ")"
|
+ "|(?<PAREN>" + PAREN_PATTERN + ")"
|
||||||
+ "|(?<BRACE>" + BRACE_PATTERN + ")"
|
+ "|(?<BRACE>" + BRACE_PATTERN + ")"
|
||||||
+ "|(?<BRACKET>" + BRACKET_PATTERN + ")"
|
+ "|(?<BRACKET>" + BRACKET_PATTERN + ")"
|
||||||
|
|
@ -44,7 +44,7 @@ public class ProcessHtml {
|
||||||
+ "|(?<ANNOTATION>" + ANNOTATION_PATTERN + ")"
|
+ "|(?<ANNOTATION>" + ANNOTATION_PATTERN + ")"
|
||||||
+ "|(?<PARAMS>" + PARAMS_PATTERN + ")"
|
+ "|(?<PARAMS>" + PARAMS_PATTERN + ")"
|
||||||
+ "|(?<METHOD>" + METHOD_PATTERN + ")"
|
+ "|(?<METHOD>" + METHOD_PATTERN + ")"
|
||||||
+ "|(?<KEYWORD2>" + KEYWORD_PATTERN2 + ")"
|
+ "|(?<HTMLKEYWORDS2>" + HTMLKEYWORDS_PATTERN2 + ")"
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
/*-*/
|
/*-*/
|
||||||
/*信息文本的样式*/
|
/*信息文本的样式*/
|
||||||
.code-area .keyword {
|
.code-area .keyword {
|
||||||
-fx-fill: #10ADEBFF
|
-fx-fill: #d12746
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-*/
|
/*-*/
|
||||||
|
|
@ -119,7 +119,7 @@
|
||||||
/*-*/
|
/*-*/
|
||||||
/*参数的样式*/
|
/*参数的样式*/
|
||||||
.code-area .annotation {
|
.code-area .annotation {
|
||||||
-fx-fill: #eeee07;
|
-fx-fill: #b76bd5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-*/
|
/*-*/
|
||||||
|
|
@ -151,12 +151,12 @@
|
||||||
/*-*/
|
/*-*/
|
||||||
/*字段的样式*/
|
/*字段的样式*/
|
||||||
.code-area .method {
|
.code-area .method {
|
||||||
-fx-fill: red;
|
-fx-fill: #8841c0;
|
||||||
-fx-text-fill: red;
|
-fx-text-fill: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-area .method2 {
|
.code-area .method2 {
|
||||||
-fx-fill: #699f45;
|
-fx-fill: #10adeb;
|
||||||
-fx-text-fill: red;
|
-fx-text-fill: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,5 +188,14 @@
|
||||||
/*-*/
|
/*-*/
|
||||||
/*抽象的样式*/
|
/*抽象的样式*/
|
||||||
.code-area .deprecated {
|
.code-area .deprecated {
|
||||||
-fx-fill: #d12746;
|
-fx-fill: #03e921;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.code-area .html-keyword{
|
||||||
|
-fx-fill: #66af22;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-area .html-keyword2{
|
||||||
|
-fx-fill: #1097eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Loading…
Reference in New Issue