1 19 package org.netbeans.api.retouche.source.support; 20 21 import java.util.ArrayList ; 22 import java.util.List ; 23 import javax.swing.event.ChangeEvent ; 24 import javax.swing.event.ChangeListener ; 25 import javax.swing.text.Document ; 26 import javax.swing.text.JTextComponent ; 27 import org.netbeans.api.retouche.source.Phase; 28 import org.netbeans.api.retouche.source.Source.Priority; 29 import org.netbeans.api.retouche.source.SourceTaskFactory; 30 import org.openide.filesystems.FileObject; 31 import org.openide.loaders.DataObject; 32 33 44 public abstract class EditorAwareSourceTaskFactory extends SourceTaskFactory { 45 46 51 protected EditorAwareSourceTaskFactory(Phase phase, Priority priority) { 52 super(phase, priority); 53 OpenedEditors.getDefault().addChangeListener(new ChangeListenerImpl()); 55 } 56 57 58 public List <FileObject> getFileObjects() { 59 List <FileObject> files = new ArrayList <FileObject>(OpenedEditors.getDefault().getVisibleEditorsFiles()); 60 61 return files; 62 } 63 64 private class ChangeListenerImpl implements ChangeListener { 65 public void stateChanged(ChangeEvent e) { 66 fileObjectsChanged(); 67 } 68 } 69 70 } 71 | Popular Tags |