1 11 package org.eclipse.compare.internal.patch; 12 13 import org.eclipse.compare.ITypedElement; 14 import org.eclipse.compare.patch.PatchConfiguration; 15 import org.eclipse.compare.structuremergeviewer.*; 16 17 public abstract class PatchDiffNode extends DiffNode { 18 19 private Object fElement; 20 21 public PatchDiffNode(Object patchElement, IDiffContainer parent, int kind, 22 ITypedElement ancestor, ITypedElement left, ITypedElement right) { 23 super(parent, kind, ancestor, left, right); 24 fElement = patchElement; 25 } 26 27 public PatchDiffNode(Object patchElement, IDiffContainer parent, int kind) { 28 super(parent, kind); 29 fElement = patchElement; 30 } 31 32 public boolean isEnabled() { 33 return getPatcher().isEnabled(getPatchElement()); 34 } 35 36 public void setEnabled(boolean enabled) { 37 getPatcher().setEnabled(getPatchElement(), enabled); 38 } 39 40 protected final Patcher getPatcher() { 41 return Patcher.getPatcher(getConfiguration()); 42 } 43 44 public Object getPatchElement() { 45 return fElement; 46 } 47 48 protected abstract PatchConfiguration getConfiguration(); 49 50 public boolean equals(Object other) { 51 if (other instanceof PatchDiffNode) { 52 PatchDiffNode node = (PatchDiffNode) other; 53 return (node.getPatchElement().equals(getPatchElement())); 54 } 55 return super.equals(other); 56 } 57 58 public int hashCode() { 59 return getPatchElement().hashCode(); 60 } 61 62 } 63 | Popular Tags |