Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 342771 | Differences between
and this patch

Collapse All | Expand All

(-)META-INF/sapphire-extension.xml (+18 lines)
Lines 14-19 Link Here
14
-->
14
-->
15
15
16
<extension xmlns="http://www.eclipse.org/sapphire/xmlns/extension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
16
<extension xmlns="http://www.eclipse.org/sapphire/xmlns/extension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
17
    <action>
18
        <id>Sapphire.Gallery.Open.Homepage</id>
19
        <label>Sapphire Project</label>
20
        <image>images/web.png</image>
21
        <description>Open Sapphire project homepage</description>
22
        <context>Sapphire.EditorPage</context>
23
        <condition>org.eclipse.sapphire.samples.gallery.ui.OpenHomepageCondition</condition>
24
        <hint>
25
            <name>action.style</name>
26
            <value>image+label</value>
27
        </hint>
28
    </action>
29
    <action-handler>
30
        <action>Sapphire.Gallery.Open.Homepage</action>
31
        <id>Sapphire.Gallery.Open.Homepage</id>
32
        <label>Sapphire Project</label>
33
        <impl>org.eclipse.sapphire.samples.gallery.ui.OpenHomepageActionHandler</impl>
34
    </action-handler>
17
    <value-serialization-service>
35
    <value-serialization-service>
18
        <type>org.eclipse.sapphire.samples.gallery.Circle</type>
36
        <type>org.eclipse.sapphire.samples.gallery.Circle</type>
19
        <impl>org.eclipse.sapphire.samples.gallery.internal.CircleSerializationService</impl>
37
        <impl>org.eclipse.sapphire.samples.gallery.internal.CircleSerializationService</impl>
(-)src/org/eclipse/sapphire/samples/gallery/ui/OpenHomepageActionHandler.java (+39 lines)
Added Link Here
1
package org.eclipse.sapphire.samples.gallery.ui;
2
3
import java.net.URL;
4
5
import org.eclipse.sapphire.ui.SapphireActionHandler;
6
import org.eclipse.sapphire.ui.SapphireRenderingContext;
7
import org.eclipse.swt.widgets.Display;
8
import org.eclipse.ui.PlatformUI;
9
import org.eclipse.ui.browser.IWebBrowser;
10
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
11
12
13
public class OpenHomepageActionHandler extends SapphireActionHandler {
14
15
	@Override
16
	protected Object run(SapphireRenderingContext context) {
17
18
		Display.getDefault().asyncExec(new Runnable() {
19
20
			public void run() {
21
				try {
22
					IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
23
24
					IWebBrowser browser =
25
						browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR |
26
							IWorkbenchBrowserSupport.NAVIGATION_BAR, null, "Sapphire Project", null);
27
28
					browser.openURL(new URL("http://www.eclipse.org/sapphire/"));
29
				}
30
				catch (Exception e) {
31
					// ignore
32
				}
33
			}
34
		});
35
36
		return null;
37
	}
38
39
}
(-)src/org/eclipse/sapphire/samples/gallery/ui/OpenHomepageCondition.java (+24 lines)
Added Link Here
1
package org.eclipse.sapphire.samples.gallery.ui;
2
3
import org.eclipse.sapphire.ui.ISapphirePart;
4
import org.eclipse.sapphire.ui.SapphireCondition;
5
6
7
public class OpenHomepageCondition extends SapphireCondition {
8
9
	@Override
10
	protected boolean evaluate() {
11
		ISapphirePart part = this.getPart();
12
13
		while (part != null) {
14
			if (part instanceof SapphireGallerySampleEditor) {
15
				return true;
16
			}
17
18
			part = part.getParentPart();
19
		}
20
21
		return false;
22
	}
23
24
}
(-)sdef/SapphireEditorCommon.sdef (+1 lines)
Lines 45-50 Link Here
45
                        <property-editor>Label</property-editor>
45
                        <property-editor>Label</property-editor>
46
                        <property-editor>KeyBinding</property-editor>
46
                        <property-editor>KeyBinding</property-editor>
47
                        <property-editor>Type</property-editor>
47
                        <property-editor>Type</property-editor>
48
                        <property-editor>Hints</property-editor>
48
                        <property-editor>Images</property-editor>
49
                        <property-editor>Images</property-editor>
49
                        <property-editor>
50
                        <property-editor>
50
                            <property>Description</property>
51
                            <property>Description</property>
(-)src/org/eclipse/sapphire/ui/SapphireAction.java (+28 lines)
Lines 13-19 Link Here
13
13
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.Collections;
15
import java.util.Collections;
16
import java.util.HashMap;
16
import java.util.List;
17
import java.util.List;
18
import java.util.Map;
17
import java.util.concurrent.CopyOnWriteArrayList;
19
import java.util.concurrent.CopyOnWriteArrayList;
18
20
19
import org.eclipse.sapphire.modeling.el.Function;
21
import org.eclipse.sapphire.modeling.el.Function;
Lines 21-26 Link Here
21
import org.eclipse.sapphire.modeling.el.FunctionResult;
23
import org.eclipse.sapphire.modeling.el.FunctionResult;
22
import org.eclipse.sapphire.modeling.el.Literal;
24
import org.eclipse.sapphire.modeling.el.Literal;
23
import org.eclipse.sapphire.ui.def.ISapphireActionDef;
25
import org.eclipse.sapphire.ui.def.ISapphireActionDef;
26
import org.eclipse.sapphire.ui.def.ISapphireHint;
24
import org.eclipse.sapphire.ui.def.SapphireActionType;
27
import org.eclipse.sapphire.ui.def.SapphireActionType;
25
import org.eclipse.sapphire.ui.def.SapphireKeySequence;
28
import org.eclipse.sapphire.ui.def.SapphireKeySequence;
26
import org.eclipse.sapphire.ui.internal.SapphireUiFrameworkPlugin;
29
import org.eclipse.sapphire.ui.internal.SapphireUiFrameworkPlugin;
Lines 48-53 Link Here
48
    private final List<SapphireActionHandler> handlers = new CopyOnWriteArrayList<SapphireActionHandler>();
51
    private final List<SapphireActionHandler> handlers = new CopyOnWriteArrayList<SapphireActionHandler>();
49
    private final List<SapphireActionHandlerFilter> filters = new CopyOnWriteArrayList<SapphireActionHandlerFilter>();
52
    private final List<SapphireActionHandlerFilter> filters = new CopyOnWriteArrayList<SapphireActionHandlerFilter>();
50
    private final Listener handlerListener;
53
    private final Listener handlerListener;
54
    private Map<String,Object> hints;
51
    
55
    
52
    public SapphireAction()
56
    public SapphireAction()
53
    {
57
    {
Lines 103-108 Link Here
103
        }
107
        }
104
        
108
        
105
        setEnabled( false );
109
        setEnabled( false );
110
        
111
        this.hints = new HashMap<String,Object>();
112
        
113
        for( ISapphireHint hint : def.getHints() )
114
        {
115
            final String name = hint.getName().getText();
116
            Object parsedValue = null;
117
            
118
            if( name.equals( ISapphireActionDef.HINT_ACTION_STYLE ) )
119
            {
120
                parsedValue = hint.getValue().getText();
121
            }
122
           
123
            this.hints.put( name, parsedValue );
124
        }
106
    }
125
    }
107
    
126
    
108
    @Override
127
    @Override
Lines 196-201 Link Here
196
        return this.parent.getContext();
215
        return this.parent.getContext();
197
    }
216
    }
198
    
217
    
218
    @SuppressWarnings( "unchecked" )
219
    
220
    public <T> T getRenderingHint( final String name,
221
                                   final T defaultValue )
222
    {
223
        final Object hintValue = this.hints == null ? null : this.hints.get( name );
224
        return hintValue == null ? defaultValue : (T) hintValue;
225
    }
226
199
    public SapphireActionType getType()
227
    public SapphireActionType getType()
200
    {
228
    {
201
        synchronized( this )
229
        synchronized( this )
(-)src/org/eclipse/sapphire/ui/SapphireSection.java (-1 / +1 lines)
Lines 108-114 Link Here
108
        final SapphireActionPresentationManager actionPresentationManager = new SapphireActionPresentationManager( context, actions );
108
        final SapphireActionPresentationManager actionPresentationManager = new SapphireActionPresentationManager( context, actions );
109
        final SapphireToolBarActionPresentation toolBarActionsPresentation = new SapphireToolBarActionPresentation( actionPresentationManager );
109
        final SapphireToolBarActionPresentation toolBarActionsPresentation = new SapphireToolBarActionPresentation( actionPresentationManager );
110
        
110
        
111
        final ToolBar toolbar = new ToolBar( this.section, SWT.FLAT | SWT.HORIZONTAL );
111
        final ToolBar toolbar = new ToolBar( this.section, SWT.FLAT | SWT.HORIZONTAL | SWT.RIGHT );
112
        toolBarActionsPresentation.setToolBar( toolbar );
112
        toolBarActionsPresentation.setToolBar( toolbar );
113
        toolBarActionsPresentation.render();
113
        toolBarActionsPresentation.render();
114
        this.section.setTextClient( toolbar );
114
        this.section.setTextClient( toolbar );
(-)src/org/eclipse/sapphire/ui/def/ISapphireActionDef.java (+16 lines)
Lines 13-18 Link Here
13
13
14
import org.eclipse.core.runtime.IStatus;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.sapphire.modeling.ListProperty;
15
import org.eclipse.sapphire.modeling.ListProperty;
16
import org.eclipse.sapphire.modeling.ModelElementList;
16
import org.eclipse.sapphire.modeling.ModelElementType;
17
import org.eclipse.sapphire.modeling.ModelElementType;
17
import org.eclipse.sapphire.modeling.Value;
18
import org.eclipse.sapphire.modeling.Value;
18
import org.eclipse.sapphire.modeling.ValueProperty;
19
import org.eclipse.sapphire.modeling.ValueProperty;
Lines 25-30 Link Here
25
import org.eclipse.sapphire.modeling.annotations.Type;
26
import org.eclipse.sapphire.modeling.annotations.Type;
26
import org.eclipse.sapphire.modeling.serialization.ValueSerialization;
27
import org.eclipse.sapphire.modeling.serialization.ValueSerialization;
27
import org.eclipse.sapphire.modeling.xml.annotations.XmlBinding;
28
import org.eclipse.sapphire.modeling.xml.annotations.XmlBinding;
29
import org.eclipse.sapphire.modeling.xml.annotations.XmlListBinding;
28
import org.eclipse.sapphire.ui.def.internal.KeySequenceValueSerializationService;
30
import org.eclipse.sapphire.ui.def.internal.KeySequenceValueSerializationService;
29
31
30
/**
32
/**
Lines 41-46 Link Here
41
{
43
{
42
    ModelElementType TYPE = new ModelElementType( ISapphireActionDef.class );
44
    ModelElementType TYPE = new ModelElementType( ISapphireActionDef.class );
43
    
45
    
46
	String HINT_ACTION_STYLE = "action.style";
47
	String HINT_VALUE_ACTION_STYLE_IMAGE = "image";
48
	String HINT_VALUE_ACTION_STYLE_IMAGE_LABEL = "image+label";
49
	String HINT_VALUE_ACTION_STYLE_LABEL_ONLY = "label-only";
50
44
    // *** Id ***
51
    // *** Id ***
45
52
46
    @NonNullValue
53
    @NonNullValue
Lines 166-171 Link Here
166
    Value<String> getGroup();
173
    Value<String> getGroup();
167
    void setGroup( String value );
174
    void setGroup( String value );
168
    
175
    
176
	// *** Hints ***
177
178
	@Label(standard = "hints")
179
	@Type(base = ISapphireHint.class)
180
	@XmlListBinding(mappings = @XmlListBinding.Mapping(element = "hint", type = ISapphireHint.class))
181
	ListProperty PROP_HINTS = new ListProperty(TYPE, "Hints");
182
183
	ModelElementList<ISapphireHint> getHints();
184
169
    // *** LocationHints ***
185
    // *** LocationHints ***
170
    
186
    
171
    @Documentation( content = "Location hints are used to arrange actions in relation to each other. " +
187
    @Documentation( content = "Location hints are used to arrange actions in relation to each other. " +
(-)src/org/eclipse/sapphire/ui/def/ISapphireHint.java (-1 / +2 lines)
Lines 72-78 Link Here
72
            "show.label",
72
            "show.label",
73
            "show.label.above",
73
            "show.label.above",
74
            "suppress.assist.contributors",
74
            "suppress.assist.contributors",
75
            ISapphirePartDef.HINT_WIDTH
75
            ISapphirePartDef.HINT_WIDTH, 
76
            ISapphireActionDef.HINT_ACTION_STYLE,
76
        },
77
        },
77
        invalidValueMessage = "\"{0}\" is not a valid hint.",
78
        invalidValueMessage = "\"{0}\" is not a valid hint.",
78
        invalidValueSeverity = IStatus.OK
79
        invalidValueSeverity = IStatus.OK
(-)src/org/eclipse/sapphire/ui/def/internal/SapphireHintValuePossibleValuesService.java (+7 lines)
Lines 15-20 Link Here
15
15
16
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.sapphire.modeling.PossibleValuesService;
17
import org.eclipse.sapphire.modeling.PossibleValuesService;
18
import org.eclipse.sapphire.ui.def.ISapphireActionDef;
18
import org.eclipse.sapphire.ui.def.ISapphireHint;
19
import org.eclipse.sapphire.ui.def.ISapphireHint;
19
import org.eclipse.sapphire.ui.def.ISapphirePropertyEditorDef;
20
import org.eclipse.sapphire.ui.def.ISapphirePropertyEditorDef;
20
21
Lines 40-45 Link Here
40
                values.add( ISapphirePropertyEditorDef.HINT_VALUE_CHECKBOX_LAYOUT_TRAILING_LABEL );
41
                values.add( ISapphirePropertyEditorDef.HINT_VALUE_CHECKBOX_LAYOUT_TRAILING_LABEL );
41
                values.add( ISapphirePropertyEditorDef.HINT_VALUE_CHECKBOX_LAYOUT_TRAILING_LABEL_INDENTED );
42
                values.add( ISapphirePropertyEditorDef.HINT_VALUE_CHECKBOX_LAYOUT_TRAILING_LABEL_INDENTED );
42
            }
43
            }
44
            else if ( hint.equals( ISapphireActionDef.HINT_ACTION_STYLE ) ) 
45
            {
46
            	values.add( ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE );
47
            	values.add( ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE_LABEL );
48
            	values.add( ISapphireActionDef.HINT_VALUE_ACTION_STYLE_LABEL_ONLY );
49
            }
43
        }
50
        }
44
    }
51
    }
45
    
52
    
(-)src/org/eclipse/sapphire/ui/swt/renderer/SapphireToolBarActionPresentation.java (-2 / +16 lines)
Lines 22-27 Link Here
22
import org.eclipse.sapphire.ui.SapphireActionGroup;
22
import org.eclipse.sapphire.ui.SapphireActionGroup;
23
import org.eclipse.sapphire.ui.SapphireActionHandler;
23
import org.eclipse.sapphire.ui.SapphireActionHandler;
24
import org.eclipse.sapphire.ui.SapphireRenderingContext;
24
import org.eclipse.sapphire.ui.SapphireRenderingContext;
25
import org.eclipse.sapphire.ui.def.ISapphireActionDef;
25
import org.eclipse.sapphire.ui.def.SapphireActionType;
26
import org.eclipse.sapphire.ui.def.SapphireActionType;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.accessibility.AccessibleAdapter;
28
import org.eclipse.swt.accessibility.AccessibleAdapter;
Lines 129-136 Link Here
129
            {
130
            {
130
                throw new IllegalStateException();
131
                throw new IllegalStateException();
131
            }
132
            }
132
133
            
133
            toolItem.setImage( context.getImageCache().getImage( action.getImage( 16 ) ) );
134
            String hint = action.getRenderingHint(ISapphireActionDef.HINT_ACTION_STYLE, ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE);
135
            
136
            if (ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE.equals(hint) || 
137
            	ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE_LABEL.equals(hint))
138
            {
139
            	toolItem.setImage( context.getImageCache().getImage( action.getImage( 16 ) ) );
140
            }
141
            
142
            if (ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE_LABEL.equals(hint) ||
143
				ISapphireActionDef.HINT_VALUE_ACTION_STYLE_LABEL_ONLY.equals(hint))
144
            {
145
            	toolItem.setText( LabelTransformer.transform( action.getLabel(), CapitalizationType.TITLE_STYLE, true ) );
146
            }
147
            
134
            toolItem.setToolTipText( LabelTransformer.transform( action.getLabel(), CapitalizationType.TITLE_STYLE, false ) );
148
            toolItem.setToolTipText( LabelTransformer.transform( action.getLabel(), CapitalizationType.TITLE_STYLE, false ) );
135
            toolItem.setData( action );
149
            toolItem.setData( action );
136
            toolItem.addSelectionListener( toolItemListener );
150
            toolItem.addSelectionListener( toolItemListener );
(-)src/org/eclipse/sapphire/ui/swt/renderer/SapphireToolBarManagerActionPresentation.java (-3 / +81 lines)
Lines 13-23 Link Here
13
13
14
import static org.eclipse.sapphire.modeling.util.MiscUtil.equal;
14
import static org.eclipse.sapphire.modeling.util.MiscUtil.equal;
15
15
16
import java.util.ArrayList;
16
import java.util.List;
17
import java.util.List;
17
18
18
import org.eclipse.jface.action.ActionContributionItem;
19
import org.eclipse.jface.action.ActionContributionItem;
20
import org.eclipse.jface.action.ContributionItem;
21
import org.eclipse.jface.action.ControlContribution;
19
import org.eclipse.jface.action.IAction;
22
import org.eclipse.jface.action.IAction;
20
import org.eclipse.jface.action.IContributionItem;
23
import org.eclipse.jface.action.IContributionItem;
24
import org.eclipse.jface.action.IContributionManager;
21
import org.eclipse.jface.action.IToolBarManager;
25
import org.eclipse.jface.action.IToolBarManager;
22
import org.eclipse.jface.action.Separator;
26
import org.eclipse.jface.action.Separator;
23
import org.eclipse.jface.action.SubContributionItem;
27
import org.eclipse.jface.action.SubContributionItem;
Lines 30-41 Link Here
30
import org.eclipse.sapphire.ui.SapphireActionGroup;
34
import org.eclipse.sapphire.ui.SapphireActionGroup;
31
import org.eclipse.sapphire.ui.SapphireActionHandler;
35
import org.eclipse.sapphire.ui.SapphireActionHandler;
32
import org.eclipse.sapphire.ui.SapphireRenderingContext;
36
import org.eclipse.sapphire.ui.SapphireRenderingContext;
37
import org.eclipse.sapphire.ui.def.ISapphireActionDef;
33
import org.eclipse.sapphire.ui.def.SapphireActionType;
38
import org.eclipse.sapphire.ui.def.SapphireActionType;
39
import org.eclipse.swt.SWT;
40
import org.eclipse.swt.events.DisposeEvent;
41
import org.eclipse.swt.events.DisposeListener;
34
import org.eclipse.swt.graphics.Cursor;
42
import org.eclipse.swt.graphics.Cursor;
35
import org.eclipse.swt.graphics.Rectangle;
43
import org.eclipse.swt.graphics.Rectangle;
44
import org.eclipse.swt.widgets.Button;
45
import org.eclipse.swt.widgets.Composite;
46
import org.eclipse.swt.widgets.Control;
47
import org.eclipse.swt.widgets.CoolBar;
48
import org.eclipse.swt.widgets.Menu;
36
import org.eclipse.swt.widgets.Shell;
49
import org.eclipse.swt.widgets.Shell;
37
import org.eclipse.swt.widgets.ToolBar;
50
import org.eclipse.swt.widgets.ToolBar;
38
import org.eclipse.swt.widgets.ToolItem;
51
import org.eclipse.swt.widgets.ToolItem;
52
import org.eclipse.ui.internal.forms.widgets.FormsResources;
39
53
40
/**
54
/**
41
 * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a>
55
 * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a>
Lines 47-52 Link Here
47
    
61
    
48
{
62
{
49
    private IToolBarManager toolbar;
63
    private IToolBarManager toolbar;
64
    private SapphireToolbarContribution sapphireToolbar;
50
    
65
    
51
    public SapphireToolBarManagerActionPresentation( final SapphireActionPresentationManager manager )
66
    public SapphireToolBarManagerActionPresentation( final SapphireActionPresentationManager manager )
52
    {
67
    {
Lines 68-73 Link Here
68
    public void setToolBarManager( final IToolBarManager toolbar )
83
    public void setToolBarManager( final IToolBarManager toolbar )
69
    {
84
    {
70
        this.toolbar = toolbar;
85
        this.toolbar = toolbar;
86
        
87
        this.sapphireToolbar = new SapphireToolbarContribution("sapphire");
71
    }
88
    }
72
    
89
    
73
    public void render()
90
    public void render()
Lines 79-91 Link Here
79
        boolean first = true;
96
        boolean first = true;
80
        String lastGroup = null;
97
        String lastGroup = null;
81
        
98
        
99
        this.toolbar.add(this.sapphireToolbar);
100
        
82
        for( final SapphireAction action : getActions() )
101
        for( final SapphireAction action : getActions() )
83
        {
102
        {
84
            final String group = action.getGroup();
103
            final String group = action.getGroup();
85
            
104
            
86
            if( ! first && ! equal( lastGroup, group ) )
105
            if( ! first && ! equal( lastGroup, group ) )
87
            {
106
            {
88
                this.toolbar.add( new Separator() );
107
                this.sapphireToolbar.add( new Separator() );
89
            }
108
            }
90
            
109
            
91
            first = false;
110
            first = false;
Lines 130-139 Link Here
130
                throw new IllegalStateException();
149
                throw new IllegalStateException();
131
            }
150
            }
132
            
151
            
133
            a.setImageDescriptor( action.getImage( 16 ) );
152
            String hint = action.getRenderingHint(ISapphireActionDef.HINT_ACTION_STYLE, ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE);
153
            
154
            if (ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE.equals(hint) || 
155
            	ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE_LABEL.equals(hint))
156
            {
157
            	a.setImageDescriptor( action.getImage( 16 ) );
158
            }
159
            
160
            if (ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE_LABEL.equals(hint) ||
161
				ISapphireActionDef.HINT_VALUE_ACTION_STYLE_LABEL_ONLY.equals(hint))
162
            {
163
            	a.setText( LabelTransformer.transform( action.getLabel(), CapitalizationType.TITLE_STYLE, true ) );
164
            }
165
            
134
            a.setToolTipText( LabelTransformer.transform( action.getLabel(), CapitalizationType.TITLE_STYLE, false ) );
166
            a.setToolTipText( LabelTransformer.transform( action.getLabel(), CapitalizationType.TITLE_STYLE, false ) );
135
            
167
            
136
            this.toolbar.add( a );
168
            ActionContributionItem item = new ActionContributionItem(a);
169
            
170
            if (ISapphireActionDef.HINT_VALUE_ACTION_STYLE_IMAGE_LABEL.equals(hint))
171
            {
172
            	item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
173
            }
174
                       
175
            this.sapphireToolbar.add( item );
137
            
176
            
138
            final Runnable updateActionEnablementStateOp = new Runnable()
177
            final Runnable updateActionEnablementStateOp = new Runnable()
139
            {
178
            {
Lines 256-259 Link Here
256
        }
295
        }
257
    }
296
    }
258
    
297
    
298
    private final class SapphireToolbarContribution extends ControlContribution
299
    {
300
		private ToolBarManager embeddedToolbarManager;
301
		private List<IContributionItem> items = new ArrayList<IContributionItem>();
302
303
		protected SapphireToolbarContribution(String id)
304
		{
305
			super(id);
306
		}
307
		
308
		public void add(IContributionItem item)
309
		{
310
			items.add(item);
311
		}
312
313
		@Override
314
		protected Control createControl(Composite parent)
315
		{
316
			this.embeddedToolbarManager = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
317
			ToolBar embeddedToolbar = this.embeddedToolbarManager.createControl(parent);
318
			embeddedToolbar.setBackground(null);
319
			embeddedToolbar.setForeground(parent.getForeground());
320
			embeddedToolbar.setCursor(FormsResources.getHandCursor());
321
			updateToolbar();
322
			return embeddedToolbar;
323
		}
324
		
325
		private void updateToolbar()
326
		{
327
			this.embeddedToolbarManager.removeAll();
328
			
329
			for (IContributionItem item : items) {
330
				this.embeddedToolbarManager.add(item);
331
			}
332
			
333
			this.embeddedToolbarManager.update(true);
334
		}
335
    	
336
    }
259
}
337
}

Return to bug 342771