Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How transfer my plug-in project to RCP project?
How transfer my plug-in project to RCP project? [message #449451] Mon, 15 May 2006 05:17 Go to next message
Eclipse UserFriend
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?
Re: How transfer my plug-in project to RCP project? [message #449500 is a reply to message #449451] Mon, 15 May 2006 10:15 Go to previous messageGo to next message
Eclipse UserFriend
Leo wrote:

>
> public class MyWorkbenchAdvisor extends WorkbenchAdvisor {
>
> private static final String PERSPECTIVE_ID =
> "com.example.ui.MyPerspective";
>

>
> and in plugin.xml
> <extension
> point="org.eclipse.ui.perspectives">
> <perspective
> name="rpc.MyPerspective"
> class="rpc.Perspective"
> id="rpc.MyPerspective">
> </perspective>
> </extension>


My guess is rpc.MyPerspective doesn't match com.example.ui.MyPerspective.

usually, there should be something in your .log file showing that your
RCP app couldn't instantiate com.example.ui.MyPerspective.

Later,
PW
Re: How transfer my plug-in project to RCP project? [message #449574 is a reply to message #449500] Mon, 15 May 2006 23:16 Go to previous messageGo to next message
Eclipse UserFriend
I have no clear idea about "match";how to set a perspective to match a
existent plug-in .And my log didn't have the message you mentioned.

I think it need something to invoke the plug-in ,such as "initializer";
but this is only my suppose.

If Somebody who have done the similar work "transform the plug-in
exsited to a RCP" can give me some advice on the step,I will be
impassioned deeply.
Re: How transfer my plug-in project to RCP project? [message #449576 is a reply to message #449574] Tue, 16 May 2006 00:21 Go to previous messageGo to next message
Eclipse UserFriend
I think "getInitialWindowPerspectiveId()" in class
"ApplicationWorkbenchAdvisor" returns the first display in plug-in.How to
get the first perspective in my plug-in.
Re: How transfer my plug-in project to RCP project? [message #449584 is a reply to message #449574] Tue, 16 May 2006 07:23 Go to previous messageGo to next message
Eclipse UserFriend
Leo wrote:
> I have no clear idea about "match";how to set a perspective to match
> a existent plug-in .And my log didn't have the message you mentioned.
>

Sorry, Leo, I meant literally match. i.e. you called your perspective
"rpc.MyPerspective", and yet you asked for an initial perspective of
"com.example.ui.MyPerspective" in MyWorkbenchAdvisor.

The names don't match, and so RCP can't start your perspective.

Later,
PW
Re: How transfer my plug-in project to RCP project? [message #449620 is a reply to message #449584] Tue, 16 May 2006 22:47 Go to previous message
Eclipse UserFriend
Thanks,I got it:)
Previous Topic:Environtment Variable issue
Next Topic:Help:The reason for the error messages?
Goto Forum:
  


Current Time: Sat Aug 30 21:57:25 EDT 2025

Powered by FUDForum. Page generated in 0.23450 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top