1.有的時候在project的java build path中定義好了一些jar包依賴,但是project在運行的時候仍然報NoClassDef的錯誤.這是因為project的MANIFEST.MF文件沒有更新.手動在MANIFEST.MF加上那些jar包就可以了.
2.Plugin A 依賴 Plugin B.B也把相應的package export出來了,但是A還是找不到B里面定義的類.修改A的MANIFEST.MF文件,在dependence tab里去掉Plugin B,再添加B.此時發現有5,6個同樣的Plugin B出現在選擇plugin的list中.cancel 掉該對話框,然后重啟eclipse,在A的dependence里面重新加上B,問題解決.
3.當我們通過在plugin.xml中用extension的方式定義action的時候,你會發現你定義的actionset和action在GUI出現的順序不是你可以控制的,就是說同一個actionset下的多個action不是按你定義的先后順序出現在程序的界面上的,這樣對action進行排序呢?其實仔細觀察一下,你會發現action在GUI出現的順序是和你定義action的順序相反的,比如你先后定義了3個action A,B,C,那么你就會在GUI上看見action的順序是C,B,A.如果你定義了多個actionset,你會發現這個規律不適用與actionset,actionset在界面上出現的順序其實是和它的id的排序相反的.比如你定義了三個actionset,它們的id分別是:seta,setb,setc,你會發現GUI上出現的順序是setc,setb,seta
4.雙擊激活TreeViewer的celleditor
JFace的Viewer都有單元格編輯功能,但是celleditor默認的實現是單擊激活editor,雙擊選中item.如果需要改成單擊選中item,雙擊激活editor呢?Eclipse的官網上好像也有人問到這個問題,不過目前好像是開了一個bug,期待eclipse的下個版本解決這個問題.但最近找到了一個用SWT來解決這個問題的方法:
Tree tree=treeViewer.getTree();
final TreeEditor editor = new TreeEditor(tree);
editor.horizontalAlignment = SWT.LEFT;
editor.grabHorizontal = true;
// Use a mouse listener, not a selection listener, because you're
// interested
// in the selected column as well as row
tree.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent event) {
final TreeItem item = tree.getSelection()[0];
// Create a text field to do the editing
final Text text = new Text(tree, SWT.NONE);
text.setText(item.getText());
text.selectAll();
text.setFocus();
text.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent event) {
text.dispose();
}
});
// Set the text field into the editor
editor.setEditor(text, item);
}
});