Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » ControlContribution from toolbar:org.eclipse.ui.main.toolbar#dynamic
ControlContribution from toolbar:org.eclipse.ui.main.toolbar#dynamic [message #494596] Sat, 31 October 2009 17:16 Go to next message
Vuk  is currently offline Vuk
Messages: 5
Registered: July 2009
Junior Member
Hello all,


I'm intrested in providing a ControlContribution to my RCP application from a seperate plugin. So far I have a command button that is added to the toolbar via toolbar:org.eclipse.ui.main.toolbar#command. The button works fine. However when I try toolbar:org.eclipse.ui.main.toolbar#dynamic then I create a class that extends ControlContribution overriding createControl(). When the application launches I get:

org.eclipse.core.runtime.CoreException: Plug-in "xts.encdec" was unable to instantiate class "xts.encdec.PrimaryContributionControl".


Part of Plugin.xml

<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions ">
<toolbar
id="xts.encdec.toolbars.main">
<command
commandId="xts.encdec.commands.go"
id="xts.encdec.menu.commands.go"
label="Go"
tooltip="Go">
</command>
<dynamic
class="xts.encdec.PrimaryContributionControl"
id="xts.encdec.menu.primarycontributioncontrol">
</dynamic>
</toolbar>
</menuContribution>
</extension>


PrimaryContributionControl.java:

package xts.encdec;

import org.apache.log4j.Logger;
import org.eclipse.jface.action.ControlContribution;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;

import dtv.xts.log.TracerLevel;

public class PrimaryContributionControl extends ControlContribution {

private static final Logger LOG = Logger.getLogger(PrimaryContributionControl.class);


public PrimaryContributionControl(String id) {
super(id);
LOG.log(TracerLevel.GUI, "Calling private constructor.");
}


@Override
protected Control createControl(Composite parent) {

LOG.log(TracerLevel.GUI, "Creating toolbar for EncDec Plug-in...");
//Text text = new Text(parent, SWT.BORDER);
//return text;
return null;
}

}


Any insight to this error would be great. Ultimately I want a plugin to provide a combo box textfield etc from a seperate plugin, but I would like to define this from plugin.xml if at all possible. I hope I explained myself well enough, still new to the RCP scene.

Thanks!


Oh I should add I don't want to go through ApplicationActionBarAdvisor#fillCoolBar because this plugin may be removed from my RCP app at any time.

[Updated on: Sat, 31 October 2009 17:19]

Report message to a moderator

Re: ControlContribution from toolbar:org.eclipse.ui.main.toolbar#dynamic [message #494630 is a reply to message #494596] Sun, 01 November 2009 08:02 Go to previous messageGo to next message
Christian is currently offline Christian
Messages: 72
Registered: July 2009
Member
Vuk schrieb:
> Hello all,
>

> toolbar:org.eclipse.ui.main.toolbar#dynamic then I create a class that
> extends ControlContribution overriding createControl(). When the
> application launches I get:
>
have you tried overriding WorkbenchWindowControlContribution ?
Your created class has no no-args constructor therefore instantiation
via reflection fails...

Christian
Re: ControlContribution from toolbar:org.eclipse.ui.main.toolbar#dynamic [message #494653 is a reply to message #494630] Sun, 01 November 2009 16:17 Go to previous message
Vuk  is currently offline Vuk
Messages: 5
Registered: July 2009
Junior Member
Thanks Christian that worked out great.

I extended WorkbenchWindowControlContribution also a IContributeItem

Rolling Eyes

Cheers!
Previous Topic:Performance of RCP
Next Topic:Pass the selection of the Package Explorer into a New Wizard
Goto Forum:
  


Current Time: Tue Sep 02 00:22:09 EDT 2014

Powered by FUDForum. Page generated in 0.01638 seconds