1 /******************************************************************************* 2 * Copyright (c) 2011 Google, Inc. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * Google, Inc. - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.wb.internal.core.model.property.editor.presentation; 12 13 import org.eclipse.wb.core.controls.CFlatButton; 14 import org.eclipse.wb.internal.core.model.property.Property; 15 import org.eclipse.wb.internal.core.model.property.table.PropertyTable; 16 17 import org.eclipse.swt.SWT; 18 import org.eclipse.swt.widgets.Control; 19 20 /** 21 * Internal implementation of {@link PropertyEditorPresentation} for displaying special owner-draw 22 * button for Mac OSX. 23 * 24 * @author mitin_aa 25 * @coverage core.model.property.editor 26 */ 27 final class ButtonPropertyEditorPresentationImplMac extends ButtonPropertyEditorPresentationImpl { 28 //////////////////////////////////////////////////////////////////////////// 29 // 30 // Constructor 31 // 32 //////////////////////////////////////////////////////////////////////////// 33 public ButtonPropertyEditorPresentationImplMac(ButtonPropertyEditorPresentation presentation) { 34 super(presentation); 35 } 36 37 //////////////////////////////////////////////////////////////////////////// 38 // 39 // Control 40 // 41 //////////////////////////////////////////////////////////////////////////// 42 @Override 43 protected final Control createControlImpl(final PropertyTable propertyTable, Property property) { 44 CFlatButton button = new CFlatButton(propertyTable, SWT.NONE); 45 button.setImage(getPresentation().getImage()); 46 button.setToolTipText(getPresentation().getTooltip()); 47 return button; 48 } 49 50 @Override 51 public final void setSelection(PropertyTable propertyTable, Property property, boolean selected) { 52 CFlatButton button = (CFlatButton) m_propertyToControl.get(propertyTable, property); 53 if (button != null) { 54 button.setSelected(selected); 55 } 56 } 57 } 58