1 19 20 package org.netbeans.modules.tasklist.docscan; 21 22 import javax.swing.*; 23 24 import org.openide.util.actions.CallableSystemAction; 25 import org.openide.util.*; 26 import org.netbeans.modules.tasklist.client.SuggestionManager; 27 import org.netbeans.modules.tasklist.suggestions.SuggestionManagerImpl; 28 import org.netbeans.modules.tasklist.suggestions.SuggestionsScanner; 29 import org.netbeans.modules.tasklist.suggestions.SuggestionsBroker; 30 import org.netbeans.modules.tasklist.core.TaskListView; 31 import org.netbeans.modules.tasklist.core.Background; 32 33 38 public final class SourceTasksAction extends CallableSystemAction { 39 40 private static final long serialVersionUID = 1; 41 42 protected boolean asynchronous() { 43 return false; 44 } 45 46 public void performAction() { 47 48 SuggestionManagerImpl manager = (SuggestionManagerImpl) 49 SuggestionManager.getDefault(); 50 51 if (false == manager.isEnabled(SourceTaskProvider.TYPE)) { 52 manager.setEnabled(SourceTaskProvider.TYPE, true, true); 53 } 54 55 TaskListView tlview = TaskListView.getTaskListView(SourceTasksView.CATEGORY); 56 if (tlview != null) { 57 tlview.showInMode(); 58 } else { 59 if (openByDefaultAll()) { 60 final SourceTasksList list = new SourceTasksList(); 61 final SourceTasksView view = new SourceTasksView(list); 62 63 view.showInMode(); 64 RepaintManager.currentManager(view).paintDirtyRegions(); 65 Background back = SourceTasksScanner.scanTasksAsync(view); view.setBackground(back); 67 } else { 68 TaskListView tlv = new SourceTasksView(SuggestionsBroker.getDefault().startBroker(new SourceTasksProviderAcceptor())); 69 tlv.showInMode(); 70 } 71 } 72 } 73 74 75 private boolean openByDefaultAll() { 76 return false; 77 } 78 79 80 public String getName() { 81 return NbBundle.getMessage(SourceTasksAction.class, "BK0001"); 82 } 83 84 public HelpCtx getHelpCtx() { 85 return new HelpCtx(SourceTasksAction.class); 86 } 87 88 protected String iconResource() { 89 return "org/netbeans/modules/tasklist/docscan/todosAction.gif"; } 91 92 public static interface ScanProgressMonitor extends SuggestionsScanner.ScanProgress { 93 94 99 void statistics(int todos); 100 } 101 102 103 } 104 | Popular Tags |