1 11 package org.eclipse.pde.internal.ui.editor.feature; 12 13 import org.eclipse.jface.viewers.*; 14 import org.eclipse.pde.internal.core.*; 15 import org.eclipse.swt.widgets.*; 16 import org.eclipse.ui.views.properties.*; 17 18 public class PortabilityChoiceDescriptor extends PropertyDescriptor { 19 private boolean readOnly=false; 20 private Choice [] choices; 21 22 public PortabilityChoiceDescriptor(String name, String displayName, Choice[] choices, boolean readOnly) { 23 super(name, displayName); 24 this.readOnly = readOnly; 25 this.choices = choices; 26 } 27 public CellEditor createPropertyEditor(Composite parent) { 28 if (readOnly) return null; 29 return new PortabilityChoiceCellEditor(parent, choices); 30 } 31 public boolean isCompatibleWith(IPropertyDescriptor anotherProperty) { 32 if (getAlwaysIncompatible()) 33 return false; 34 if (anotherProperty instanceof PortabilityChoiceDescriptor) { 35 PortabilityChoiceDescriptor spd = (PortabilityChoiceDescriptor) anotherProperty; 36 37 if (!spd.getId().equals(getId())) 39 return false; 40 41 if (!spd.getDisplayName().equals(getDisplayName())) 43 return false; 44 45 if (getCategory() == null) { 47 if (spd.getCategory() != null) 48 return false; 49 } else { 50 if (!getCategory().equals(spd.getCategory())) 51 return false; 52 } 53 54 return true; 56 } 57 return false; 58 } 59 } 60 | Popular Tags |