Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » ComboBox Editor toolbar contribution Problems
ComboBox Editor toolbar contribution Problems [message #483810] Thu, 03 September 2009 07:25 Go to next message
Trevor Campbell is currently offline Trevor CampbellFriend
Messages: 23
Registered: July 2009
Junior Member
I have an RCP application that uses an editor in the standard sort of way.
I have a EditorActionBarContributor which provides a number of specific
actions for the editor. Now I have added a Combo to the Toolbar as
follows.

_aircraftSelectionContribution = new ControlContribution("aicraft-combo") {

@Override
protected Control createControl(Composite parent) {
Combo combo = new Combo(parent, SWT.DROP_DOWN);
HierarchicalConfiguration aircraftConfig =
FGFPApplication.getInstance().getAircraftConfig();
List aircraftList =
aircraftConfig.getList("aircrafts.aircraft[@name]");
for (Iterator iterator = aircraftList.iterator(); iterator.hasNext();)
{
String name = (String) iterator.next();
combo.add(name);
}
return combo;
}
};
toolBarManager.add(_aircraftSelectionContribution);

This works, but the control seems shared across all instances of the
editor. What I want is for the selection in the combo to be related to
each editor instance but I cannot see how I can do this.
Re: ComboBox Editor toolbar contribution Problems [message #484684 is a reply to message #483810] Tue, 08 September 2009 17:59 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You would have to write code to determine which editor you are dealing with. i.e. EditorActionBarContributors have a setActiveEditor(*) method ... you would update your control/list in that method (that would be a place to start).

PW


Re: ComboBox Editor toolbar contribution Prob lems [message #486290 is a reply to message #484684] Thu, 17 September 2009 07:49 Go to previous message
Trevor Campbell is currently offline Trevor CampbellFriend
Messages: 23
Registered: July 2009
Junior Member
Thanks for the tip. In setActiveEditor I have been able to add code to
get the required value from the active editor and set the selection on the
combo box. I have one remaining problem however.

I am not able to set the selection when the first Editor appears, as the
Control is not actually available at the time the setActiveEditor() is
called at the when the editor first opens. A new editor is fine, as long
as it isn't the first. That is the createControl(Composite parent) of my
ControlContribution gets called after setActiveEditor(). I tried adding
extra code in the createControl(Composite parent) but that also raised
"Widget disposed too early!" exception.
Previous Topic:listening to resource changes caused by team synchronization
Next Topic:Content outline context menu
Goto Forum:
  


Current Time: Thu Sep 19 14:38:26 GMT 2024

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

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

Back to the top