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