1 19 20 package org.netbeans.modules.changelog; 21 22 import org.openide.util.NbBundle; 23 import org.openide.util.HelpCtx; 24 import org.openide.filesystems.FileObject; 25 import org.openide.nodes.Node; 26 import org.openide.*; 27 28 import javax.swing.*; 29 import java.awt.event.ActionListener ; 30 import java.awt.event.ActionEvent ; 31 32 33 import org.netbeans.modules.vcscore.actions.GeneralCommandAction; 34 import org.netbeans.modules.javacvs.commands.*; 35 import org.netbeans.modules.cvsclient.commands.*; 36 import org.netbeans.modules.cvsclient.NbJavaCvsFileSystem; 37 import org.netbeans.modules.cvsclient.actions.*; 38 39 import org.netbeans.modules.changelog.wizard.*; 40 import org.netbeans.modules.changelog.*; 41 42 46 public class ChangeLogAction extends CallBackCommandAction { 47 48 49 private transient ChangeLogDisplayer displayer = null; 50 private transient ChangeLogProcessor processor = null; 51 52 private transient WizardDescriptor wd; 53 54 55 public ChangeLogAction() { 56 } 57 58 public HelpCtx getHelpCtx() { 59 HelpCtx retValue; 60 61 retValue = super.getHelpCtx(); 62 return retValue; 63 } 64 65 protected String iconResource() { 66 return null; 67 } 68 69 public String getName() { 70 return NbBundle.getMessage(ChangeLogAction.class, "LBL_ChangeLogAction"); } 72 73 74 80 81 private void doChangeLog(NbJavaCvsFileSystem fs, FileObject[] fos) { 82 CvsLog.LogImpl stImpl = (CvsLog.LogImpl)fs.createLog(); 83 stImpl.setNoTags(!processor.isIncludeBranchNames()); 84 stImpl.setUserFilter(processor.getUser()); 85 stImpl.setDateFilter(processor.getDateRange()); 86 stImpl.setRevisionFilter(processor.getRevisionRange()); 87 stImpl.setFileObjects(fos); 88 if (displayer != null) { 89 stImpl.addDisplayerListener(displayer); 90 } 91 stImpl.addDisplayerListener(new ErrorLogPanel(stImpl.getOuterClassInstance(), false)); 92 displayer.setNumberOfCommands(displayer.getNumberOfCommand() + 1); 93 fs.prepareCommand(stImpl.getOuterClassInstance()); 94 stImpl.startCommand(); 95 } 96 97 102 protected void performAction(final Node[] nodes) { 103 String [] names = new String [3]; 104 names[0] = NbBundle.getBundle(ChangeLogAction.class).getString("ChangeLogAction.wizard_firstPanel"); 105 names[1] = NbBundle.getBundle(ChangeLogAction.class).getString("ChangeLogAction.wizard_secondPanel"); 106 names[2] = NbBundle.getBundle(ChangeLogAction.class).getString("ChangeLogAction.wizard_htmlPanel"); 107 WizardDescriptor.Panel[] panels = new WizardDescriptor.Panel[3]; 108 panels[0] = new FilterPanel.Panel(names[0]); 109 panels[1] = new OutputPanel.Panel(names[1]); 110 panels[2] = new HtmlPanel.Panel(names[2]); 111 processor = new ChangeLogProcessor(); 112 wd = new WizardDescriptor(panels, processor); 113 wd.setTitle(NbBundle.getBundle(ChangeLogAction.class).getString("ChangeLogAction.wizard_title")); 114 wd.putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); 115 wd.putProperty("WizardPanel_contentDisplayed", Boolean.TRUE); 116 wd.putProperty("WizardPanel_contentNumbered", Boolean.TRUE); 117 wd.putProperty("WizardPanel_contentData", names); 118 119 132 final java.awt.Dialog dial = TopManager.getDefault().createDialog(wd); 133 final WizardDescriptor desc = wd; 134 SwingUtilities.invokeLater(new Runnable () { 135 public void run() { 136 dial.show(); 137 if (desc.getValue().equals(WizardDescriptor.FINISH_OPTION)) { 138 displayer = new ChangeLogDisplayer(processor); 139 ChangeLogAction.super.performAction(nodes); 140 processor = null; 142 } 143 } 144 }); 145 } 146 147 152 protected boolean enable(Node[] nodes) { 153 boolean retValue; 154 retValue = super.enable(nodes); 155 return true; 156 } 157 158 163 public void finishCallBack() { 164 super.finishCallBack(); 165 } 166 167 172 public void initCallBack(JavaCvsActionSupporter supporter) { 173 174 } 175 176 179 public void performCallBack(NbJavaCvsFileSystem fs, FileObject[] fos) { 180 doChangeLog(fs, fos); 181 } 182 183 } 184 | Popular Tags |