How transfer my plug-in project to RCP project? [message #449451] |
Mon, 15 May 2006 05:17  |
Eclipse User |
|
|
|
Not long ago,I develop a plug-in project about workFlow;Now I want to
trasnfer it to a RCP project.
And my test step is followed:
=====================================
1.In plugin.xml,Add:
<extension
id="myapplication"
point="org.eclipse.core.runtime.applications">
<application>
<run class="com.example.application.MyApplication"/>
</application>
</extension>
2.create class "MyApplication":
public class MyApplication implements IPlatformRunnable {
public Object run(Object args) throws Exception {
Display display = PlatformUI.createDisplay();
try {
int returnCode = PlatformUI.createAndRunWorkbench(display, new
MyWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IPlatformRunnable.EXIT_RESTART;
}
return IPlatformRunnable.EXIT_OK;
} finally {
display.dispose();
}
}
}
3.create class "MyWorkbenchAdvisor" appearing in class "MyApplication"
public class MyWorkbenchAdvisor extends WorkbenchAdvisor {
private static final String PERSPECTIVE_ID =
"com.example.ui.MyPerspective";
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
IWorkbenchWindowConfigurer configurer) {
return new MyWorkbenchWindowAdvisor(configurer);
}
public String getInitialWindowPerspectiveId() {
return PERSPECTIVE_ID;
}
public void initialize(IWorkbenchConfigurer configurer) {
super.initialize(configurer);
//The workaround call
WorkbenchAdapterBuilder.registerAdapters();
}
}
4.create class "MyWorkbenchWindowAdvisor" appearing in class
"MyWorkbenchAdvisor"
public class MyWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
public MyWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer)
{
super(configurer);
}
public ActionBarAdvisor createActionBarAdvisor(
IActionBarConfigurer configurer) {
return new MyActionBarAdvisor(configurer);
}
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setInitialSize(new Point(700, 500));
configurer.setShowCoolBar(false);
configurer.setShowStatusLine(false);
configurer.setTitle("My RCP Application");
}
}
5.create class "MyActionBarAdvisor" appearing in class
"MyWorkbenchWindowAdvisor"
public class MyActionBarAdvisor extends ActionBarAdvisor {
private IWorkbenchAction exitAction;
public MyActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
}
protected void makeActions(final IWorkbenchWindow window) {
exitAction = ActionFactory.QUIT.create(window);
register(exitAction);
}
protected void fillMenuBar(IMenuManager menuBar) {
MenuManager fileMenu = new MenuManager("&File",
IWorkbenchActionConstants.M_FILE);
menuBar.add(fileMenu);
fileMenu.add(exitAction);
}
}
6.Add class "Perspective" :
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
final String navigator = "org.eclipse.ui.views.ResourceNavigator";
final String properties = "org.eclipse.ui.views.PropertySheet";
final String outline = "org.eclipse.ui.views.ContentOutline";
final String editor = layout.getEditorArea();
layout.addView(navigator, IPageLayout.LEFT, 0.4f, editor);
IFolderLayout folder1 = layout.createFolder("left-bottom",
IPageLayout.BOTTOM, (float) 0.5, navigator);
folder1.addView(properties);
folder1.addView(outline);
layout.setEditorAreaVisible(true);
}
}
and in plugin.xml
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="rpc.MyPerspective"
class="rpc.Perspective"
id="rpc.MyPerspective">
</perspective>
</extension>
=====================================
Finally ,when I run this programme,there is only a eclipse frame there,no
my plug-in's funtion:graphic editor and so on.
Is there other simple way to implement this transformation,what's is wrong
with my step,and how can I get my plug-in's editor?
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04539 seconds