Skip to content

Commit 71a51dd

Browse files
author
SeTSeR
committed
Fixed branch deleting
1 parent 9d4f9af commit 71a51dd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/com/temporaryteam/noticeditor/view/EditNoticeTreeCell.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ public EditNoticeTreeCell() {
2727
MenuItem addBranchItem = new MenuItem("Add branch");
2828
MenuItem addNoticeItem = new MenuItem("Add notice");
2929
MenuItem deleteItem = new MenuItem("Delete");
30+
MenuItem deleteItem2 = new MenuItem("Delete");
3031
MenuItem openItem = new MenuItem("Open notice");
3132
branchMenu.getItems().addAll(addBranchItem, addNoticeItem, deleteItem);
32-
noticeMenu.getItems().addAll(openItem, deleteItem);
33+
noticeMenu.getItems().addAll(openItem, deleteItem2);
3334
addBranchItem.setOnAction(new EventHandler<ActionEvent>() {
3435
public void handle(ActionEvent t) {
3536
ArrayList<NoticeCategory> list = new ArrayList<NoticeCategory>();
@@ -47,7 +48,7 @@ public void handle(ActionEvent t) {
4748
getNoticeTreeItem().getNotice().getSubCategories().add(notice);
4849
}
4950
});
50-
deleteItem.setOnAction(new EventHandler<ActionEvent>() {
51+
EventHandler<ActionEvent> handler = new EventHandler<ActionEvent>() {
5152
public void handle(ActionEvent t) {
5253
NoticeCategory notice = getNoticeTreeItem().getNotice();
5354
NoticeTreeItem deletingNotice = getNoticeTreeItem();
@@ -56,7 +57,9 @@ public void handle(ActionEvent t) {
5657
notice = null;
5758
deletingNotice = null;
5859
}
59-
});
60+
};
61+
deleteItem.setOnAction(handler);
62+
deleteItem2.setOnAction(handler);
6063
openItem.setOnAction(new EventHandler<ActionEvent>() {
6164
public void handle(ActionEvent t) {
6265
controller.open(getNoticeTreeItem().getNotice().getContent());

0 commit comments

Comments
 (0)