View | Details | Raw Unified | Return to bug 227541 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gef/internal/ui/palette/editparts/PinnablePaletteStackFigure.java (-60 / +88 lines)
Lines 12-18 Link Here
12
package org.eclipse.gef.internal.ui.palette.editparts;
12
package org.eclipse.gef.internal.ui.palette.editparts;
13
13
14
import java.util.Iterator;
14
import java.util.Iterator;
15
import java.util.List;
16
15
17
import org.eclipse.swt.graphics.Color;
16
import org.eclipse.swt.graphics.Color;
18
17
Lines 22-27 Link Here
22
import org.eclipse.draw2d.ButtonModel;
21
import org.eclipse.draw2d.ButtonModel;
23
import org.eclipse.draw2d.ChangeEvent;
22
import org.eclipse.draw2d.ChangeEvent;
24
import org.eclipse.draw2d.ChangeListener;
23
import org.eclipse.draw2d.ChangeListener;
24
import org.eclipse.draw2d.Clickable;
25
import org.eclipse.draw2d.Figure;
25
import org.eclipse.draw2d.Figure;
26
import org.eclipse.draw2d.FigureUtilities;
26
import org.eclipse.draw2d.FigureUtilities;
27
import org.eclipse.draw2d.FlowLayout;
27
import org.eclipse.draw2d.FlowLayout;
Lines 37-42 Link Here
37
import org.eclipse.draw2d.geometry.Rectangle;
37
import org.eclipse.draw2d.geometry.Rectangle;
38
38
39
import org.eclipse.gef.internal.ui.palette.PaletteColorUtil;
39
import org.eclipse.gef.internal.ui.palette.PaletteColorUtil;
40
import org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart.ToolEntryToggle;
40
import org.eclipse.gef.ui.palette.PaletteViewerPreferences;
41
import org.eclipse.gef.ui.palette.PaletteViewerPreferences;
41
42
42
/**
43
/**
Lines 70-75 Link Here
70
71
71
private static final Dimension EMPTY_DIMENSION = new Dimension(0, 0);
72
private static final Dimension EMPTY_DIMENSION = new Dimension(0, 0);
72
73
74
static final int ARROW_WIDTH = 9;
75
73
/**
76
/**
74
 * A toggle with a triangle figure.
77
 * A toggle with a triangle figure.
75
 */
78
 */
Lines 81-87 Link Here
81
    setRolloverEnabled(true);
84
    setRolloverEnabled(true);
82
    setBorder(null);
85
    setBorder(null);
83
    setOpaque(false);
86
    setOpaque(false);
84
    setPreferredSize(11, -1);
87
    setPreferredSize(ARROW_WIDTH, -1);
85
}
88
}
86
89
87
/**
90
/**
Lines 92-127 Link Here
92
}
95
}
93
96
94
public void paintFigure(Graphics graphics) {
97
public void paintFigure(Graphics graphics) {
95
    Rectangle rect = getBounds().getCopy();
98
    Rectangle rect = getClientArea();
99
100
    ButtonModel model = getModel();
101
    if (isRolloverEnabled() && model.isMouseOver()) {
102
        graphics.setBackgroundColor(PaletteColorUtil.ARROW_HOVER);
103
        graphics.fillRoundRectangle(rect, 3, 3);
104
    }
96
105
97
    graphics.translate(getLocation());
106
    graphics.translate(getLocation());
98
107
99
    // fill the arrow
108
    // fill the arrow
100
    int[] points = new int[8];
109
    int[] points = new int[8];
101
110
111
    int middleY = rect.height / 2;
102
    if (isSelected() || layoutMode == PaletteViewerPreferences.LAYOUT_ICONS
112
    if (isSelected() || layoutMode == PaletteViewerPreferences.LAYOUT_ICONS
103
        || layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
113
        || layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
104
        // pointing down
114
        // pointing down
105
        points[0] = 4;
115
        int startingX = (ARROW_WIDTH - 5) / 2; // triangle width = 5
106
        points[1] = rect.height / 2;
116
        points[0] = startingX;
107
        points[2] = 9;
117
        points[1] = middleY;
108
        points[3] = rect.height / 2;
118
        points[2] = startingX + 5;
109
        points[4] = 6;
119
        points[3] = middleY;
110
        points[5] = rect.height / 2 + 3;
120
        points[4] = startingX + 2;
111
        points[6] = 4;
121
        points[5] = middleY + 3;
112
        points[7] = rect.height / 2;
122
        points[6] = startingX;
123
        points[7] = middleY;
113
    } else {
124
    } else {
114
        // pointing to the right
125
        // pointing to the right
115
        points[0] = 5;
126
        int startingX = (ARROW_WIDTH - 3) / 2; // triangle width = 3
116
        points[1] = rect.height / 2 - 2;
127
        points[0] = startingX;
117
        points[2] = 8;
128
        points[1] = middleY - 2;
118
        points[3] = rect.height / 2 + 1;
129
        points[2] = startingX + 3;
119
        points[4] = 5;
130
        points[3] = middleY + 1;
120
        points[5] = rect.height / 2 + 4;
131
        points[4] = startingX;
121
        points[6] = 5;
132
        points[5] = middleY + 4;
122
        points[7] = rect.height / 2 - 2;
133
        points[6] = startingX;
134
        points[7] = middleY - 2;
123
    }
135
    }
124
136
137
    graphics.setBackgroundColor(PaletteColorUtil.WIDGET_DARK_SHADOW);
125
    graphics.fillPolygon(points);
138
    graphics.fillPolygon(points);
126
139
127
    graphics.translate(getLocation().getNegated());
140
    graphics.translate(getLocation().getNegated());
Lines 130-135 Link Here
130
143
131
/**
144
/**
132
 * Layout manager for the palette stack header figure that handles the layout of
145
 * Layout manager for the palette stack header figure that handles the layout of
146
 * the <code>headerFigure</code> (<code>arrowFigure</code> and the active
147
 * tool figure) when in icons or columns layout mode.
148
 */
149
private class HeaderIconLayout
150
    extends StackLayout {
151
152
protected boolean isSensitiveVertically(IFigure container) {
153
    return false;
154
}
155
156
public void layout(IFigure parent) {
157
158
    Rectangle r = parent.getClientArea();
159
160
    activeToolFigure.setBounds(r);
161
162
    // All tool figures have saved an area in its margin for the arrow figure in
163
    // case that tool figure is in a stack (see the BORDER variables in
164
    // ToolEntryEditPart). Calculate the arrow figure bounds by using the insets
165
    // of the active tool figure.
166
    r.x = r.right() - ToolEntryEditPart.ICON_HIGHLIGHT_INSETS.right - ARROW_WIDTH;
167
    r.y += ToolEntryEditPart.ICON_HIGHLIGHT_INSETS.top;
168
    r.width = ARROW_WIDTH;
169
    r.height -= ToolEntryEditPart.ICON_HIGHLIGHT_INSETS.getHeight();
170
    arrowFigure.setBounds(r);
171
}
172
}
173
174
/**
175
 * Layout manager for the palette stack header figure that handles the layout of
133
 * the <code>headerFigure</code> (<code>pinFigure</code>,
176
 * the <code>headerFigure</code> (<code>pinFigure</code>,
134
 * <code>arrowFigure</code>, and the active tool figure) when in list or
177
 * <code>arrowFigure</code>, and the active tool figure) when in list or
135
 * details layout mode.
178
 * details layout mode.
Lines 156-183 Link Here
156
public void layout(IFigure parent) {
199
public void layout(IFigure parent) {
157
200
158
    Rectangle r = parent.getClientArea();
201
    Rectangle r = parent.getClientArea();
159
    List children = parent.getChildren();
160
    IFigure child;
161
162
    Dimension pinSize = isExpanded() ? pinFigure.getPreferredSize()
202
    Dimension pinSize = isExpanded() ? pinFigure.getPreferredSize()
163
        : EMPTY_DIMENSION;
203
        : EMPTY_DIMENSION;
164
204
165
    for (int i = 0; i < children.size(); i++) {
205
    // layout the pin figure
166
        child = (IFigure) children.get(i);
206
    Rectangle.SINGLETON.setSize(pinSize);
167
        if (child == arrowFigure) {
207
    Rectangle.SINGLETON.setLocation(r.right() - pinSize.width, r.getCenter().y
168
            Rectangle.SINGLETON.setBounds(r);
208
        - (pinSize.height / 2));
169
            Rectangle.SINGLETON.width = 11;
209
    pinFigure.setBounds(Rectangle.SINGLETON);
170
            child.setBounds(Rectangle.SINGLETON);
210
171
        } else if (child == pinFigure) {
211
    activeToolFigure.setBounds(r.getResized(-pinSize.width, 0));
172
            Rectangle.SINGLETON.setSize(pinSize);
212
173
            Rectangle.SINGLETON.setLocation(r.right() - pinSize.width, r
213
    // All tool figures have saved an area in its margin for the arrow figure in
174
                .getCenter().y
214
    // case that tool figure is in a stack (see the BORDER variables in
175
                - (pinSize.height / 2));
215
    // ToolEntryEditPart). Calculate the arrow figure bounds by using the insets
176
            child.setBounds(Rectangle.SINGLETON);
216
    // of the active tool figure.
177
        } else {
217
    r.x += ToolEntryEditPart.LIST_HIGHLIGHT_INSETS.left;
178
            child.setBounds(r.getResized(-pinSize.width, 0));
218
    r.y += ToolEntryEditPart.LIST_HIGHLIGHT_INSETS.top;
179
        }
219
    r.width = ARROW_WIDTH;
180
    }
220
    r.height -= ToolEntryEditPart.LIST_HIGHLIGHT_INSETS.getHeight();
221
    arrowFigure.setBounds(r);
222
181
}
223
}
182
}
224
}
183
225
Lines 222-228 Link Here
222
private ChangeListener clickableArrowListener = new ChangeListener() {
264
private ChangeListener clickableArrowListener = new ChangeListener() {
223
265
224
    public void handleStateChanged(ChangeEvent event) {
266
    public void handleStateChanged(ChangeEvent event) {
225
        if (event.getPropertyName().equals(ButtonModel.SELECTED_PROPERTY)) {
267
        Clickable clickable = (Clickable)event.getSource();
268
        if (event.getPropertyName() == ButtonModel.MOUSEOVER_PROPERTY && getActiveFigure() instanceof ToolEntryToggle) {
269
                ((ToolEntryToggle)getActiveFigure()).setShowHoverFeedback(clickable.getModel().isMouseOver());
270
        }
271
         if (event.getPropertyName() == ButtonModel.SELECTED_PROPERTY) {
226
272
227
            Animation.markBegin();
273
            Animation.markBegin();
228
            handleExpandStateChanged();
274
            handleExpandStateChanged();
Lines 250-271 Link Here
250
                        }
296
                        }
251
                    }
297
                    }
252
                }
298
                }
253
254
                // The auto-collapsing of drawers is handled in the
255
                // PaletteAnimator.
256
                // If a stack is expanded when there is not enough room to fit
257
                // the
258
                // expanded stack than other drawers should be collapsed.
259
                // However,
260
                // when the animation is run the first time in this method the
261
                // drawer layout has not yet completed so other drawers are not
262
                // collapsed. This 'second pass' of the animation will ensure
263
                // that
264
                // drawers get collapsed if necessary as a result of the newly
265
                // expanded stack.
266
                Animation.markBegin();
267
                revalidate();
268
                Animation.run(150);
269
            }
299
            }
270
        }
300
        }
271
    }
301
    }
Lines 289-295 Link Here
289
    super();
319
    super();
290
320
291
    arrowFigure = new RolloverArrow();
321
    arrowFigure = new RolloverArrow();
292
    arrowFigure.setBackgroundColor(PaletteColorUtil.WIDGET_DARK_SHADOW);
293
    arrowFigure.addChangeListener(clickableArrowListener);
322
    arrowFigure.addChangeListener(clickableArrowListener);
294
323
295
    headerFigure = new Figure();
324
    headerFigure = new Figure();
Lines 415-428 Link Here
415
}
444
}
416
445
417
/**
446
/**
418
 * @return <code>true</code> if the drawer is expanded
447
 * @return <code>true</code> if the palette stack is expanded
419
 */
448
 */
420
public boolean isExpanded() {
449
public boolean isExpanded() {
421
    return arrowFigure.getModel().isSelected();
450
    return arrowFigure.getModel().isSelected();
422
}
451
}
423
452
424
/**
453
/**
425
 * @return <code>true</code> if the drawer is expanded and is pinned (i.e., it
454
 * @return <code>true</code> if the palette stack is expanded and is pinned (i.e., it
426
 *         can't be automatically collapsed)
455
 *         can't be automatically collapsed)
427
 */
456
 */
428
public boolean isPinnedOpen() {
457
public boolean isPinnedOpen() {
Lines 470-480 Link Here
470
        setLayoutManager(new ToolbarLayout());
499
        setLayoutManager(new ToolbarLayout());
471
500
472
    } else {
501
    } else {
473
        headerFigure.setLayoutManager(new BorderLayout());
502
        headerFigure.setLayoutManager(new HeaderIconLayout());
474
        if (activeToolFigure != null) {
503
        if (activeToolFigure != null) {
475
            headerFigure.setConstraint(activeToolFigure, BorderLayout.CENTER);
504
            headerFigure.setConstraint(activeToolFigure, BorderLayout.CENTER);
476
        }
505
        }
477
        headerFigure.setConstraint(arrowFigure, BorderLayout.RIGHT);
478
506
479
        setLayoutManager(new PaletteStackIconLayout());
507
        setLayoutManager(new PaletteStackIconLayout());
480
508
(-)src/org/eclipse/gef/internal/ui/palette/editparts/ToolEntryEditPart.java (-86 / +136 lines)
Lines 31-36 Link Here
31
import org.eclipse.draw2d.IFigure;
31
import org.eclipse.draw2d.IFigure;
32
import org.eclipse.draw2d.MarginBorder;
32
import org.eclipse.draw2d.MarginBorder;
33
import org.eclipse.draw2d.Toggle;
33
import org.eclipse.draw2d.Toggle;
34
import org.eclipse.draw2d.geometry.Insets;
34
import org.eclipse.draw2d.geometry.Rectangle;
35
import org.eclipse.draw2d.geometry.Rectangle;
35
36
36
import org.eclipse.gef.AccessibleEditPart;
37
import org.eclipse.gef.AccessibleEditPart;
Lines 201-206 Link Here
201
	}
202
	}
202
}
203
}
203
204
205
/**
206
 * The figure for for a <code>ToolEntryEditPart</code>.
207
 */
208
class ToolEntryToggle
209
    extends Toggle {
210
211
private boolean showHoverFeedback = false;
212
213
ToolEntryToggle(IFigure contents) {
214
    super(contents);
215
    setOpaque(false);
216
    setEnabled(true);
217
    if (isToolbarItem()
218
        && !PaletteStack.PALETTE_TYPE_STACK.equals(getPaletteEntry()
219
            .getParent().getType())) {
220
        setStyle(Clickable.STYLE_BUTTON | Clickable.STYLE_TOGGLE);
221
        setBorder(TOOLBAR_ITEM_BORDER);
222
    }
223
}
224
public boolean containsPoint(int x, int y) {
225
    Rectangle rect = getBounds().getCopy();
226
    if (customLabel.getBorder() == ICON_BORDER) {
227
        rect.width -= PinnablePaletteStackFigure.ARROW_WIDTH;
228
    } else if (customLabel.getBorder() == LIST_BORDER) {
229
        rect.width -= PinnablePaletteStackFigure.ARROW_WIDTH;
230
        rect.x += PinnablePaletteStackFigure.ARROW_WIDTH;    
231
    }
232
    return rect.contains(x, y);
233
}
234
235
public IFigure findMouseEventTargetAt(int x, int y) {
236
    return null;
237
}
238
239
public IFigure getToolTip() {
240
    return createToolTip();
241
}
242
243
public void setEnabled(boolean value) {
244
    super.setEnabled(value);
245
    if (isEnabled()) {
246
        setRolloverEnabled(true);
247
        if (getFlag(STYLE_BUTTON)) {
248
            setBorder(TOOLBAR_ITEM_BORDER);
249
        }
250
        setForegroundColor(null);
251
    } else {
252
        if (getFlag(STYLE_BUTTON)) {
253
            setBorder(null);
254
        }
255
        setRolloverEnabled(false);
256
        setForegroundColor(ColorConstants.gray);
257
    }
258
}
259
260
protected void paintFigure(Graphics graphics) {
261
    super.paintFigure(graphics);
262
263
    if (!isToolbarItem() && isEnabled() && isRolloverEnabled()) {
264
        ButtonModel model = getModel();
265
266
        if (model.isSelected()) {
267
            graphics.setBackgroundColor(PaletteColorUtil.getSelectedColor());
268
            graphics.fillRoundRectangle(getSelectionRectangle(
269
                getLayoutSetting(), customLabel), 3, 3);
270
        } else if (model.isMouseOver() || showHoverFeedback) {
271
            graphics.setBackgroundColor(PaletteColorUtil.getHoverColor());
272
            graphics.fillRoundRectangle(getSelectionRectangle(
273
                getLayoutSetting(), customLabel), 3, 3);
274
        }
275
    }
276
}
277
278
protected void paintBorder(Graphics graphics) {
279
    if (!isToolbarItem() && isEnabled()) {
280
281
        if (getBorder() != null)
282
            getBorder().paint(this, graphics, NO_INSETS);
283
        if (hasFocus()) {
284
            graphics.setForegroundColor(ColorConstants.black);
285
            graphics.setBackgroundColor(ColorConstants.white);
286
287
            Rectangle area = getSelectionRectangle(getLayoutSetting(),
288
                customLabel);
289
            if (isStyle(STYLE_BUTTON))
290
                graphics.drawFocus(area.x, area.y, area.width, area.height);
291
            else
292
                graphics.drawFocus(area.x, area.y, area.width - 1,
293
                    area.height - 1);
294
        }
295
    } else {
296
        super.paintBorder(graphics);
297
    }
298
}
299
300
/**
301
 * Should hover feedback be shown? Allows other palette entities to control when
302
 * the hover feedback should be shown on this tool entry.
303
 * 
304
 * @param showHoverFeedback
305
 *            true if the hover feedback is to be shown; false otherwise.
306
 */
307
public void setShowHoverFeedback(boolean showHoverFeedback) {
308
    this.showHoverFeedback = showHoverFeedback;
309
    repaint();
310
}
311
}
312
204
private static final String ACTIVE_STATE = "active"; //$NON-NLS-1$
313
private static final String ACTIVE_STATE = "active"; //$NON-NLS-1$
205
private DetailedLabelFigure customLabel;
314
private DetailedLabelFigure customLabel;
206
315
Lines 245-332 Link Here
245
354
246
static final Border TOOLBAR_ITEM_BORDER = new ButtonBorder(
355
static final Border TOOLBAR_ITEM_BORDER = new ButtonBorder(
247
    ButtonBorder.SCHEMES.TOOLBAR);
356
    ButtonBorder.SCHEMES.TOOLBAR);
248
static final Border COLUMNS_BORDER = new MarginBorder(2, 0, 1, 0);
249
static final Border LIST_BORDER = new MarginBorder(3, 16, 2, 0);
250
static final Border ICON_BORDER = new MarginBorder(3, 3, 3, 3);
251
357
252
public IFigure createFigure() {
358
// The following are the insets that the bounds of the label figure should be
253
	class InactiveToggleButton extends Toggle {
359
// cropped to paint the blue/orange select and hover feedback rectangles.
254
	
360
static final Insets LIST_HIGHLIGHT_INSETS = new Insets(1, 5, 2, 0);
255
        InactiveToggleButton(IFigure contents) {
361
static final Insets ICON_HIGHLIGHT_INSETS = new Insets(2, 1, 2, 1);
256
			super(contents);
362
257
			setOpaque(false);
363
// The following are the borders that go around the entire tool figure to
258
			setEnabled(true);
364
// provide room to draw the arrow and outline of the palette stack figure if
259
            if (isToolbarItem()
365
// this tool happens to appear as the active tool of a stack.
260
                && !PaletteStack.PALETTE_TYPE_STACK.equals(getPaletteEntry()
366
static final Border LIST_BORDER = new MarginBorder(3,
261
                    .getParent().getType())) {
367
    PinnablePaletteStackFigure.ARROW_WIDTH + 7, 4, 0);
262
                setStyle(Clickable.STYLE_BUTTON | Clickable.STYLE_TOGGLE);
368
static final Border ICON_BORDER = new MarginBorder(4, 4, 3, 
263
                setBorder(TOOLBAR_ITEM_BORDER);
369
   PinnablePaletteStackFigure.ARROW_WIDTH + 4);
264
            } 
265
		}
266
		public IFigure findMouseEventTargetAt(int x, int y) {
267
			return null;
268
		}
269
		public IFigure getToolTip() {
270
			return createToolTip();
271
		}
272
		public void setEnabled(boolean value) {
273
			super.setEnabled(value);
274
			if (isEnabled()) {
275
				setRolloverEnabled(true);
276
				if (getFlag(STYLE_BUTTON)) {
277
				    setBorder(TOOLBAR_ITEM_BORDER);
278
				}
279
				setForegroundColor(null);
280
			} else {
281
                if (getFlag(STYLE_BUTTON)) {
282
                    setBorder(null);
283
                }
284
				setRolloverEnabled(false);
285
				setForegroundColor(ColorConstants.gray);
286
			}
287
		}
288
        protected void paintFigure(Graphics graphics) {
289
            super.paintFigure(graphics);
290
            
291
            if (!isToolbarItem() && isEnabled()) {
292
                ButtonModel model = getModel();
293
                if (isRolloverEnabled() && !model.isMouseOver() && !model.isSelected())
294
                    return;
295
        
296
                if (model.isSelected()) {
297
                    graphics.setBackgroundColor(PaletteColorUtil.getSelectedColor());
298
                } else {
299
                    graphics.setBackgroundColor(PaletteColorUtil.getHoverColor());
300
                }
301
                graphics.fillRoundRectangle(getSelectionRectangle(
302
                    getLayoutSetting(), customLabel), 3, 3);
303
            }
304
        }
305
        protected void paintBorder(Graphics graphics) {
306
            if (!isToolbarItem() && isEnabled()) {
307
370
308
            if (getBorder() != null)
371
public IFigure createFigure() {
309
                getBorder().paint(this, graphics, NO_INSETS);
310
            if (hasFocus()) {
311
                graphics.setForegroundColor(ColorConstants.black);
312
                graphics.setBackgroundColor(ColorConstants.white);
313
314
                Rectangle area = getSelectionRectangle(
315
                    getLayoutSetting(), customLabel);
316
                if (isStyle(STYLE_BUTTON))
317
                    graphics.drawFocus(area.x, area.y, area.width, area.height);
318
                else
319
                    graphics.drawFocus(area.x, area.y, area.width - 1, area.height - 1);
320
            }
321
            } else {
322
                super.paintBorder(graphics);
323
            }
324
        }
325
        
326
	}
327
	
372
	
328
	customLabel = new DetailedLabelFigure();
373
	customLabel = new DetailedLabelFigure();
329
	Clickable button = new InactiveToggleButton(customLabel);
374
	Clickable button = new ToolEntryToggle(customLabel);
330
	button.addActionListener(new ActionListener() {
375
	button.addActionListener(new ActionListener() {
331
		public void actionPerformed(ActionEvent event) {
376
		public void actionPerformed(ActionEvent event) {
332
			getPaletteViewer().setActiveTool(getToolEntry());
377
			getPaletteViewer().setActiveTool(getToolEntry());
Lines 408-414 Link Here
408
	int layoutMode = getLayoutSetting();
453
	int layoutMode = getLayoutSetting();
409
	customLabel.setLayoutMode(layoutMode);
454
	customLabel.setLayoutMode(layoutMode);
410
	if (layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
455
	if (layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
411
		customLabel.setBorder(COLUMNS_BORDER);
456
		customLabel.setBorder(ICON_BORDER);
412
	} else if (layoutMode == PaletteViewerPreferences.LAYOUT_LIST
457
	} else if (layoutMode == PaletteViewerPreferences.LAYOUT_LIST
413
        || layoutMode == PaletteViewerPreferences.LAYOUT_DETAILS) {
458
        || layoutMode == PaletteViewerPreferences.LAYOUT_DETAILS) {
414
        customLabel.setBorder(LIST_BORDER);
459
        customLabel.setBorder(LIST_BORDER);
Lines 478-494 Link Here
478
523
479
static Rectangle getSelectionRectangle(int layoutMode, DetailedLabelFigure labelFigure) {
524
static Rectangle getSelectionRectangle(int layoutMode, DetailedLabelFigure labelFigure) {
480
    Rectangle rect = Rectangle.SINGLETON;
525
    Rectangle rect = Rectangle.SINGLETON;
481
    rect.setBounds(labelFigure.getClientArea());
526
    rect.setBounds(labelFigure.getBounds());
482
    if (layoutMode == PaletteViewerPreferences.LAYOUT_LIST
527
    if (layoutMode == PaletteViewerPreferences.LAYOUT_LIST
483
        || layoutMode == PaletteViewerPreferences.LAYOUT_DETAILS) {
528
        || layoutMode == PaletteViewerPreferences.LAYOUT_DETAILS) {
484
        rect.x -= 5;
529
        
485
        rect.y -= 2;
530
        rect.x += PinnablePaletteStackFigure.ARROW_WIDTH;
486
        rect.width = labelFigure.getPreferredSize().width + 17;
531
        rect.width -= PinnablePaletteStackFigure.ARROW_WIDTH;
487
        rect.height += 4;
532
        int newWidth = labelFigure.getPreferredSize().width + 17;
533
        if (newWidth < rect.width) {
534
            rect.width = newWidth;
535
        }
536
        rect.crop(LIST_HIGHLIGHT_INSETS);
488
    } else {
537
    } else {
489
        rect.expand(2, 2);        
538
        rect.width -= PinnablePaletteStackFigure.ARROW_WIDTH;
539
        rect.crop(ICON_HIGHLIGHT_INSETS);
490
    }
540
    }
491
    rect.intersect(labelFigure.getBounds().getExpanded(-1, -1));
492
    return rect;
541
    return rect;
493
}
542
}
543
494
}
544
}
(-)src/org/eclipse/gef/internal/ui/palette/editparts/TemplateEditPart.java (-1 / +1 lines)
Lines 152-158 Link Here
152
	int layoutMode = getLayoutSetting();
152
	int layoutMode = getLayoutSetting();
153
	fig.setLayoutMode(layoutMode);
153
	fig.setLayoutMode(layoutMode);
154
    if (layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
154
    if (layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
155
        fig.setBorder(ToolEntryEditPart.COLUMNS_BORDER);
155
        fig.setBorder(ToolEntryEditPart.ICON_BORDER);
156
    } else if (layoutMode == PaletteViewerPreferences.LAYOUT_LIST
156
    } else if (layoutMode == PaletteViewerPreferences.LAYOUT_LIST
157
        || layoutMode == PaletteViewerPreferences.LAYOUT_DETAILS) {
157
        || layoutMode == PaletteViewerPreferences.LAYOUT_DETAILS) {
158
        fig.setBorder(ToolEntryEditPart.LIST_BORDER);
158
        fig.setBorder(ToolEntryEditPart.LIST_BORDER);
(-)src/org/eclipse/gef/internal/ui/palette/editparts/PaletteScrollBar.java (-1 / +2 lines)
Lines 52-58 Link Here
52
static {
52
static {
53
	Display display = Display.getCurrent();
53
	Display display = Display.getCurrent();
54
	PaletteData pData = new PaletteData(0xFF, 0xFF00, 0xFF0000);
54
	PaletteData pData = new PaletteData(0xFF, 0xFF00, 0xFF0000);
55
    RGB rgb = display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW).getRGB();
55
    RGB rgb = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW).getRGB();
56
	int fillColor = pData.getPixel(rgb);
56
	int fillColor = pData.getPixel(rgb);
57
	ImageData iData = new ImageData(1, 1, 24, pData);
57
	ImageData iData = new ImageData(1, 1, 24, pData);
58
	iData.setPixel(0, 0, fillColor);
58
	iData.setPixel(0, 0, fillColor);
Lines 127-132 Link Here
127
		}
127
		}
128
	};
128
	};
129
	button.setRolloverEnabled(true);
129
	button.setRolloverEnabled(true);
130
	button.setRequestFocusEnabled(false);
130
	return button;
131
	return button;
131
}
132
}
132
133
(-)src/org/eclipse/gef/internal/ui/palette/PaletteColorUtil.java (-2 / +4 lines)
Lines 34-42 Link Here
34
34
35
public static final Color INFO_FOREGROUND = ColorConstants.tooltipForeground;
35
public static final Color INFO_FOREGROUND = ColorConstants.tooltipForeground;
36
36
37
private static final Color HOVER_COLOR = new Color(null, 254, 237, 205);
37
public static final Color ARROW_HOVER = new Color(null, 229, 229, 219);
38
38
39
private static final Color SELECTED_COLOR = new Color(null, 224, 233, 246);
39
private static final Color HOVER_COLOR = new Color(null, 252, 228, 179);
40
41
private static final Color SELECTED_COLOR = new Color(null, 207, 227, 250);
40
42
41
private static final Color HOVER_COLOR_HICONTRAST = new Color(null, 0, 128, 0);
43
private static final Color HOVER_COLOR_HICONTRAST = new Color(null, 0, 128, 0);
42
44

Return to bug 227541