成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Eclipse RCP編輯器關(guān)閉按鈕的屏蔽方法

開發(fā) 后端
Eclipse RCP開發(fā)中,屏蔽視圖的關(guān)閉按鈕很容易,在IPerspectiveFactory接口的createInitialLayout方法中,調(diào)用IViewLayout的setCloseable(boolean)方法即可,而屏蔽編輯器的關(guān)閉按鈕則有點(diǎn)麻煩,需要RCP中的WorkbenchPresentationFactory進(jìn)行定制.

通過設(shè)斷點(diǎn)跟蹤Eclipse RCP的代碼, 發(fā)現(xiàn)編輯器上的關(guān)閉按鈕其實(shí)并不屬于Editor控件的一部分,而是editor所屬容器的,具體層次結(jié)構(gòu)沒有深入去研究,總之按鈕是加在AbstractTabFolder這樣一個(gè)控件上的。RCP在啟動(dòng)時(shí),會(huì)通過默認(rèn)的WorkbenchPresentationFactory在生成GUI上的DefaultTabFolder,并且默認(rèn)具有關(guān)閉按鈕。因此屏蔽關(guān)閉按鈕就從此入手。

首先,在ApplicationWorkbenchWindowAdvisor類的preWindowOpen()方法中注冊(cè)我們自己定制的PresentationFactory。

Java代碼:

configurer.setPresentationFactory(new UnCloseableEditorPresentationFactory());  

UnCloseableEditorPresentationFactory類繼承WorkbenchPresentationFactory類,為了不影響別的GUI功能,我們只需要重寫public StackPresentation createEditorPresentation(Composite parent, IStackPresentationSite site)方法中的關(guān)于設(shè)置TableFolder的部分,具體如下:

Java代碼:

DefaultTabFolder folder = new UnCloseableEditorFolder(parent,
 editorTabPosition | SWT.BORDER,         

      site.supportsState(IStackPresentationSite.STATE_MINIMIZED),            

     site.supportsState(IStackPresentationSite.STATE_MAXIMIZED)); ... 

該方法中其余部分代碼,把父類的復(fù)制過來即可。

***就是定義我們自己的UnCloseableEditorFolder了

Java代碼:

public UnCloseableEditorFolder(Composite parent, 
int flags,boolean allowMin, boolean allowMax)

 {   super(parent, flags, allowMin, allowMax);  } 

 @SuppressWarnings("restriction")

 public AbstractTabItem add(int index, int flags)

{   return super.add(index, flags ^ SWT.CLOSE);  }

以上就是需要定制的代碼,另外,UnCloseableEditorPresentationFactory類中,我們還可以public StackPresentation createEditorPresentation(Composite parent, IStackPresentationSite site)中定制StandardViewSystemMenu,從而去掉RCP中編輯器folder上的菜單中的close,closeall,new editor等菜單

Java代碼:

class StandardEditorSystemMenu extends StandardViewSystemMenu 
{          /**      * @param site      */    
 public StandardEditorSystemMenu(IStackPresentationSite site)
 {         super(site);            }      
String getMoveMenuText() 
{      return WorkbenchMessages.EditorPane_moveEditor;     }         
 /* (non-Javadoc)      * @see org.eclipse.ui.internal.presentations.util.
ISystemMenu#show(org.eclipse.swt.widgets.Control, org.eclipse.swt.graphics.Point,
 org.eclipse.ui.presentations.IPresentablePart)      */    
 public void show(Control parent, Point displayCoordinates,  
 IPresentablePart currentSelection) {   super.show(parent, displayCoordinates,
 currentSelection);     } }

 以上就是個(gè)人從事RCP幾年來一點(diǎn)小小的心得體會(huì)。

責(zé)任編輯:book05 來源: javaeye
相關(guān)推薦

2013-09-10 16:02:59

Elipse編輯器

2011-01-10 16:17:49

2010-02-23 15:44:24

Python編輯器

2010-03-24 09:20:07

CentOS vi編輯

2009-06-04 20:08:26

Eclipse RCPEclipse

2011-03-22 13:54:57

UbuntuPHP編輯器

2009-05-20 14:48:07

ibmdwEclipse開發(fā)技巧

2013-06-18 01:22:46

CocoStudio工Cocos2d-x

2013-07-11 11:13:51

編輯器

2017-03-09 11:45:16

LinuxVim編輯器

2025-02-05 12:01:35

屬性編輯器Web

2018-09-25 09:25:11

Vim編輯器命令

2009-10-26 10:47:57

linux vi編輯器

2020-10-14 14:00:39

VIM編輯器

2022-05-31 14:46:02

Ruby編碼線上編輯器

2009-12-04 17:07:49

SlickEdit

2023-01-18 08:30:40

圖形編輯器元素

2023-02-01 09:21:59

圖形編輯器標(biāo)尺

2020-09-18 06:00:51

開源Markdown編輯器

2023-04-07 08:02:30

圖形編輯器對(duì)齊功能
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)

主站蜘蛛池模板: 亚洲色图网址 | 国产日韩一区二区三区 | 欧美综合国产精品久久丁香 | 欧美日韩亚洲系列 | 草草草网站 | 久草视频观看 | 欧美黄视频 | 国产黄色在线观看 | 国产日韩精品一区 | 日韩欧美在线观看 | 亚洲精品亚洲人成人网 | 欧美另类视频在线 | 久久尤物免费一区二区三区 | 亚洲一区二区三区视频免费观看 | 国产一区二区三区四区三区四 | 日韩中文字幕在线观看视频 | 亚洲国产一区二区三区 | 一区二区三区四区国产 | 国产一区二区三区在线免费观看 | 欧美精品一区在线 | 一级毛片黄片 | 一级午夜aaa免费看三区 | 国产激情一区二区三区 | 久久久精品久久 | 亚洲 欧美 日韩 精品 | 一区二区在线 | 亚洲一二三在线观看 | 日韩欧美精品在线播放 | 国产成人免费 | 日本精品一区二区三区视频 | 成人午夜免费福利视频 | 国产亚洲精品精品国产亚洲综合 | 国产在线观 | 美女一区二区在线观看 | 999精品视频在线观看 | 亚洲精品黄色 | 色婷婷综合久久久中字幕精品久久 | 精品乱子伦一区二区三区 | 久草免费在线视频 | 精品视频一区二区三区在线观看 | 亚洲欧美日韩精品久久亚洲区 |