1 19 20 package org.netbeans.api.diff; 21 22 import java.awt.Component ; 23 import java.beans.PropertyChangeListener ; 24 import java.io.IOException ; 25 import java.io.Reader ; 26 import java.util.Collection ; 27 28 import org.openide.util.Lookup; 29 30 36 public abstract class Diff extends Object { 37 38 41 public static Diff getDefault() { 42 return Lookup.getDefault().lookup(Diff.class); 43 } 44 45 48 public static Collection <? extends Diff> getAll() { 49 return Lookup.getDefault().lookup(new Lookup.Template<Diff>(Diff.class)).allInstances(); 50 } 51 52 65 public abstract Component createDiff(String name1, String title1, 66 Reader r1, String name2, String title2, 67 Reader r2, String MIMEType) throws IOException ; 68 69 81 public DiffView createDiff(StreamSource s1, StreamSource s2) throws IOException { 82 final Component c = createDiff(s1.getName(), s1.getTitle(), s1.createReader(), 83 s2.getName(), s2.getTitle(), s2.createReader(), 84 s1.getMIMEType()); 85 return new DiffView() { 86 87 public Component getComponent() { 88 return c; 89 } 90 91 public int getDifferenceCount() { 92 return 0; 93 } 94 95 public boolean canSetCurrentDifference() { 96 return false; 97 } 98 99 public void setCurrentDifference(int diffNo) throws UnsupportedOperationException { 100 throw new UnsupportedOperationException (); 101 } 102 103 public int getCurrentDifference() throws UnsupportedOperationException { 104 throw new UnsupportedOperationException (); 105 } 106 107 public javax.swing.JToolBar getToolBar() { 108 return null; 109 } 110 111 public void addPropertyChangeListener(PropertyChangeListener l) {} 112 113 public void removePropertyChangeListener(PropertyChangeListener l) {} 114 115 }; 116 } 117 } 118 | Popular Tags |