1 19 20 package org.netbeans.modules.subversion.ui.status; 21 22 import org.netbeans.api.project.*; 23 import org.netbeans.api.project.ui.OpenProjects; 24 import org.netbeans.modules.subversion.ui.actions.*; 25 import org.netbeans.modules.subversion.util.SvnUtils; 26 import org.netbeans.modules.subversion.util.Context; 27 import org.openide.util.NbBundle; 28 import org.openide.util.HelpCtx; 29 import org.openide.util.RequestProcessor; 30 import org.openide.util.actions.SystemAction; 31 32 import javax.swing.*; 33 import java.awt.event.ActionEvent ; 34 35 40 public class ShowAllChangesAction extends AbstractAllAction { 41 42 public ShowAllChangesAction() { 43 } 44 45 public String getName() { 46 return NbBundle.getMessage(ShowAllChangesAction.class, "CTL_MenuItem_ShowAllChanges_Label"); } 48 49 50 public void actionPerformed(ActionEvent e) { 51 RequestProcessor.getDefault().post(new Runnable () { 52 public void run() { 53 async(); 54 } 55 }); 56 } 57 58 private void async() { 59 try { 60 setEnabled(false); 61 SwingUtilities.invokeLater(new Runnable () { 62 public void run() { 63 SvnVersioningTopComponent stc = SvnVersioningTopComponent.getInstance(); 64 stc.setContext(null); 65 stc.open(); 66 } 67 }); 68 69 Project [] projects = OpenProjects.getDefault().getOpenProjects(); 70 71 final Context ctx = SvnUtils.getProjectsContext(projects); 72 final String title; 73 if (projects.length == 1) { 74 Project project = projects[0]; 75 ProjectInformation pinfo = ProjectUtils.getInformation(project); 76 title = pinfo.getDisplayName(); 77 } else { 78 title = NbBundle.getMessage(ShowAllChangesAction.class, "CTL_ShowAllChanges_WindowTitle", Integer.toString(projects.length)); } 80 SwingUtilities.invokeLater(new Runnable () { 81 public void run() { 82 final SvnVersioningTopComponent stc = SvnVersioningTopComponent.getInstance(); 83 stc.setContentTitle(title); 84 stc.setContext(ctx); 85 stc.open(); 86 stc.requestActive(); 87 if (shouldPostRefresh()) { 88 stc.performRefreshAction(); 89 } 90 } 91 }); 92 93 } finally { 94 setEnabled(true); 95 } 96 97 } 98 99 protected boolean shouldPostRefresh() { 100 return true; 101 } 102 } 103 104 | Popular Tags |