1 19 20 package org.netbeans.progress.module; 21 22 import javax.swing.AbstractAction ; 23 import javax.swing.SwingUtilities ; 24 import javax.swing.event.ListDataListener ; 25 import org.netbeans.progress.spi.ProgressUIWorkerWithModel; 26 import org.openide.util.NbBundle; 27 28 32 public class ProgressListAction extends AbstractAction implements ListDataListener , Runnable { 33 34 35 public ProgressListAction() { 36 this(NbBundle.getMessage(ProgressListAction.class, "CTL_ProcessListAction")); 37 } 38 39 public ProgressListAction(String name) { 40 putValue(NAME, name); 41 Controller.getDefault().getModel().addListDataListener(this); 43 updateEnabled(); 44 } 45 46 47 public void actionPerformed(java.awt.event.ActionEvent ev) { 48 SwingUtilities.invokeLater(this); 50 } 51 52 public void run() { 53 ((ProgressUIWorkerWithModel)Controller.getDefault().getVisualComponent()).showPopup(); 54 } 55 56 private void updateEnabled() { 57 setEnabled(Controller.getDefault().getModel().getSize() != 0); 58 } 59 60 public void contentsChanged(javax.swing.event.ListDataEvent listDataEvent) { 61 updateEnabled(); 62 } 63 64 public void intervalAdded(javax.swing.event.ListDataEvent listDataEvent) { 65 updateEnabled(); 66 } 67 68 public void intervalRemoved(javax.swing.event.ListDataEvent listDataEvent) { 69 updateEnabled(); 70 } 71 72 73 } 74 | Popular Tags |