use of org.tmatesoft.svn.core.SVNLogEntry in project Gargoyle by callakrsos.
the class SVNViewer method menuDiffOnAction.
/********************************
* 작성일 : 2016. 6. 14. 작성자 : KYJ
*
* Diff 처리 이벤트
*
* @param e
********************************/
public void menuDiffOnAction(ActionEvent e) {
ObservableList<SVNLogEntry> selectedItems = tbRevision.getSelectionModel().getSelectedItems();
if (selectedItems != null && selectedItems.size() == 2) {
SVNLogEntry svnLogEntry = selectedItems.get(0);
SVNLogEntry svnLogEntry2 = selectedItems.get(1);
if (svnLogEntry == null || svnLogEntry2 == null)
return;
long revision = svnLogEntry.getRevision();
long revision2 = svnLogEntry2.getRevision();
SVNItem svnItem = lastSelectedSVNItem.get();
String cat = svnItem.getManager().cat(svnItem.getPath(), String.valueOf(revision));
String cat2 = svnItem.getManager().cat(svnItem.getPath(), String.valueOf(revision2));
try {
// FXMLLoader loader = new FXMLLoader();
// loader.setLocation(TextBaseDiffAppController.class.getResource("TextBaseDiffApp.fxml"));
// Parent parent = loader.load();
// TextBaseDiffAppController controller = loader.getController();
// controller.setDiff(cat, cat2);
Parent parent = FxUtil.loadAndControllerAction(TextBaseDiffAppController.class, controller -> {
try {
controller.setDiff(cat, cat2);
} catch (Exception e1) {
e1.printStackTrace();
}
});
Stage stage = new Stage();
stage.setScene(new Scene(parent));
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(this.getScene().getWindow());
stage.show();
} catch (Exception ex) {
ex.printStackTrace();
}
} else {
DialogUtil.showMessageDialog("두개의 아이템을 선택하십시요.");
}
}
use of org.tmatesoft.svn.core.SVNLogEntry in project Gargoyle by callakrsos.
the class SvnChagnedCodeComposite method initialize.
@FXML
public void initialize() {
createContextMenu();
Collection<SVNLogEntry> allLogs = supplier.getAllLogs();
LOGGER.debug("Log Count : {}", allLogs.size());
String dateString = supplier.getStart().toDateString();
String dateString2 = supplier.getEnd().toDateString();
piChartChagendCode.setTitle(String.format("Chaned Code Count ( Rank %d )\n%s ~ %s", supplier.getRankSize(), dateString, dateString2));
// collectedTable = supplier.createStream(allLogs).collect(Collectors.groupingBy(v -> v.getPath()));
Map<String, Long> collect = supplier.createStream(allLogs).collect(Collectors.groupingBy(v -> v.getPath(), LinkedHashMap::new, Collectors.counting()));
dataList = collect.entrySet().stream().sorted((o1, o2) -> {
return -Long.compare(o1.getValue(), o2.getValue());
}).map(v -> new Data(v.getKey(), v.getValue())).limit(supplier.getRankSize()).collect(Collectors.toList());
piChartChagendCode.getData().addAll(dataList);
Set<Node> lookupAll = piChartChagendCode.lookupAll(".chart-pie-label");
for (Data d : piChartChagendCode.getData()) {
Node node = d.getNode();
Tooltip.install(node, new Tooltip(String.format("Source Code : %s\nModify Count:%d", d.getName(), (int) d.getPieValue())));
node.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> {
dataOnMouseClick(e, d);
e.consume();
});
/*animation effect. */
node.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, ev -> {
Platform.runLater(() -> node.setStyle("-fx-background-color:derive(-fx-color,-5%);"));
});
/*animation effect. */
node.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, ev -> {
Platform.runLater(() -> node.setStyle(null));
});
}
lookupAll.stream().map(v -> (Text) v).forEach(v -> {
String text = v.getText();
String displayText = text;
int count = supplier.getCollectedTable().get(displayText).size();
int textLength = displayText.length();
if (textLength > 15) {
displayText = "... " + displayText.substring(textLength - 15);
Tooltip.install(v, new Tooltip(text));
}
displayText = displayText.concat(" [").concat(String.valueOf(count)).concat("]");
v.setText(displayText);
});
// Platform.runLater(() -> {
// this.getScene().addEventFilter(KeyEvent.KEY_PRESSED, this::sceneOnKeyPressed);
// });
}
use of org.tmatesoft.svn.core.SVNLogEntry in project Gargoyle by callakrsos.
the class SVNViewer method svnTreeViewOnAction.
public void svnTreeViewOnAction(SVNItem item) {
if (!item.isDir()) {
lastSelectedSVNItem.set(item);
tbRevision.getItems().clear();
LineChart<String, String> lineHist = new LineChart<>(new CategoryAxis(), new CategoryAxis());
// lineHist.setRotate(90d);
// lineHist.scaleXProperty().set(0.7);
// lineHist.scaleYProperty().set(0.7);
lineHist.autosize();
lineHist.setLegendVisible(false);
List<SVNLogEntry> logs = item.getManager().log(item.getPath());
tbRevision.getItems().addAll(logs.stream().sorted(sortUpper).collect(Collectors.toList()));
// 시리즈 생성
ObservableList<Data<String, String>> observableArrayList = FXCollections.observableArrayList();
logs.stream().sorted(sortLower).forEach(entry -> {
Date date = entry.getDate();
String dateString = DateUtil.getDateString(date.getTime(), "yy-MM-dd HH:mm");
Data<String, String> data = new Data<>(dateString, entry.getAuthor());
setDataNode(entry, data);
data.getNode().setOnMouseClicked(e -> {
if (e.getClickCount() == 2 && e.getButton() == MouseButton.PRIMARY) {
String path = item.path;
long revision = entry.getRevision();
String content = item.getManager().cat(path, String.valueOf(revision));
BorderPane pane = new BorderPane(FxUtil.createJavaTextArea(content));
pane.setTop(new Label(item.getManager().fromPrettySVNLogConverter().apply(entry)));
FxUtil.showPopOver(data.getNode(), pane);
}
});
data.getNode().setOnMouseEntered(ev -> {
data.getNode().setBlendMode(BlendMode.GREEN);
});
data.getNode().setOnMouseExited(ev -> {
data.getNode().setBlendMode(null);
});
observableArrayList.add(data);
});
Series<String, String> series = new Series<>("Commitors.", observableArrayList);
lineHist.getData().add(series);
borChart.setCenter(lineHist);
String cat = item.getManager().cat(item.getPath());
// String simpleName = item.getSimpleName();
javaTextAre.setContent(cat);
tabPaneSVN.getSelectionModel().select(tabHistChart);
}
}
use of org.tmatesoft.svn.core.SVNLogEntry in project Gargoyle by callakrsos.
the class FxSVNHistoryDataSupplier method createEntryListView.
// MenuItem createDiffMenu(){
//
// }
ListView<SVNLogEntry> createEntryListView(ObservableList<SVNLogEntry> list) {
ListView<SVNLogEntry> listView = new ListView<SVNLogEntry>(list);
listView.setCellFactory(new Callback<ListView<SVNLogEntry>, ListCell<SVNLogEntry>>() {
@Override
public ListCell<SVNLogEntry> call(ListView<SVNLogEntry> param) {
ListCell<SVNLogEntry> listCell = new ListCell<SVNLogEntry>() {
/* (non-Javadoc)
* @see javafx.scene.control.Cell#updateItem(java.lang.Object, boolean)
*/
@Override
protected void updateItem(SVNLogEntry item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
} else {
long revision = item.getRevision();
String author = item.getAuthor();
String dateString = YYYY_MM_DD_HH_MM_SS_PATTERN.format(item.getDate());
String message = item.getMessage();
setText(String.format("Resivion :%d author %s date :%s message :%s ", revision, author, dateString, message));
}
}
};
return listCell;
}
});
listView.setPrefSize(600, ListView.USE_COMPUTED_SIZE);
listView.addEventHandler(MouseEvent.MOUSE_CLICKED, ev -> {
if (ev.getClickCount() == 2 && ev.getButton() == MouseButton.PRIMARY) {
SVNLogEntry selectedItem = listView.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
Map<String, SVNLogEntryPath> changedPaths = selectedItem.getChangedPaths();
if (ValueUtil.isNotEmpty(changedPaths)) {
ObservableList<GargoyleSVNLogEntryPath> collect = createStream(Arrays.asList(selectedItem)).collect(FxCollectors.toObservableList());
Node showing = null;
if (collect.isEmpty()) {
showing = new Label("Empty.");
showing.setStyle("-fx-text-fill:black");
} else {
showing = createHistoryListView(collect);
}
FxUtil.showPopOver(ev.getPickResult().getIntersectedNode(), showing);
}
}
}
});
return listView;
}
use of org.tmatesoft.svn.core.SVNLogEntry in project Gargoyle by callakrsos.
the class SVNHistoryWalkTest method historyWalkAnalysisGroupingTest.
@Test
public void historyWalkAnalysisGroupingTest() throws SVNException {
List<GagoyleDate> periodDaysByWeek = DateUtil.getPeriodDaysByWeek();
GagoyleDate start = periodDaysByWeek.get(0);
GagoyleDate end = periodDaysByWeek.get(periodDaysByWeek.size() - 1);
Calendar instance = Calendar.getInstance();
instance.set(2016, 6, 1);
Date time = instance.getTime();
long startRevision = localServerManager2.getRevision(/*start.toDate()*/
time);
long endRevision = localServerManager2.getRevision(end.toDate());
System.out.println("start " + start.toDateString() + " end : " + end.toDateString());
System.out.println("startRevision " + startRevision + " endRevision : " + endRevision);
Collection<SVNLogEntry> allLogs = localServerManager2.getAllLogs(startRevision, endRevision);
// allLogs.
SimpleDateFormat format = new SimpleDateFormat(DateUtil.SYSTEM_DATEFORMAT_YYYY_MM_DD);
TreeMap<String, Long> collect = allLogs.stream().collect(Collectors.groupingBy(v -> format.format(v.getDate()), TreeMap::new, Collectors.mapping(v -> 1, Collectors.counting())));
// Map<String, Long> collect = allLogs.stream()
// .collect(Collectors.groupingBy(v -> format.format(v.getDate()), Collectors.mapping(v -> 1, Collectors.counting())));
System.out.println(collect);
}
Aggregations