Eclipse RCP start tips

FuqiangWang


2014年从msn space存档中重新恢复出来!

The blog has not been updated for such a long long time, so today, let’s say something…

写点儿有关RCP的小tips吧,反正也不知写些什么东西,无意间翻硬盘看到这个freemind文件,故此,罗列与此:

Open View Tip

如果要在RCP中打开相应的View,你需要通过类似一下代码:

window.getActivePage().showView(viewId, IWorkbenchPage.VIEW_ACTIVATE);

不过,如果不在Perspective先行指定要打开的view所在位置的话,RCP应该不会知道你想让他帮你把该View放到什么位置,所以,我们还需要在Perspective中指定View的位置:

layout.createPlaceholderFolder("panelFolder",IPageLayout.TOP,IPageLayout.NULL_RATIO,layout.getEditorArea()).addPlaceholder(AdministrationView.ID); 
(Perspective.java)

How to Add Widget onto Table Cell

Table table = new Table(top, SWT.NONE);
table.setHeaderVisible(true);
table.setLinesVisible(true);
table.setBounds(new org.eclipse.swt.graphics.Rectangle(47,67,190,70));
TableColumn tableColumn = new TableColumn(table, SWT.NONE);
tableColumn.setWidth(100);
tableColumn.setText("Check Column");

TableColumn tableColumn1 = new TableColumn(table, SWT.NONE);
tableColumn1.setWidth(100);
tableColumn1.setText("Combo Column");

TableItem tableItem=new TableItem(table,SWT.NONE);
TableEditor editor = new TableEditor (table);

Button checkButton = new Button(table, SWT.CHECK);
checkButton.pack();

editor.minimumWidth = checkButton.getSize ().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(checkButton, tableItem, 0);
editor = new TableEditor (table);

Combo combo = new Combo(table, SWT.CHECK);
combo.pack();

editor.minimumWidth = combo.getSize ().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(combo, tableItem, 1);

How to get the Shell reference from ViewPart?!

viewPart.getViewSite().getShell()

how to restart eclipse RCP application in program?!

PlatformUI.getWorkbench().restart();

View和Editor的title圆润风格如何显示?

在RCP的product配置文件中(注意preferenceCustomization属性):

<extension
         id="product"
         point="org.eclipse.core.runtime.products">
      <product
            application="cn.bestwiz.jhf.dealer.demo.application"
            name="Dealer Demo">
         <property
               name="windowImages"
               value="/cn.bestwiz.jhf.dealer.demo/icons/letian.GIF"/>
         <property
               name="preferenceCustomization"
               value="plugin_customization.ini"/>
      </product>
   </extension>
其中,plugin_customization.ini文件的内容类似于(注意SHOW_TRADITIONAL_STYLE_TABS属性):
org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight
org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP=false
org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false
org.eclipse.ui/defaultPerspectiveId=cn.bestwiz.jhf.dealerdesk.perspective
org.eclipse.update.core/org.eclipse.update.core.updateVersions=compatible

OK,that’s all, if something new comes , append it later.


>>>>>> 更多阅读 <<<<<<


欢迎加入「福强私学」

跨越2190个日夜,始终坚持“实践 + 原创”打造的715125字专属知识库,囊括了(但不限于)从职场、技术、管理与商业等多个板块的内容。

  • 一个ChatGPT触达不到的地方
  • 一个带你超越AI/人工智能的地方
  • 一个与你一起成长的地方

https://afoo.me/kb.html


开天窗,拉认知,订阅「福报」,即刻拥有自己的全模态人工智能。

订阅「福报」