📄 deletecditem.java
字号:
package com.galaxyworkstation.view;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import com.galaxyworkstation.control.CDManager;
/**
*
* The DeleteCDItem class which is to delete a TreeItem of CD in the tree
*
*/
public class DeleteCDItem implements TheObject {
TreeItem treeItem;
/**
* The initial method is the main method of the class
*/
public void initial() {
MessageBox msgBox = new MessageBox(treeItem.getParent().getShell(),SWT.ICON_WARNING|SWT.YES|SWT.NO);
msgBox.setText("警告");
msgBox.setMessage("确定删除光盘?");
int choice = msgBox.open();
if(choice == SWT.YES){
Tree tree = treeItem.getParent();
if(!treeItem.equals(tree.getItem(0)))
if(treeItem.getItemCount() == 0){
tree.setSelection(treeItem.getParentItem());
TheObject renameItem = new RenameAlbumItem();
renameItem.setObject(treeItem.getParent());
CDManager.action.deleteCD(MainGUI.CDMap.get(treeItem));
((Tree)((Composite)((SashForm)((SashForm)((Group)treeItem.getDisplay().getShells()[0].getChildren()[1])
.getChildren()[0]).getChildren()[0]).getChildren()[1])
.getChildren()[0]).removeAll();
((Table)((Composite)((SashForm)((SashForm)((Group)treeItem.getDisplay().getShells()[0].getChildren()[1])
.getChildren()[0]).getChildren()[1]).getChildren()[0])
.getChildren()[0]).removeAll();
MainGUI.CDMap.remove(treeItem);
MainGUI.documentMap.clear();
MainGUI.tableMap.clear();
System.err.println();
tree.setSelection(treeItem.getParentItem());
treeItem.dispose();
}
}
else if(choice == SWT.NO){
return;
}
}
/**
* The setObject method which is to set the parent TreeItem
*/
public void setObject(Object object) {
this.treeItem = (TreeItem)object;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -