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 17 import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy; 18 19 import org.eclipse.ltk.internal.ui.refactoring.RefactoringUIMessages; 20 21 import org.eclipse.swt.widgets.Composite; 22 23 import org.eclipse.compare.CompareConfiguration; 24 import org.eclipse.compare.CompareUI; 25 26 31 public final class RefactoringDescriptorCompareViewer extends RefactoringDescriptorViewer { 32 33 34 private final CompareConfiguration fConfiguration; 35 36 46 public RefactoringDescriptorCompareViewer(final Composite parent, final CompareConfiguration configuration, final int style) { 47 super(parent, style); 48 Assert.isNotNull(configuration); 49 fConfiguration= configuration; 50 fBrowser.setData(CompareUI.COMPARE_VIEWER_TITLE, RefactoringUIMessages.RefactoringWizard_refactoring); 51 } 52 53 58 public CompareConfiguration getCompareConfiguration() { 59 return fConfiguration; 60 } 61 62 65 public void setInput(final Object element) { 66 if (element instanceof RefactoringDescriptorCompareInput) { 67 final RefactoringDescriptorCompareInput input= (RefactoringDescriptorCompareInput) element; 68 final RefactoringDescriptorProxy descriptor= input.getDescriptor(); 69 if (descriptor instanceof RefactoringDescriptorSynchronizationProxy) { 70 final RefactoringDescriptorSynchronizationProxy proxy= (RefactoringDescriptorSynchronizationProxy) descriptor; 71 if (proxy.getDirection() == IThreeWayDiff.INCOMING) 72 fBrowser.setData(CompareUI.COMPARE_VIEWER_TITLE, ModelMessages.RefactoringDescriptorCompareInput_pending_refactoring); 73 else 74 fBrowser.setData(CompareUI.COMPARE_VIEWER_TITLE, ModelMessages.RefactoringDescriptorCompareInput_performed_refactoring); 75 } 76 super.setInput(descriptor); 77 } 78 super.setInput(element); 79 } 80 } 81 | Popular Tags |