1 11 package org.eclipse.ltk.internal.ui.refactoring; 12 13 import java.util.List ; 14 15 import org.eclipse.core.runtime.Assert; 16 import org.eclipse.core.runtime.CoreException; 17 18 19 20 import org.eclipse.jface.resource.ImageDescriptor; 21 22 import org.eclipse.ltk.ui.refactoring.IChangePreviewViewer; 23 24 28 public abstract class PreviewNode { 29 30 31 final static int INACTIVE= 0; 32 33 34 final static int PARTLY_ACTIVE= 1; 35 36 37 final static int ACTIVE= 2; 38 39 final static int[][] ACTIVATION_TABLE= new int[][] { 40 41 { INACTIVE, PARTLY_ACTIVE, PARTLY_ACTIVE }, 42 { PARTLY_ACTIVE, PARTLY_ACTIVE, PARTLY_ACTIVE }, 43 { PARTLY_ACTIVE, PARTLY_ACTIVE, ACTIVE} 44 }; 45 46 static final PreviewNode[] EMPTY_CHILDREN= new PreviewNode[0]; 47 48 private PreviewNode fParent; 49 50 57 protected PreviewNode(PreviewNode parent) { 58 fParent= parent; 59 } 60 61 68 void initialize(PreviewNode parent) { 69 Assert.isTrue(fParent == null); 70 fParent= parent; 71 } 72 73 78 PreviewNode getParent() { 79 return fParent; 80 } 81 82 88 public abstract String getText(); 89 90 96 public abstract ImageDescriptor getImageDescriptor(); 97 98 106 abstract ChangePreviewViewerDescriptor getChangePreviewViewerDescriptor() throws CoreException; 107 108 118 abstract void feedInput(IChangePreviewViewer viewer, List categories) throws CoreException; 119 120 126 abstract void setEnabled(boolean enabled); 127 128 134 abstract void setEnabledShallow(boolean enabled); 135 136 145 abstract int getActive(); 146 147 152 abstract PreviewNode[] getChildren(); 153 154 164 abstract boolean hasOneGroupCategory(List categories); 165 166 172 abstract boolean hasDerived(); 173 } 174 | Popular Tags |