1 19 20 package org.netbeans.modules.diff.builtin.visualizer; 21 22 import java.awt.Color ; 23 import java.awt.Component ; 24 import java.io.Reader ; 25 import java.io.Serializable ; 26 27 import org.openide.NotifyDescriptor; 28 import org.openide.util.NbBundle; 29 30 import org.netbeans.api.diff.Difference; 31 import org.netbeans.spi.diff.DiffVisualizer; 32 import org.openide.DialogDisplayer; 33 34 39 public class GraphicalDiffVisualizer extends DiffVisualizer implements Serializable { 40 41 private Color colorAdded = DiffComponent.COLOR_ADDED; 42 private Color colorMissing = DiffComponent.COLOR_MISSING; 43 private Color colorChanged = DiffComponent.COLOR_CHANGED; 44 45 static final long serialVersionUID =-1135210647457196211L; 46 47 public GraphicalDiffVisualizer() { 48 } 49 50 53 public String getDisplayName() { 54 return NbBundle.getMessage(GraphicalDiffVisualizer.class, "GraphicalDiffVisualizer.displayName"); 55 } 56 57 60 public String getShortDescription() { 61 return NbBundle.getMessage(GraphicalDiffVisualizer.class, "GraphicalDiffVisualizer.shortDescription"); 62 } 63 64 65 74 75 99 100 114 public Component createView(Difference[] diffs, String name1, String title1, Reader r1, 115 String name2, String title2, Reader r2, String MIMEType) { 116 if (diffs.length == 0) { 117 DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(NbBundle.getMessage(GraphicalDiffVisualizer.class, "MSG_NoDifference", name1, name2))); 118 } 119 DiffComponent diff; 120 String componentName = name1; 121 if (name2 != null && name2.length() > 0) componentName = NbBundle.getMessage( 122 GraphicalDiffVisualizer.class, "MSG_TwoFilesDiffTitle", componentName, name2); 123 diff = new DiffComponent(diffs, componentName, MIMEType, 124 name1, name2, title1, title2, r1, r2, 125 new Color [] { colorMissing, colorAdded, colorChanged }); 126 return diff; 127 } 128 129 132 public java.awt.Color getColorAdded() { 133 return colorAdded; 134 } 135 136 139 public void setColorAdded(java.awt.Color colorAdded) { 140 this.colorAdded = colorAdded; 141 } 142 143 146 public java.awt.Color getColorMissing() { 147 return colorMissing; 148 } 149 150 153 public void setColorMissing(java.awt.Color colorMissing) { 154 this.colorMissing = colorMissing; 155 } 156 157 160 public java.awt.Color getColorChanged() { 161 return colorChanged; 162 } 163 164 167 public void setColorChanged(java.awt.Color colorChanged) { 168 this.colorChanged = colorChanged; 169 } 170 171 } 172 | Popular Tags |