In the Eclipse rcp program starts, open the way to custom EditorPart

sponsored links
In the Eclipse rcp startup, for the system default start Perspective, by increasing the variety of viewpart, at boot time, open the custom view. However, in createInitialLayout (ILayout layout) method, using a custom layout can not be transferred editorpart, replace the system default "org.eclipse.ui.editorss" editor, so how to open a custom editorpart has become a problem.

Open the custom in the analysis method editorpart call: PlatformUI.getWrokbench (). GetActiveWorkbenchWindow (). GetActivePage (). OpenEditor (, EditorInput, EditorID, true), the key issue is to obtain IWorkBenchPage object. In order to obtain active of the page, through the Eclipse UI structure analysis, we can see when workbenchWindow opens, you may or may activepage, therefore, can be overloaded ApplicationWorkbenchWindowAdivor the postWidowOpen method, in which the open editorpart, you can, my code is as follows:

public void postWindowOpen () (
/ / TODO Auto-generated method stub
super.postWindowOpen ();

IWorkbench bench = PlatformUI.getWorkbench ();
String defaultPerspectiveID = bench.getPerspectiveRegistry ()
. getDefaultPerspective ();

if (defaultPerspectiveID.equals (MyPerspective.PERSPECTIVE_ID)) (
File file = new File ("");
String path = file.getAbsolutePath ();

if (path! = null) (
IEditorInput input = new DiagramEditorInput (new Path (path));
IWorkbenchPage page = PlatformUI.getWorkbench ()
. getActiveWorkbenchWindow (). getActivePage ();
try (
page.openEditor (input, DiagramEditor.ID, true);
) Catch (PartInitException e) (
/ / TODO Auto-generated catch block
e.printStackTrace ();

  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of In the Eclipse rcp program starts, open the way to custom EditorPart

  • hibernate study of the second

    Persistence of three main points: 1, a statement for persistent fields accessors (accessors) and whether the variable signs (mutators) Property statement is not necessarily required for the public's. Hibernate can be default, protected or private ...

  • eclipse Hibernate proposals

    Error: The 'Hibernate proposals' proposal computer from the' org.hibernate.eclipse.jdt.ui 'plug-in dod not complete normally. Unable to instantiate the extension. To Avoid this message, disable the 'org.hibernate.eclipse.jdt.ui ...

  • Workspace run under different Eclipse

    Now do live more and more often required to use eclipse in java and ruby & rails project conducted between the tangential shear from the past, because in the rails project used a coloring Aptana preferences, the results open the java project sour ...

  • jBPM Development Getting Started Guide

    Although the workflow is still immature stage of development, not even a recognized standard. But its application has already been launched in the Express, indicating the market's demand for job-flow framework are urgent and enormous. Backgrounds of o

  • hibernate (jpa) composite primary key annotation statement Ways

    In the design of the database tables are designed with a composite primary key of the table, that table's record by more than one field joint identification, such as: Table CREATE TABLE TB_HOUR_DATA ( STAT_DATE DATE NOT NULL, PATH_ID NUMBER(20) NOT NULL,

  • jboss ejb3 Message Driven Bean

    Super Medium ejb hate. . . . . . . . . . . . . . . . . . . ================================================ To configure a Message Driven Bean in a different application server parameters are not the same. Currently only passed the test jboss. Message Dri

  • myeclipse plugin

    myeclipsePlug-ins? 1.tomcatPlugin(Start tomcat ):http ://,2.xVersions of eclipse 3 version 2 .1Version doesn't work. 2.Lomboz(Development of jsp program ,jspDynamic prompt, debugging ):

  • hibernate generic generic DAO

    package org.lzpeng.dao; import; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *

  • Java technology: Eclipse explain the use of techniques

    Editor settings: Window -> Preferences -> Java-> Editor appearance: Display line number, emphasizing symmetry shown in square brackets, to emphasize that the existing line to show Print Margins its check, Tab width set 4, print made from the fiel

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries