use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.SourceAnalysisDVO in project Gargoyle by callakrsos.
the class CodeAnalysisJavaTextArea method initialize.
@FXML
public void initialize() {
choMethod = new ChoiceBox<>();
choMethod.setConverter(new StringConverter<SourceAnalysisDVO>() {
@Override
public String toString(SourceAnalysisDVO d) {
return d.getMethodName();
}
@Override
public SourceAnalysisDVO fromString(String string) {
return null;
}
});
// jdk1.8.73이후버젼부터 사용가능
choMethod.setOnAction(event -> {
SourceAnalysisDVO selectedItem = choMethod.getSelectionModel().getSelectedItem();
String methodName = selectedItem.getMethodName();
int methodBlockStart = selectedItem.getMethodBlockStart();
int finallyBlockIdx = methodBlockStart - 1;
String string = newInstance.getReadLines().get(finallyBlockIdx);
if (!string.contains(methodName)) {
for (int i = methodBlockStart - 2; i < methodBlockStart + 1; i++) {
if (i < 0)
continue;
if (i == (methodBlockStart - 1))
continue;
string = newInstance.getReadLines().get(i);
if (string.contains(methodName)) {
finallyBlockIdx = i;
break;
}
}
}
IntStream mapToInt = Stream.of(txtJavaTextArea.getText().split("\n")).limit(finallyBlockIdx).mapToInt(mapper -> {
return mapper.length() + 1;
});
int length = string.split("\t").length - 1;
int sum = mapToInt.sum() + length;
System.out.println(string);
txtJavaTextArea.selectRange(sum, sum + methodName.length());
});
this.setTop(new HBox(5, new Label("Method Name : "), choMethod));
}
use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.SourceAnalysisDVO in project Gargoyle by callakrsos.
the class CodeAnalysisJavaTextArea method init.
@FxPostInitialize
public void init() {
List<SourceAnalysisDVO> methodList = Collections.emptyList();
try {
newInstance = new BizFile(javaFile);
List<String> readLines = newInstance.getReadLines();
txtJavaTextArea.setContent(readLines);
// svo = ProgramSpecUtil.doJavaFile("sampleJavaProject",
// javaFile.getName(), (AbstractJavaProgramSpecFile) newInstance);
// this.setContent(svo.getFile().getInspectorSourceMeta().getSourceCode());
SourceCodeAnalysis sa = newInstance.getJavaSourceAnalysis();
methodList = sa.findStatement();
choMethod.getItems().addAll(methodList);
} catch (Exception e) {
LOGGER.error(ValueUtil.toString(e));
}
}
use of com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.SourceAnalysisDVO in project Gargoyle by callakrsos.
the class XframeJsAnalysis method compile.
/**
* 2014. 6. 21. Administrator
*
* @param p
* @param data
* @return
* @처리내용 : 패턴과 일치하는 내용을 찾아 반환
*/
public void compile(Pattern p) {
String statement = this.inspectorSourceMeta.getSourceCode();
Matcher m = p.matcher(statement);
boolean result = m.find();
int lineNumberSavePoint = 0;
int lineNumberCnt = 0;
while (result) {
String group = m.group().trim();
int start = m.start();
int end = m.end();
lineNumberCnt += getLineNumberCnt(statement.substring(lineNumberSavePoint, end));
lineNumberSavePoint = end + 1;
BlockDVO blockAndDeleteList = getBlockAndDeleteList(lineNumberCnt);
/* if문이 true인 경우는 함수가 포함된 라인안에 브레이스가 있는경우임 */
if (blockAndDeleteList == null) {
lineNumberCnt = lineNumberCnt - 1;
blockAndDeleteList = getBlockAndDeleteList(lineNumberCnt);
lineNumberSavePoint = lineNumberSavePoint - 1;
}
if (blockAndDeleteList == null) {
ProgramSpecSourceErrException e = new ProgramSpecSourceErrException(" 코드 블록에 문제가 있거나 , 프로그램 버그 발생. ");
e.addDetailMsgList("2차 체크 코드 블록 BlockDVO null 주석문제일 가능성이 있음.");
e.addDetailMsgList("group : ");
e.addDetailMsgList(group);
e.addDetailMsgList("start : ");
e.addDetailMsgList(String.valueOf(start));
e.addDetailMsgList("end : ");
e.addDetailMsgList(String.valueOf(end));
e.addDetailMsgList("lineNumberCnt : ");
e.addDetailMsgList(String.valueOf(lineNumberCnt));
e.addDetailMsgList("linkedList : ");
e.addDetailMsgList(listBlock.toString());
// BaseUtil.alert( "코드 블록에 문제가 있거나 , 프로그램 버그 발생." );
// return;
result = m.find();
continue;
}
int startLine = blockAndDeleteList.getStartindex();
int endLine = blockAndDeleteList.getEndindex();
List<String> subList = this.inspectorSourceMeta.getSourceCodeList().subList(startLine - 1, endLine);
String sourceCode = getString(subList);
methodList.add(new SourceAnalysisDVO(group.replaceAll("\\{", "").trim(), start, end, startLine, endLine, this.inspectorSourceMeta.getFileName(), sourceCode));
result = m.find();
}
}
Aggregations