在我的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. GWT Tab面板關閉
- 4. JavaFx - Tab可關閉按鈕
- 5. 關閉項目時,Eclipse中的項目文件在哪裏?
- 6. reopen atom顯示所有最近關閉的文件/項目
- 7. 在SwipeMenuListView中關閉項目
- 8. 帶有可拖曳排序項目的Jquery Selectbox控件
- 9. 帶有封裝項目的Android項目
- 10. 帶有公共文件的VS2010項目
- 11. 如何關閉eclipse時關閉Eclipse工作區中的所有項目?
- 12. 關閉JFrame而不關閉我的整個項目
- 13. 如何在Windows窗體中創建不帶Tab標籤的Tab控件?
- 14. 帶有Unicode項目的ConfigParser
- 15. 帶有AutoLayout關閉的iPhone Popover
- 16. 帶有關閉按鈕的標籤JavaFX
- 17. 項目控件綁定項目的子項控件wpf
- 18. 自動關閉MessageBox控件
- 19. 我的項目總是執行關閉
- 20. 如何關閉VC++項目中的Unicode?
- 21. Eclipse中已關閉項目的外觀
- 22. un-scope @ViewAccessScoped Bean在Tab上關閉
- 23. 有關選項卡控件的問題
- 24. Outlook郵件項目實際關閉時的事件
- 25. Tab控件+ WinForms中的DataGridView
- 26. Tab控件中的表格
- 27. 如何使視圖的子控件將關注NSViewController中的Tab和Shift + Tab
- 28. 父控件是否對內部控件的TAB INDEX有影響?
- 29. 關於MapKit中帶有NSMutableArray註解的Tab鍵按鈕
- 30. Listview控件即使在ASP.net中插入實體框架的項目後也不關閉插入項目