1 11 package org.eclipse.ltk.internal.ui.refactoring.model; 12 13 import org.eclipse.team.core.diff.IThreeWayDiff; 14 15 import org.eclipse.core.runtime.Assert; 16 import org.eclipse.core.runtime.PlatformObject; 17 18 import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy; 19 20 import org.eclipse.ltk.internal.ui.refactoring.RefactoringPluginImages; 21 import org.eclipse.ltk.internal.ui.refactoring.RefactoringUIMessages; 22 23 import org.eclipse.swt.graphics.Image; 24 25 import org.eclipse.compare.CompareUI; 26 import org.eclipse.compare.ITypedElement; 27 import org.eclipse.compare.structuremergeviewer.ICompareInput; 28 import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener; 29 30 35 public final class RefactoringDescriptorCompareInput extends PlatformObject implements ICompareInput { 36 37 38 private final class RefactoringDescriptorElement implements ITypedElement { 39 40 43 public Image getImage() { 44 return RefactoringDescriptorCompareInput.this.getImage(); 45 } 46 47 50 public String getName() { 51 if (fDescriptor instanceof RefactoringDescriptorSynchronizationProxy) { 52 final RefactoringDescriptorSynchronizationProxy proxy= (RefactoringDescriptorSynchronizationProxy) fDescriptor; 53 if (proxy.getDirection() == IThreeWayDiff.INCOMING) 54 return ModelMessages.RefactoringDescriptorCompareInput_pending_refactoring; 55 else 56 return ModelMessages.RefactoringDescriptorCompareInput_performed_refactoring; 57 } 58 return RefactoringUIMessages.RefactoringWizard_refactoring; 59 } 60 61 64 public String getType() { 65 return TYPE_REFACTORING_DESCRIPTOR; 66 } 67 } 68 69 70 private static boolean fImageRegistered= false; 71 72 73 private static final String TYPE_REFACTORING_DESCRIPTOR= "refactoring_descriptor"; 75 76 private final RefactoringDescriptorProxy fDescriptor; 77 78 79 private final int fKind; 80 81 89 public RefactoringDescriptorCompareInput(final RefactoringDescriptorProxy descriptor, final int kind) { 90 Assert.isNotNull(descriptor); 91 fDescriptor= descriptor; 92 fKind= kind; 93 if (!fImageRegistered) { 94 CompareUI.registerImageDescriptor(TYPE_REFACTORING_DESCRIPTOR, RefactoringPluginImages.DESC_OBJS_REFACTORING); 95 fImageRegistered= true; 96 } 97 } 98 99 102 public void addCompareInputChangeListener(final ICompareInputChangeListener listener) { 103 } 105 106 109 public void copy(final boolean leftToRight) { 110 } 112 113 116 public ITypedElement getAncestor() { 117 return new RefactoringDescriptorElement(); 118 } 119 120 125 public RefactoringDescriptorProxy getDescriptor() { 126 return fDescriptor; 127 } 128 129 132 public Image getImage() { 133 return CompareUI.getImage(TYPE_REFACTORING_DESCRIPTOR); 134 } 135 136 139 public int getKind() { 140 return fKind; 141 } 142 143 146 public ITypedElement getLeft() { 147 return new RefactoringDescriptorElement(); 148 } 149 150 153 public String getName() { 154 return fDescriptor.getDescription(); 155 } 156 157 160 public ITypedElement getRight() { 161 return new RefactoringDescriptorElement(); 162 } 163 164 167 public void removeCompareInputChangeListener(final ICompareInputChangeListener listener) { 168 } 170 } 171 | Popular Tags |