在我的eclipse插件中,在運行時我基於用戶交互爲Tabfolder創建多個TabItem。當太多的TabItem被創建時,問題就出現了。我正在尋找一個選項來創建一個關閉控件的TabItem,以便用戶可以在不需要時關閉相應的TabItem。有沒有辦法來創建這個?帶有關閉控件的Tab項目
1
A
回答
3
如果您使用CTabFolder而不是TabFolder,則可以使用CTabItem作爲選項卡並將SWT.CLOSE樣式傳遞給構造函數。這將在選項卡上創建一個關閉按鈕。
0
按SHIFT + TAB在時間 一個編輯器中打開編輯器之間切換。
按Shift + Tab鍵第二次打開 其他編輯器,但使用的Eclipse RCP接近以前的編輯器。
public class Emp_editor_open extends AbstractHandler{
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
IWorkbenchPage page = window.getActivePage();
//Three object create in EditorInput
ProductEditorInput product_input=new ProductEditorInput();
EmployeeEditorInput emp_input=new EmployeeEditorInput();
UserEditorInput std_input = new UserEditorInput();
IEditorReference[] editors = page.getEditorReferences();
System.out.println("Length : "+editors.length);
if(editors.length==0){
//First Time or empty editors to check this condition
try {
page.openEditor(product_input,ProductEditor.ID);
System.out.println("product Editor open");
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else if(page.getActiveEditor().getTitle().equals("Product_Editor")){
System.out.println("Product:: "+page.getActiveEditor().getTitle());
try {
page.closeAllEditors(true);
page.openEditor(emp_input, EmployeeEditor.Id);
System.out.println("Employee Editor open");
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else if(page.getActiveEditor().getTitle().equals("Employee_Editor")){
System.out.println("Emp:: "+page.getActiveEditor().getTitle());
try {
page.closeAllEditors(true);
page.openEditor(std_input, UserEditor.ID);
System.out.println("student Editor open");
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else if(page.getActiveEditor().getTitle().equals("Student_Editor")){
System.out.println("Product:: "+page.getActiveEditor().getTitle());
try {
page.closeAllEditors(true);
page.openEditor(product_input,ProductEditor.ID);
System.out.println("product Editor open");
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else {
try {
page.closeAllEditors(true);
page.openEditor(product_input,ProductEditor.ID);
System.out.println("product Editor open");
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
}
的plugin.xml
<extension point="org.eclipse.ui.commands">
<command
defaultHandler="rcp_demo.Toolbar.Emp_editor_open"
id="RCP_Demo.Toolbar.emp_editor_open_cmd"
name="Employee_Editor_open">
</command>
</extension>
<extension point="org.eclipse.ui.bindings">
<key
commandId="RCP_Demo.Toolbar.emp_editor_open_cmd"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M2+TAB">
</key>
</extension>
按鍵順序:M2是指移
相關問題
- 1. 關閉帶有UINavigation的ModalView控制器
- 2. 帶有嵌套對話框的選項卡控件中的Tab順序(WS_EX_CONTROLPARENT)
- 3. 的Eclipse關閉項目
- 4. JavaFx - Tab可關閉按鈕
- 5. GWT Tab面板關閉
- 6. 與用戶控件的標籤項目的可關閉選項卡
- 7. 關閉特定項目事件選擇
- 8. reopen atom顯示所有最近關閉的文件/項目
- 9. 自動關閉QMenuBar項目
- 10. Excel VBA項目未關閉
- 11. excel vba項目不關閉
- 12. 在SwipeMenuListView中關閉項目
- 13. 帶有可拖曳排序項目的Jquery Selectbox控件
- 14. 默認關閉TabPane中的Tab消費
- 15. JavaFX - 動態關閉TabPane中的Tab鍵
- 16. 帶有封裝項目的Android項目
- 17. 帶有公共文件的VS2010項目
- 18. 如何關閉有關升級項目的Xcode 5警告?
- 19. C#WPF Tab項目Click事件問題
- 20. 帶有關閉按鈕的HTML選項卡
- 21. 如何在Windows窗體中創建不帶Tab標籤的Tab控件?
- 22. 如何關閉eclipse時關閉Eclipse工作區中的所有項目?
- 23. 關閉JFrame而不關閉我的整個項目
- 24. 帶有Unicode項目的ConfigParser
- 25. Tab控件夏普
- 26. 項目控件綁定項目的子項控件wpf
- 27. 關閉帶有inputAccessoryView的鍵盤
- 28. 關閉帶有多個UITextFields的鍵盤?
- 29. 帶有變量的javascript關閉函數?
- 30. 帶有AutoLayout關閉的iPhone Popover