1 19 package org.netbeans.api.java.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.java.source.JavaSource.Phase; 28 import org.netbeans.api.java.source.JavaSource.Priority; 29 import org.netbeans.api.java.source.JavaSourceTaskFactory; 30 import org.openide.filesystems.FileObject; 31 import org.openide.loaders.DataObject; 32 33 38 public abstract class EditorAwareJavaSourceTaskFactory extends JavaSourceTaskFactory { 39 40 45 protected EditorAwareJavaSourceTaskFactory(Phase phase, Priority priority) { 46 super(phase, priority); 47 OpenedEditors.getDefault().addChangeListener(new ChangeListenerImpl()); 49 } 50 51 52 public List <FileObject> getFileObjects() { 53 List <FileObject> files = new ArrayList <FileObject>(OpenedEditors.getDefault().getVisibleEditorsFiles()); 54 55 return files; 56 } 57 58 private class ChangeListenerImpl implements ChangeListener { 59 public void stateChanged(ChangeEvent e) { 60 fileObjectsChanged(); 61 } 62 } 63 64 } 65 | Popular Tags |