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

Collapse All | Expand All

(-)src/org/eclipse/gef/internal/ui/palette/editparts/DrawerFigure.java (-1 / +28 lines)
Lines 17-23 Link Here
17
import org.eclipse.swt.widgets.Control;
17
import org.eclipse.swt.widgets.Control;
18
import org.eclipse.swt.widgets.Display;
18
import org.eclipse.swt.widgets.Display;
19
19
20
import org.eclipse.core.runtime.Platform;
21
import org.eclipse.core.runtime.preferences.IPreferencesService;
20
import org.eclipse.jface.resource.ImageDescriptor;
22
import org.eclipse.jface.resource.ImageDescriptor;
23
import org.eclipse.ui.IWorkbenchPreferenceConstants;
21
24
22
import org.eclipse.draw2d.Animation;
25
import org.eclipse.draw2d.Animation;
23
import org.eclipse.draw2d.Border;
26
import org.eclipse.draw2d.Border;
Lines 82-87 Link Here
82
protected static final Border TITLE_MARGIN_BORDER = new MarginBorder(1, 1, 1, 0);
85
protected static final Border TITLE_MARGIN_BORDER = new MarginBorder(1, 1, 1, 0);
83
/** Toggle button border constant**/
86
/** Toggle button border constant**/
84
protected static final Border TOGGLE_BUTTON_BORDER = new RaisedBorder();
87
protected static final Border TOGGLE_BUTTON_BORDER = new RaisedBorder();
88
/** Duration of animation constant **/
89
private final int DEFAULT_DURATION = 150;
85
/** Tooltip border constant **/
90
/** Tooltip border constant **/
86
protected static final Border TOOLTIP_BORDER = new CompoundBorder(
91
protected static final Border TOOLTIP_BORDER = new CompoundBorder(
87
		new SchemeBorder(SchemeBorder.SCHEMES.RAISED),
92
		new SchemeBorder(SchemeBorder.SCHEMES.RAISED),
Lines 104-109 Link Here
104
 * 						header is not completely visible).  It can be <code>null</code>
109
 * 						header is not completely visible).  It can be <code>null</code>
105
 * 						(the tip won't be displayed).
110
 * 						(the tip won't be displayed).
106
 */
111
 */
112
113
107
public DrawerFigure(final Control control) {
114
public DrawerFigure(final Control control) {
108
	/*
115
	/*
109
	 * A PaletteToolbarLayout is being used here instead of a ToolbarLayout so that the
116
	 * A PaletteToolbarLayout is being used here instead of a ToolbarLayout so that the
Lines 161-168 Link Here
161
			if (e.getPropertyName().equals(ButtonModel.SELECTED_PROPERTY)) {
168
			if (e.getPropertyName().equals(ButtonModel.SELECTED_PROPERTY)) {
162
				Animation.markBegin();
169
				Animation.markBegin();
163
				handleExpandStateChanged();
170
				handleExpandStateChanged();
164
				Animation.run(150);
171
				Animation.run(getAnimationDuration());
165
			}
172
			}
173
			
166
		}
174
		}
167
	});
175
	});
168
	/*
176
	/*
Lines 438-441 Link Here
438
	handleExpandStateChanged();
446
	handleExpandStateChanged();
439
}
447
}
440
448
449
/**
450
 * Returns the duration of animation (the value is based on the settings of
451
 * enable animation option from workbench prefernces)
452
 * If animation should be enabled, the duration of
453
 * animation will be equal to DEFAULT_DURATION, otherwise it will be equal to 1;
454
 * 
455
 * @return DEFAULT_DURATION if animaion is enabled, 1 otherwise
456
 * @since 3.2
457
 */
458
private int getAnimationDuration() {
459
	final IPreferencesService service = Platform.getPreferencesService();
460
	if (service.getBoolean("org.eclipse.ui", IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, true, null)) { //$NON-NLS-1$
461
		return DEFAULT_DURATION;
462
	} else {
463
	     return 1;
464
	}
465
}
466
467
441
}
468
}

Return to bug 82736