1 27 28 package org.nightlabs.editor2d.edit.tree; 29 30 import java.beans.PropertyChangeEvent ; 31 32 import org.eclipse.jface.resource.ImageDescriptor; 33 import org.eclipse.swt.graphics.Image; 34 import org.eclipse.ui.views.properties.IPropertySource; 35 36 import org.nightlabs.base.resource.SharedImages; 37 import org.nightlabs.editor2d.AbstractPaletteFactory; 38 import org.nightlabs.editor2d.EditorPlugin; 39 import org.nightlabs.editor2d.TextDrawComponent; 40 import org.nightlabs.editor2d.model.TextPropertySource; 41 42 public class TextTreeEditPart 43 extends DrawComponentTreeEditPart 44 { 45 public static final Image TEXT_ICON = SharedImages.getSharedImageDescriptor(EditorPlugin.getDefault(), 47 AbstractPaletteFactory.class, "Text").createImage(); 48 49 public TextTreeEditPart(TextDrawComponent drawComponent) { 50 super(drawComponent); 51 } 52 53 protected Image getImage() { 54 return TEXT_ICON; 55 } 56 57 public TextDrawComponent getTextDrawComponent() { 58 return (TextDrawComponent) getModel(); 59 } 60 61 protected void propertyChanged(PropertyChangeEvent evt) 62 { 63 super.propertyChanged(evt); 64 String propertyName = evt.getPropertyName(); 65 if (propertyName.equals(TextDrawComponent.PROP_FONT)) { 66 LOGGER.debug(propertyName +" changed!"); 67 refreshVisuals(); 68 } 69 else if (propertyName.equals(TextDrawComponent.PROP_TEXT)) { 78 LOGGER.debug(propertyName +" changed!"); 79 refreshVisuals(); 80 } 81 } 90 91 94 protected IPropertySource getPropertySource() 95 { 96 if (propertySource == null) 97 { 98 propertySource = 99 new TextPropertySource(getTextDrawComponent()); 100 } 101 return propertySource; 102 } 103 } 104 | Popular Tags |