This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 126495
Collapse All | Expand All

(-)408a38b29403 (+71 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
42
package org.netbeans.modules.mercurial.ui.actions;
43
44
import org.netbeans.modules.mercurial.Mercurial;
45
import javax.swing.AbstractAction;
46
import org.openide.LifecycleManager;
47
import java.awt.event.ActionEvent;
48
49
/**
50
 * Base for all context-sensitive Mercurial actions.
51
 * 
52
 * @author Padraig O'Briain
53
 */
54
public abstract class ContextAction extends AbstractAction {
55
56
    /**
57
     * Synchronizes memory modificatios with disk and calls
58
     * {@link  #performContextAction}.
59
     */
60
    public void actionPerformed(final ActionEvent event) {
61
        // TODO try to save files in invocation context only
62
        // list somehow modified file in the context and save
63
        // just them.
64
        // The same (global save) logic is in CVS, no complaint
65
        LifecycleManager.getDefault().saveAll();        
66
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
67
        performAction(event);
68
    }
69
70
    protected abstract void performAction(ActionEvent event);
71
}
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/add/AddAction.java (-3 / +3 lines)
Lines 51-56 import javax.swing.*; Link Here
51
import javax.swing.*;
51
import javax.swing.*;
52
import java.awt.event.ActionEvent;
52
import java.awt.event.ActionEvent;
53
import org.netbeans.modules.mercurial.util.HgCommand;
53
import org.netbeans.modules.mercurial.util.HgCommand;
54
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
54
import org.openide.DialogDisplayer;
55
import org.openide.DialogDisplayer;
55
import org.openide.NotifyDescriptor;
56
import org.openide.NotifyDescriptor;
56
57
Lines 60-66 import org.openide.NotifyDescriptor; Link Here
60
 * 
61
 * 
61
 * @author John Rice
62
 * @author John Rice
62
 */
63
 */
63
public class AddAction extends AbstractAction {
64
public class AddAction extends ContextAction {
64
    
65
    
65
    private final VCSContext context;
66
    private final VCSContext context;
66
67
Lines 78-85 public class AddAction extends AbstractA Link Here
78
        return false;
79
        return false;
79
    } 
80
    } 
80
    
81
    
81
    public void actionPerformed(ActionEvent ev) {     
82
    public void performAction(ActionEvent ev) {     
82
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
83
        Mercurial hg = Mercurial.getInstance();
83
        Mercurial hg = Mercurial.getInstance();
84
        File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
84
        File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
85
        if (files == null || files.length == 0) return;
85
        if (files == null || files.length == 0) return;
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/annotate/AnnotateAction.java (-3 / +3 lines)
Lines 57-62 import org.netbeans.modules.mercurial.Fi Link Here
57
import org.netbeans.modules.mercurial.FileStatusCache;
57
import org.netbeans.modules.mercurial.FileStatusCache;
58
import org.netbeans.modules.mercurial.FileInformation;
58
import org.netbeans.modules.mercurial.FileInformation;
59
import org.netbeans.modules.mercurial.util.HgUtils;
59
import org.netbeans.modules.mercurial.util.HgUtils;
60
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
60
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.loaders.DataObject;
63
import org.openide.loaders.DataObject;
Lines 75-81 import org.openide.NotifyDescriptor; Link Here
75
 * 
76
 * 
76
 * @author John Rice
77
 * @author John Rice
77
 */
78
 */
78
public class AnnotateAction extends AbstractAction {
79
public class AnnotateAction extends ContextAction {
79
    
80
    
80
    private final VCSContext context;
81
    private final VCSContext context;
81
    
82
    
Lines 104-111 public class AnnotateAction extends Abst Link Here
104
        } 
105
        } 
105
    } 
106
    } 
106
107
107
    public void actionPerformed(ActionEvent e) {
108
    public void performAction(ActionEvent e) {
108
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
109
        Node [] nodes = context.getElements().lookupAll(Node.class).toArray(new Node[0]);
109
        Node [] nodes = context.getElements().lookupAll(Node.class).toArray(new Node[0]);
110
        if (visible(nodes)) {
110
        if (visible(nodes)) {
111
            JEditorPane pane = activatedEditorPane(nodes);
111
            JEditorPane pane = activatedEditorPane(nodes);
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java (-3 / +3 lines)
Lines 58-63 import org.netbeans.modules.mercurial.ut Link Here
58
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
58
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
59
import org.netbeans.modules.mercurial.util.HgProjectUtils;
59
import org.netbeans.modules.mercurial.util.HgProjectUtils;
60
import org.netbeans.modules.mercurial.ui.clone.Clone;
60
import org.netbeans.modules.mercurial.ui.clone.Clone;
61
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.FileUtil;
63
import org.openide.DialogDisplayer;
64
import org.openide.DialogDisplayer;
Lines 72-78 import org.openide.util.Utilities; Link Here
72
 * 
73
 * 
73
 * @author John Rice
74
 * @author John Rice
74
 */
75
 */
75
public class CloneAction extends AbstractAction {
76
public class CloneAction extends ContextAction {
76
    private final VCSContext context;
77
    private final VCSContext context;
77
78
78
    public CloneAction(String name, VCSContext context) {
79
    public CloneAction(String name, VCSContext context) {
Lines 80-87 public class CloneAction extends Abstrac Link Here
80
        putValue(Action.NAME, name);
81
        putValue(Action.NAME, name);
81
    }
82
    }
82
    
83
    
83
    public void actionPerformed(ActionEvent ev){
84
    public void performAction(ActionEvent ev){
84
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
85
        if(!HgRepositoryContextCache.hasHistory(context)){
85
        if(!HgRepositoryContextCache.hasHistory(context)){
86
            HgUtils.outputMercurialTabInRed(
86
            HgUtils.outputMercurialTabInRed(
87
                    NbBundle.getMessage(CloneAction.class,
87
                    NbBundle.getMessage(CloneAction.class,
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneExternalAction.java (-3 / +3 lines)
Lines 51-56 import org.netbeans.modules.mercurial.ut Link Here
51
import org.netbeans.modules.mercurial.util.HgCommand;
51
import org.netbeans.modules.mercurial.util.HgCommand;
52
import org.netbeans.modules.mercurial.util.HgUtils;
52
import org.netbeans.modules.mercurial.util.HgUtils;
53
import org.netbeans.modules.mercurial.util.HgProjectUtils;
53
import org.netbeans.modules.mercurial.util.HgProjectUtils;
54
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
54
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.FileUtil;
56
import org.openide.DialogDisplayer;
57
import org.openide.DialogDisplayer;
Lines 65-71 import org.netbeans.modules.mercurial.ui Link Here
65
 * 
66
 * 
66
 * @author Padraig O'Briain
67
 * @author Padraig O'Briain
67
 */
68
 */
68
public class CloneExternalAction extends AbstractAction {
69
public class CloneExternalAction extends ContextAction {
69
    private final VCSContext context;
70
    private final VCSContext context;
70
71
71
    public CloneExternalAction(String name, VCSContext context) {
72
    public CloneExternalAction(String name, VCSContext context) {
Lines 73-80 public class CloneExternalAction extends Link Here
73
        putValue(Action.NAME, name);
74
        putValue(Action.NAME, name);
74
    }
75
    }
75
    
76
    
76
    public void actionPerformed(ActionEvent ev){
77
    public void performAction(ActionEvent ev){
77
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
78
        CloneWizardAction wiz = CloneWizardAction.getInstance();
78
        CloneWizardAction wiz = CloneWizardAction.getInstance();
79
        wiz.performAction();
79
        wiz.performAction();
80
    }
80
    }
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/commit/CommitAction.java (-3 / +3 lines)
Lines 50-55 import org.netbeans.modules.mercurial.Fi Link Here
50
import org.netbeans.modules.mercurial.FileInformation;
50
import org.netbeans.modules.mercurial.FileInformation;
51
import org.netbeans.modules.mercurial.HgFileNode;
51
import org.netbeans.modules.mercurial.HgFileNode;
52
import org.netbeans.modules.mercurial.HgModuleConfig;
52
import org.netbeans.modules.mercurial.HgModuleConfig;
53
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
53
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgProjectUtils;
56
import org.netbeans.modules.mercurial.util.HgProjectUtils;
Lines 85-91 import org.openide.NotifyDescriptor; Link Here
85
 * 
86
 * 
86
 * @author John Rice
87
 * @author John Rice
87
 */
88
 */
88
public class CommitAction extends AbstractAction {
89
public class CommitAction extends ContextAction {
89
    
90
    
90
    static final String RECENT_COMMIT_MESSAGES = "recentCommitMessage"; // NOI18N
91
    static final String RECENT_COMMIT_MESSAGES = "recentCommitMessage"; // NOI18N
91
92
Lines 101-108 public class CommitAction extends Abstra Link Here
101
        return cache.containsFileOfStatus(context, FileInformation.STATUS_LOCAL_CHANGE);
102
        return cache.containsFileOfStatus(context, FileInformation.STATUS_LOCAL_CHANGE);
102
    }
103
    }
103
104
104
    public void actionPerformed(ActionEvent e) {
105
    public void performAction(ActionEvent e) {
105
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
106
        final File root = HgUtils.getRootFile(context);
106
        final File root = HgUtils.getRootFile(context);
107
        if (root == null) {
107
        if (root == null) {
108
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(CommitAction.class,"MSG_COMMIT_TITLE")); // NOI18N
108
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(CommitAction.class,"MSG_COMMIT_TITLE")); // NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/commit/ExcludeFromCommitAction.java (-2 / +3 lines)
Lines 53-58 import org.netbeans.modules.mercurial.Hg Link Here
53
import org.netbeans.modules.mercurial.HgModuleConfig;
53
import org.netbeans.modules.mercurial.HgModuleConfig;
54
import org.netbeans.modules.mercurial.HgProgressSupport;
54
import org.netbeans.modules.mercurial.HgProgressSupport;
55
import org.netbeans.modules.mercurial.Mercurial;
55
import org.netbeans.modules.mercurial.Mercurial;
56
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
56
import org.openide.util.RequestProcessor;
57
import org.openide.util.RequestProcessor;
57
import org.netbeans.modules.versioning.spi.VCSContext;
58
import org.netbeans.modules.versioning.spi.VCSContext;
58
import org.openide.nodes.*;
59
import org.openide.nodes.*;
Lines 61-67 import org.openide.nodes.*; Link Here
61
 *
62
 *
62
 * @author Petr Kuzel
63
 * @author Petr Kuzel
63
 */
64
 */
64
public final class ExcludeFromCommitAction extends AbstractAction {
65
public final class ExcludeFromCommitAction extends ContextAction {
65
66
66
    public static final int UNDEFINED = -1;
67
    public static final int UNDEFINED = -1;
67
    public static final int EXCLUDING = 1;
68
    public static final int EXCLUDING = 1;
Lines 120-126 public final class ExcludeFromCommitActi Link Here
120
        return status;
121
        return status;
121
    }
122
    }
122
123
123
    public void actionPerformed(ActionEvent e) {
124
    public void performAction(ActionEvent e) {
124
        final VCSContext ctx = context;
125
        final VCSContext ctx = context;
125
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor();
126
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor();
126
        HgProgressSupport support = new HgProgressSupport() {
127
        HgProgressSupport support = new HgProgressSupport() {
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/create/CreateAction.java (-4 / +3 lines)
Lines 59-65 import org.netbeans.modules.mercurial.Hg Link Here
59
import org.netbeans.modules.mercurial.HgProgressSupport;
59
import org.netbeans.modules.mercurial.HgProgressSupport;
60
import org.netbeans.modules.mercurial.util.HgCommand;
60
import org.netbeans.modules.mercurial.util.HgCommand;
61
import org.netbeans.modules.mercurial.util.HgProjectUtils;
61
import org.netbeans.modules.mercurial.util.HgProjectUtils;
62
import org.netbeans.modules.mercurial.util.HgUtils;
62
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
63
import org.openide.util.RequestProcessor;
63
import org.openide.util.RequestProcessor;
64
import org.openide.DialogDisplayer;
64
import org.openide.DialogDisplayer;
65
import org.openide.NotifyDescriptor;
65
import org.openide.NotifyDescriptor;
Lines 74-80 import org.openide.filesystems.FileObjec Link Here
74
 * 
74
 * 
75
 * @author John Rice
75
 * @author John Rice
76
 */
76
 */
77
public class CreateAction extends AbstractAction {
77
public class CreateAction extends ContextAction {
78
    
78
    
79
    private final VCSContext context;
79
    private final VCSContext context;
80
    Map<File, FileInformation> repositoryFiles = new HashMap<File, FileInformation>();
80
    Map<File, FileInformation> repositoryFiles = new HashMap<File, FileInformation>();
Lines 127-135 public class CreateAction extends Abstra Link Here
127
        return f1;
127
        return f1;
128
    }
128
    }
129
129
130
    public void actionPerformed(ActionEvent e) {
130
    public void performAction(ActionEvent e) {
131
        final Mercurial hg = Mercurial.getInstance();
131
        final Mercurial hg = Mercurial.getInstance();
132
        if(!hg.isGoodVersionAndNotify()) return;
133
132
134
        File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
133
        File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
135
        if(files == null || files.length == 0) return;
134
        if(files == null || files.length == 0) return;
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/DiffAction.java (-3 / +3 lines)
Lines 51-56 import org.netbeans.modules.mercurial.Fi Link Here
51
import org.netbeans.modules.mercurial.FileStatusCache;
51
import org.netbeans.modules.mercurial.FileStatusCache;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.util.HgUtils;
53
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
54
import org.openide.nodes.Node;
55
import org.openide.nodes.Node;
55
import org.openide.util.NbBundle;
56
import org.openide.util.NbBundle;
56
57
Lines 60-66 import org.openide.util.NbBundle; Link Here
60
 * 
61
 * 
61
 * @author John Rice
62
 * @author John Rice
62
 */
63
 */
63
public class DiffAction extends AbstractAction {
64
public class DiffAction extends ContextAction {
64
    
65
    
65
    private final VCSContext context;
66
    private final VCSContext context;
66
67
Lines 69-76 public class DiffAction extends Abstract Link Here
69
        putValue(Action.NAME, name);
70
        putValue(Action.NAME, name);
70
    }
71
    }
71
    
72
    
72
    public void actionPerformed(ActionEvent e) {
73
    public void performAction(ActionEvent e) {
73
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
74
        String contextName = Utils.getContextDisplayName(context);
74
        String contextName = Utils.getContextDisplayName(context);
75
                
75
                
76
        File root = HgUtils.getRootFile(context);
76
        File root = HgUtils.getRootFile(context);
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffAction.java (-3 / +3 lines)
Lines 54-59 import org.netbeans.modules.mercurial.ut Link Here
54
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
56
import org.netbeans.modules.mercurial.util.HgCommand;
56
import org.netbeans.modules.mercurial.util.HgCommand;
57
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
57
import org.openide.util.NbBundle;
58
import org.openide.util.NbBundle;
58
import org.openide.util.RequestProcessor;
59
import org.openide.util.RequestProcessor;
59
import org.openide.DialogDisplayer;
60
import org.openide.DialogDisplayer;
Lines 65-71 import org.openide.NotifyDescriptor; Link Here
65
 * 
66
 * 
66
 * @author Padraig O'Briain
67
 * @author Padraig O'Briain
67
 */
68
 */
68
public class ExportDiffAction extends AbstractAction {
69
public class ExportDiffAction extends ContextAction {
69
    
70
    
70
    private final VCSContext context;
71
    private final VCSContext context;
71
72
Lines 74-81 public class ExportDiffAction extends Ab Link Here
74
        putValue(Action.NAME, name);
75
        putValue(Action.NAME, name);
75
    }
76
    }
76
    
77
    
77
    public void actionPerformed(ActionEvent e) {
78
    public void performAction(ActionEvent e) {
78
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
79
        exportDiff(context);
79
        exportDiff(context);
80
    }
80
    }
81
    
81
    
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ImportDiffAction.java (-3 / +3 lines)
Lines 54-59 import org.netbeans.modules.mercurial.ut Link Here
54
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
56
import org.netbeans.modules.mercurial.util.HgCommand;
56
import org.netbeans.modules.mercurial.util.HgCommand;
57
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
57
import org.openide.util.NbBundle;
58
import org.openide.util.NbBundle;
58
import org.openide.util.RequestProcessor;
59
import org.openide.util.RequestProcessor;
59
import org.openide.DialogDisplayer;
60
import org.openide.DialogDisplayer;
Lines 68-74 import org.netbeans.modules.versioning.u Link Here
68
 * 
69
 * 
69
 * @author Padraig O'Briain
70
 * @author Padraig O'Briain
70
 */
71
 */
71
public class ImportDiffAction extends AbstractAction {
72
public class ImportDiffAction extends ContextAction {
72
    
73
    
73
    private final VCSContext context;
74
    private final VCSContext context;
74
75
Lines 77-84 public class ImportDiffAction extends Ab Link Here
77
        putValue(Action.NAME, name);
78
        putValue(Action.NAME, name);
78
    }
79
    }
79
    
80
    
80
    public void actionPerformed(ActionEvent e) {
81
    public void performAction(ActionEvent e) {
81
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
82
        importDiff(context);
82
        importDiff(context);
83
    }
83
    }
84
    
84
    
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/ignore/IgnoreAction.java (-3 / +3 lines)
Lines 44-49 import java.util.*; Link Here
44
import java.util.*;
44
import java.util.*;
45
import java.util.logging.Level;
45
import java.util.logging.Level;
46
import org.netbeans.modules.mercurial.*;
46
import org.netbeans.modules.mercurial.*;
47
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
47
import org.netbeans.modules.mercurial.util.HgUtils;
48
import org.netbeans.modules.mercurial.util.HgUtils;
48
import org.netbeans.modules.mercurial.util.HgProjectUtils;
49
import org.netbeans.modules.mercurial.util.HgProjectUtils;
49
import org.netbeans.modules.versioning.spi.VCSContext;
50
import org.netbeans.modules.versioning.spi.VCSContext;
Lines 62-68 import javax.swing.*; Link Here
62
 *
63
 *
63
 * @author Maros Sandor
64
 * @author Maros Sandor
64
 */
65
 */
65
public class IgnoreAction extends AbstractAction {
66
public class IgnoreAction extends ContextAction {
66
    
67
    
67
    private final VCSContext context;
68
    private final VCSContext context;
68
69
Lines 118-125 public class IgnoreAction extends Abstra Link Here
118
        return getActionStatus(files) != UNDEFINED;
119
        return getActionStatus(files) != UNDEFINED;
119
    }
120
    }
120
121
121
    public void actionPerformed(ActionEvent e) {
122
    public void performAction(ActionEvent e) {
122
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
123
        final File[] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
123
        final File[] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
124
        final int actionStatus = getActionStatus(files);
124
        final int actionStatus = getActionStatus(files);
125
125
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/log/LogAction.java (-3 / +3 lines)
Lines 42-47 package org.netbeans.modules.mercurial.u Link Here
42
42
43
import org.netbeans.modules.mercurial.Mercurial;
43
import org.netbeans.modules.mercurial.Mercurial;
44
import org.netbeans.modules.mercurial.util.HgUtils;
44
import org.netbeans.modules.mercurial.util.HgUtils;
45
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
45
import org.netbeans.modules.versioning.spi.VCSContext;
46
import org.netbeans.modules.versioning.spi.VCSContext;
46
import javax.swing.*;
47
import javax.swing.*;
47
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionEvent;
Lines 53-59 import org.openide.util.NbBundle; Link Here
53
 * 
54
 * 
54
 * @author John Rice
55
 * @author John Rice
55
 */
56
 */
56
public class LogAction extends AbstractAction {
57
public class LogAction extends ContextAction {
57
    
58
    
58
    private final VCSContext context;
59
    private final VCSContext context;
59
    
60
    
Lines 62-69 public class LogAction extends AbstractA Link Here
62
        putValue(Action.NAME, name);
63
        putValue(Action.NAME, name);
63
    }
64
    }
64
    
65
    
65
    public void actionPerformed(ActionEvent e) {
66
    public void performAction(ActionEvent e) {
66
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
67
        SearchHistoryAction.openHistory(context,
67
        SearchHistoryAction.openHistory(context,
68
                NbBundle.getMessage(LogAction.class, "MSG_Log_TabTitle", org.netbeans.modules.versioning.util.Utils.getContextDisplayName(context)));
68
                NbBundle.getMessage(LogAction.class, "MSG_Log_TabTitle", org.netbeans.modules.versioning.util.Utils.getContextDisplayName(context)));
69
    }
69
    }
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/log/OutAction.java (-3 / +3 lines)
Lines 42-47 package org.netbeans.modules.mercurial.u Link Here
42
42
43
import org.netbeans.modules.mercurial.Mercurial;
43
import org.netbeans.modules.mercurial.Mercurial;
44
import org.netbeans.modules.mercurial.util.HgUtils;
44
import org.netbeans.modules.mercurial.util.HgUtils;
45
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
45
import org.netbeans.modules.versioning.spi.VCSContext;
46
import org.netbeans.modules.versioning.spi.VCSContext;
46
import javax.swing.*;
47
import javax.swing.*;
47
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionEvent;
Lines 53-59 import org.openide.util.NbBundle; Link Here
53
 * 
54
 * 
54
 * @author John Rice
55
 * @author John Rice
55
 */
56
 */
56
public class OutAction extends AbstractAction {
57
public class OutAction extends ContextAction {
57
    
58
    
58
    private final VCSContext context;
59
    private final VCSContext context;
59
    
60
    
Lines 62-69 public class OutAction extends AbstractA Link Here
62
        putValue(Action.NAME, name);
63
        putValue(Action.NAME, name);
63
    }
64
    }
64
    
65
    
65
    public void actionPerformed(ActionEvent e) {
66
    public void performAction(ActionEvent e) {
66
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
67
        SearchHistoryAction.openOut(context,
67
        SearchHistoryAction.openOut(context,
68
                NbBundle.getMessage(OutAction.class, "MSG_Out_TabTitle", org.netbeans.modules.versioning.util.Utils.getContextDisplayName(context)));
68
                NbBundle.getMessage(OutAction.class, "MSG_Out_TabTitle", org.netbeans.modules.versioning.util.Utils.getContextDisplayName(context)));
69
    }
69
    }
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/log/SearchHistoryAction.java (-2 / +3 lines)
Lines 49-54 import java.io.File; Link Here
49
import java.io.File;
49
import java.io.File;
50
import java.util.*;
50
import java.util.*;
51
import org.netbeans.modules.mercurial.FileInformation;
51
import org.netbeans.modules.mercurial.FileInformation;
52
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
52
import org.netbeans.modules.versioning.spi.VCSContext;
53
import org.netbeans.modules.versioning.spi.VCSContext;
53
import org.openide.windows.TopComponent;
54
import org.openide.windows.TopComponent;
54
55
Lines 57-63 import org.openide.windows.TopComponent; Link Here
57
 * 
58
 * 
58
 * @author Maros Sandor
59
 * @author Maros Sandor
59
 */
60
 */
60
public class SearchHistoryAction extends AbstractAction {
61
public class SearchHistoryAction extends ContextAction {
61
    private final VCSContext context;
62
    private final VCSContext context;
62
    static final int DIRECTORY_ENABLED_STATUS = FileInformation.STATUS_MANAGED & ~FileInformation.STATUS_NOTVERSIONED_EXCLUDED & ~FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY;
63
    static final int DIRECTORY_ENABLED_STATUS = FileInformation.STATUS_MANAGED & ~FileInformation.STATUS_NOTVERSIONED_EXCLUDED & ~FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY;
63
    static final int FILE_ENABLED_STATUS = FileInformation.STATUS_MANAGED & ~FileInformation.STATUS_NOTVERSIONED_EXCLUDED & ~FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY;
64
    static final int FILE_ENABLED_STATUS = FileInformation.STATUS_MANAGED & ~FileInformation.STATUS_NOTVERSIONED_EXCLUDED & ~FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY;
Lines 83-89 public class SearchHistoryAction extends Link Here
83
        return false;
84
        return false;
84
    }
85
    }
85
86
86
    public void actionPerformed(ActionEvent e) {
87
    public void performAction(ActionEvent e) {
87
        String title = NbBundle.getMessage(SearchHistoryAction.class, "CTL_SearchHistory_Title", Utils.getContextDisplayName(context)); // NOI18N
88
        String title = NbBundle.getMessage(SearchHistoryAction.class, "CTL_SearchHistory_Title", Utils.getContextDisplayName(context)); // NOI18N
88
        openHistory(context, title ); 
89
        openHistory(context, title ); 
89
    }
90
    }
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/merge/MergeAction.java (-3 / +3 lines)
Lines 50-55 import java.util.Set; Link Here
50
import java.util.Set;
50
import java.util.Set;
51
import org.netbeans.modules.mercurial.util.HgCommand;
51
import org.netbeans.modules.mercurial.util.HgCommand;
52
import org.netbeans.modules.mercurial.util.HgUtils;
52
import org.netbeans.modules.mercurial.util.HgUtils;
53
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
53
import org.openide.DialogDisplayer;
54
import org.openide.DialogDisplayer;
54
import org.openide.NotifyDescriptor;
55
import org.openide.NotifyDescriptor;
55
import org.openide.util.NbBundle;
56
import org.openide.util.NbBundle;
Lines 64-70 import org.openide.windows.OutputWriter; Link Here
64
 *
65
 *
65
 * @author John Rice
66
 * @author John Rice
66
 */
67
 */
67
public class MergeAction extends AbstractAction {
68
public class MergeAction extends ContextAction {
68
69
69
    private final VCSContext context;
70
    private final VCSContext context;
70
    private String revStr;
71
    private String revStr;
Lines 82-89 public class MergeAction extends Abstrac Link Here
82
        return true; // #121293: Speed up menu display, warn user if nothing to merge when Merge selected
83
        return true; // #121293: Speed up menu display, warn user if nothing to merge when Merge selected
83
    }
84
    }
84
85
85
    public void actionPerformed(ActionEvent ev) {
86
    public void performAction(ActionEvent ev) {
86
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
87
        final File root = HgUtils.getRootFile(context);
87
        final File root = HgUtils.getRootFile(context);
88
        if (root == null) {
88
        if (root == null) {
89
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE")); // NOI18N
89
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE")); // NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/properties/PropertiesAction.java (-3 / +3 lines)
Lines 42-47 package org.netbeans.modules.mercurial.u Link Here
42
42
43
import org.netbeans.modules.versioning.spi.VCSContext;
43
import org.netbeans.modules.versioning.spi.VCSContext;
44
import org.netbeans.modules.mercurial.util.HgUtils;
44
import org.netbeans.modules.mercurial.util.HgUtils;
45
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
45
46
46
import javax.swing.*;
47
import javax.swing.*;
47
import java.io.File;
48
import java.io.File;
Lines 59-65 import org.openide.util.HelpCtx; Link Here
59
 * 
60
 * 
60
 * @author John Rice
61
 * @author John Rice
61
 */
62
 */
62
public class PropertiesAction extends AbstractAction {
63
public class PropertiesAction extends ContextAction {
63
    
64
    
64
    private final VCSContext context;
65
    private final VCSContext context;
65
66
Lines 68-75 public class PropertiesAction extends Ab Link Here
68
        putValue(Action.NAME, name);
69
        putValue(Action.NAME, name);
69
    }
70
    }
70
    
71
    
71
    public void actionPerformed(ActionEvent e) {
72
    public void performAction(ActionEvent e) {
72
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
73
        File root = HgUtils.getRootFile(context);
73
        File root = HgUtils.getRootFile(context);
74
        if (root == null) {
74
        if (root == null) {
75
            return;
75
            return;
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/FetchAction.java (-3 / +3 lines)
Lines 55-60 import java.awt.event.ActionEvent; Link Here
55
import java.awt.event.ActionEvent;
55
import java.awt.event.ActionEvent;
56
import java.util.List;
56
import java.util.List;
57
import org.netbeans.modules.mercurial.HgProgressSupport;
57
import org.netbeans.modules.mercurial.HgProgressSupport;
58
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
58
import org.netbeans.modules.mercurial.config.HgConfigFiles;
59
import org.netbeans.modules.mercurial.config.HgConfigFiles;
59
import org.openide.util.NbBundle;
60
import org.openide.util.NbBundle;
60
61
Lines 71-77 import org.openide.util.NbBundle; Link Here
71
 * 
72
 * 
72
 * @author John Rice
73
 * @author John Rice
73
 */
74
 */
74
public class FetchAction extends AbstractAction {
75
public class FetchAction extends ContextAction {
75
    
76
    
76
    private final VCSContext context;
77
    private final VCSContext context;
77
78
Lines 80-87 public class FetchAction extends Abstrac Link Here
80
        putValue(Action.NAME, name);
81
        putValue(Action.NAME, name);
81
    }
82
    }
82
    
83
    
83
    public void actionPerformed(ActionEvent e) {
84
    public void performAction(ActionEvent e) {
84
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
85
        final File root = HgUtils.getRootFile(context);
85
        final File root = HgUtils.getRootFile(context);
86
        if (root == null) return;
86
        if (root == null) return;
87
        
87
        
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullAction.java (-3 / +3 lines)
Lines 54-59 import org.netbeans.modules.mercurial.Hg Link Here
54
import org.netbeans.modules.mercurial.HgProgressSupport;
54
import org.netbeans.modules.mercurial.HgProgressSupport;
55
import org.netbeans.modules.mercurial.Mercurial;
55
import org.netbeans.modules.mercurial.Mercurial;
56
import org.netbeans.modules.mercurial.ui.merge.MergeAction;
56
import org.netbeans.modules.mercurial.ui.merge.MergeAction;
57
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
57
import org.netbeans.modules.mercurial.util.HgCommand;
58
import org.netbeans.modules.mercurial.util.HgCommand;
58
import org.netbeans.modules.mercurial.util.HgProjectUtils;
59
import org.netbeans.modules.mercurial.util.HgProjectUtils;
59
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
60
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
Lines 75-81 import org.netbeans.api.project.Project; Link Here
75
 *
76
 *
76
 * @author John Rice
77
 * @author John Rice
77
 */
78
 */
78
public class PullAction extends AbstractAction {
79
public class PullAction extends ContextAction {
79
    private static final String CHANGESET_FILES_PREFIX = "files:"; //NOI18N
80
    private static final String CHANGESET_FILES_PREFIX = "files:"; //NOI18N
80
    
81
    
81
    public enum PullType {
82
    public enum PullType {
Lines 92-99 public class PullAction extends Abstract Link Here
92
        putValue(Action.NAME, name);
93
        putValue(Action.NAME, name);
93
    }
94
    }
94
95
95
    public void actionPerformed(ActionEvent e) {
96
    public void performAction(ActionEvent e) {
96
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
97
        final File root = HgUtils.getRootFile(context);
97
        final File root = HgUtils.getRootFile(context);
98
        if (root == null) {
98
        if (root == null) {
99
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE")); // NOI18N
99
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PullAction.class,"MSG_PULL_TITLE")); // NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullOtherAction.java (-3 / +3 lines)
Lines 52-57 import org.netbeans.modules.mercurial.Hg Link Here
52
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.HgProgressSupport;
53
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.Mercurial;
54
import org.netbeans.modules.mercurial.ui.repository.Repository;
54
import org.netbeans.modules.mercurial.ui.repository.Repository;
55
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
55
import org.netbeans.modules.mercurial.ui.wizards.CloneRepositoryWizardPanel;
56
import org.netbeans.modules.mercurial.ui.wizards.CloneRepositoryWizardPanel;
56
import org.netbeans.modules.mercurial.util.HgProjectUtils;
57
import org.netbeans.modules.mercurial.util.HgProjectUtils;
57
import org.netbeans.modules.mercurial.util.HgUtils;
58
import org.netbeans.modules.mercurial.util.HgUtils;
Lines 65-71 import org.openide.util.HelpCtx; Link Here
65
 * 
66
 * 
66
 * @author John Rice
67
 * @author John Rice
67
 */
68
 */
68
public class PullOtherAction extends AbstractAction implements PropertyChangeListener {
69
public class PullOtherAction extends ContextAction implements PropertyChangeListener {
69
    
70
    
70
    private final VCSContext context;
71
    private final VCSContext context;
71
    private Repository repository = null;
72
    private Repository repository = null;
Lines 77-84 public class PullOtherAction extends Abs Link Here
77
        putValue(Action.NAME, name);
78
        putValue(Action.NAME, name);
78
    }
79
    }
79
80
80
    public void actionPerformed(ActionEvent e) {
81
    public void performAction(ActionEvent e) {
81
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
82
        final File root = HgUtils.getRootFile(context);
82
        final File root = HgUtils.getRootFile(context);
83
        if (root == null) return;
83
        if (root == null) return;
84
84
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushAction.java (-3 / +3 lines)
Lines 53-58 import org.netbeans.modules.mercurial.Me Link Here
53
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.Mercurial;
54
import org.netbeans.modules.mercurial.ui.merge.MergeAction;
54
import org.netbeans.modules.mercurial.ui.merge.MergeAction;
55
import org.netbeans.modules.mercurial.ui.pull.PullAction;
55
import org.netbeans.modules.mercurial.ui.pull.PullAction;
56
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
56
import org.netbeans.modules.mercurial.util.HgCommand;
57
import org.netbeans.modules.mercurial.util.HgCommand;
57
import org.netbeans.modules.mercurial.util.HgProjectUtils;
58
import org.netbeans.modules.mercurial.util.HgProjectUtils;
58
import org.netbeans.modules.mercurial.util.HgUtils;
59
import org.netbeans.modules.mercurial.util.HgUtils;
Lines 73-79 import org.openide.filesystems.FileObjec Link Here
73
 * 
74
 * 
74
 * @author John Rice
75
 * @author John Rice
75
 */
76
 */
76
public class PushAction extends AbstractAction {
77
public class PushAction extends ContextAction {
77
    
78
    
78
    private final VCSContext context;
79
    private final VCSContext context;
79
80
Lines 82-89 public class PushAction extends Abstract Link Here
82
        putValue(Action.NAME, name);
83
        putValue(Action.NAME, name);
83
    }
84
    }
84
    
85
    
85
    public void actionPerformed(ActionEvent e) {
86
    public void performAction(ActionEvent e) {
86
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
87
        final File root = HgUtils.getRootFile(context);
87
        final File root = HgUtils.getRootFile(context);
88
        if (root == null) {
88
        if (root == null) {
89
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE")); // NOI18N
89
            HgUtils.outputMercurialTabInRed( NbBundle.getMessage(PushAction.class,"MSG_PUSH_TITLE")); // NOI18N
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushOtherAction.java (-3 / +3 lines)
Lines 52-57 import org.netbeans.modules.mercurial.Hg Link Here
52
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.HgProgressSupport;
53
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.Mercurial;
54
import org.netbeans.modules.mercurial.ui.repository.Repository;
54
import org.netbeans.modules.mercurial.ui.repository.Repository;
55
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
55
import org.netbeans.modules.mercurial.ui.wizards.CloneRepositoryWizardPanel;
56
import org.netbeans.modules.mercurial.ui.wizards.CloneRepositoryWizardPanel;
56
import org.netbeans.modules.mercurial.util.HgCommand;
57
import org.netbeans.modules.mercurial.util.HgCommand;
57
import org.netbeans.modules.mercurial.util.HgProjectUtils;
58
import org.netbeans.modules.mercurial.util.HgProjectUtils;
Lines 66-72 import org.openide.util.HelpCtx; Link Here
66
 * 
67
 * 
67
 * @author John Rice
68
 * @author John Rice
68
 */
69
 */
69
public class PushOtherAction extends AbstractAction implements PropertyChangeListener {
70
public class PushOtherAction extends ContextAction implements PropertyChangeListener {
70
    
71
    
71
    private final VCSContext context;
72
    private final VCSContext context;
72
    private Repository repository = null;
73
    private Repository repository = null;
Lines 78-85 public class PushOtherAction extends Abs Link Here
78
        putValue(Action.NAME, name);
79
        putValue(Action.NAME, name);
79
    }
80
    }
80
81
81
    public void actionPerformed(ActionEvent e) {
82
    public void performAction(ActionEvent e) {
82
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
83
        final File root = HgUtils.getRootFile(context);
83
        final File root = HgUtils.getRootFile(context);
84
        if (root == null) return;
84
        if (root == null) return;
85
85
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/remove/RemoveAction.java (-2 / +3 lines)
Lines 44-49 import org.netbeans.modules.versioning.s Link Here
44
44
45
import javax.swing.*;
45
import javax.swing.*;
46
import java.awt.event.ActionEvent;
46
import java.awt.event.ActionEvent;
47
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
47
48
48
/**
49
/**
49
 * Remove action for mercurial: 
50
 * Remove action for mercurial: 
Lines 51-57 import java.awt.event.ActionEvent; Link Here
51
 * 
52
 * 
52
 * @author John Rice
53
 * @author John Rice
53
 */
54
 */
54
public class RemoveAction extends AbstractAction {
55
public class RemoveAction extends ContextAction {
55
    
56
    
56
    private final VCSContext context;
57
    private final VCSContext context;
57
58
Lines 60-66 public class RemoveAction extends Abstra Link Here
60
        putValue(Action.NAME, name);
61
        putValue(Action.NAME, name);
61
    }
62
    }
62
    
63
    
63
    public void actionPerformed(ActionEvent e) {
64
    public void performAction(ActionEvent e) {
64
        // TODO: Remove action 
65
        // TODO: Remove action 
65
    }
66
    }
66
    
67
    
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/rollback/RollbackAction.java (-3 / +3 lines)
Lines 55-60 import org.netbeans.modules.mercurial.ut Link Here
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
56
import org.netbeans.modules.mercurial.FileStatusCache;
56
import org.netbeans.modules.mercurial.FileStatusCache;
57
import org.netbeans.modules.mercurial.ui.update.ConflictResolvedAction;
57
import org.netbeans.modules.mercurial.ui.update.ConflictResolvedAction;
58
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
58
import org.openide.util.NbBundle;
59
import org.openide.util.NbBundle;
59
import org.openide.util.RequestProcessor;
60
import org.openide.util.RequestProcessor;
60
import org.openide.DialogDisplayer;
61
import org.openide.DialogDisplayer;
Lines 66-72 import org.openide.NotifyDescriptor; Link Here
66
 * 
67
 * 
67
 * @author John Rice
68
 * @author John Rice
68
 */
69
 */
69
public class RollbackAction extends AbstractAction {
70
public class RollbackAction extends ContextAction {
70
    
71
    
71
    private final VCSContext context;
72
    private final VCSContext context;
72
    private static File pullPath = null;
73
    private static File pullPath = null;
Lines 76-83 public class RollbackAction extends Abst Link Here
76
        putValue(Action.NAME, name);
77
        putValue(Action.NAME, name);
77
    }
78
    }
78
    
79
    
79
    public void actionPerformed(ActionEvent e) {
80
    public void performAction(ActionEvent e) {
80
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
81
        if(!HgRepositoryContextCache.hasHistory(context)){
81
        if(!HgRepositoryContextCache.hasHistory(context)){
82
            HgUtils.outputMercurialTabInRed(
82
            HgUtils.outputMercurialTabInRed(
83
                    NbBundle.getMessage(RollbackAction.class,
83
                    NbBundle.getMessage(RollbackAction.class,
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/serve/ServeAction.java (-2 / +3 lines)
Lines 44-49 import org.netbeans.modules.versioning.s Link Here
44
44
45
import javax.swing.*;
45
import javax.swing.*;
46
import java.awt.event.ActionEvent;
46
import java.awt.event.ActionEvent;
47
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
47
48
48
/**
49
/**
49
 * Serve action for mercurial: 
50
 * Serve action for mercurial: 
Lines 51-57 import java.awt.event.ActionEvent; Link Here
51
 * 
52
 * 
52
 * @author John Rice
53
 * @author John Rice
53
 */
54
 */
54
public class ServeAction extends AbstractAction {
55
public class ServeAction extends ContextAction {
55
    
56
    
56
    private final VCSContext context;
57
    private final VCSContext context;
57
58
Lines 60-66 public class ServeAction extends Abstrac Link Here
60
        putValue(Action.NAME, name);
61
        putValue(Action.NAME, name);
61
    }
62
    }
62
    
63
    
63
    public void actionPerformed(ActionEvent e) {
64
    public void performAction(ActionEvent e) {
64
        // TODO: Serve action - will need a wizard to specify export target
65
        // TODO: Serve action - will need a wizard to specify export target
65
    }
66
    }
66
67
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/status/StatusAction.java (-4 / +3 lines)
Lines 56-61 import org.netbeans.modules.mercurial.ut Link Here
56
import org.netbeans.modules.mercurial.util.HgCommand;
56
import org.netbeans.modules.mercurial.util.HgCommand;
57
import org.netbeans.modules.mercurial.HgProgressSupport;
57
import org.netbeans.modules.mercurial.HgProgressSupport;
58
import org.netbeans.modules.mercurial.util.HgUtils;
58
import org.netbeans.modules.mercurial.util.HgUtils;
59
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
59
60
60
/**
61
/**
61
 * Status action for mercurial: 
62
 * Status action for mercurial: 
Lines 63-69 import org.netbeans.modules.mercurial.ut Link Here
63
 * 
64
 * 
64
 * @author John Rice
65
 * @author John Rice
65
 */
66
 */
66
public class StatusAction extends AbstractAction {
67
public class StatusAction extends ContextAction {
67
    
68
    
68
    private final VCSContext context;
69
    private final VCSContext context;
69
70
Lines 72-80 public class StatusAction extends Abstra Link Here
72
        putValue(Action.NAME, name);
73
        putValue(Action.NAME, name);
73
    }
74
    }
74
    
75
    
75
    public void actionPerformed(ActionEvent ev) {
76
    public void performAction(ActionEvent ev) {
76
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
77
78
        File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
77
        File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
79
        if (files == null || files.length == 0) return;
78
        if (files == null || files.length == 0) return;
80
                
79
                
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/update/ConflictResolvedAction.java (-4 / +3 lines)
Lines 50-59 import org.netbeans.modules.versioning.s Link Here
50
import org.netbeans.modules.versioning.spi.VCSContext;
50
import org.netbeans.modules.versioning.spi.VCSContext;
51
import org.netbeans.modules.mercurial.Mercurial;
51
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.FileInformation;
52
import org.netbeans.modules.mercurial.FileInformation;
53
import javax.swing.AbstractAction;
54
import org.netbeans.modules.mercurial.HgProgressSupport;
53
import org.netbeans.modules.mercurial.HgProgressSupport;
55
import org.netbeans.modules.mercurial.util.HgCommand;
54
import org.netbeans.modules.mercurial.util.HgCommand;
56
import org.netbeans.modules.mercurial.util.HgUtils;
55
import org.netbeans.modules.mercurial.util.HgUtils;
56
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
57
import org.openide.util.RequestProcessor;
57
import org.openide.util.RequestProcessor;
58
import  org.openide.util.NbBundle;
58
import  org.openide.util.NbBundle;
59
59
Lines 62-68 import org.openide.util.NbBundle; Link Here
62
 *
62
 *
63
 * @author Petr Kuzel
63
 * @author Petr Kuzel
64
 */
64
 */
65
public class ConflictResolvedAction extends AbstractAction {
65
public class ConflictResolvedAction extends ContextAction {
66
66
67
    private final VCSContext context;
67
    private final VCSContext context;
68
 
68
 
Lines 71-78 public class ConflictResolvedAction exte Link Here
71
        putValue(Action.NAME, name);
71
        putValue(Action.NAME, name);
72
    }
72
    }
73
73
74
    public void actionPerformed(ActionEvent e) {
74
    public void performAction(ActionEvent e) {
75
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
76
        resolved(context);
75
        resolved(context);
77
    }
76
    }
78
77
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/update/ResolveConflictsAction.java (-4 / +3 lines)
Lines 51-64 import org.openide.DialogDisplayer; Link Here
51
import org.openide.DialogDisplayer;
51
import org.openide.DialogDisplayer;
52
import org.openide.NotifyDescriptor;
52
import org.openide.NotifyDescriptor;
53
import org.netbeans.modules.mercurial.FileInformation;
53
import org.netbeans.modules.mercurial.FileInformation;
54
import javax.swing.AbstractAction;
54
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
55
55
56
/**
56
/**
57
 * Show basic conflict resolver UI (provided by the diff module).
57
 * Show basic conflict resolver UI (provided by the diff module).
58
 *
58
 *
59
 * @author Petr Kuzel
59
 * @author Petr Kuzel
60
 */
60
 */
61
public class ResolveConflictsAction extends AbstractAction {
61
public class ResolveConflictsAction extends ContextAction {
62
62
63
    private final VCSContext context;
63
    private final VCSContext context;
64
 
64
 
Lines 67-74 public class ResolveConflictsAction exte Link Here
67
        putValue(Action.NAME, name);
67
        putValue(Action.NAME, name);
68
    }
68
    }
69
69
70
    public void actionPerformed(ActionEvent e) {
70
    public void performAction(ActionEvent e) {
71
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
72
        resolve(context);
71
        resolve(context);
73
    }
72
    }
74
73
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/update/RevertModificationsAction.java (-4 / +3 lines)
Lines 52-57 import org.netbeans.modules.mercurial.ut Link Here
52
import org.netbeans.modules.mercurial.util.HgUtils;
52
import org.netbeans.modules.mercurial.util.HgUtils;
53
import org.netbeans.modules.mercurial.HgProgressSupport;
53
import org.netbeans.modules.mercurial.HgProgressSupport;
54
import org.netbeans.modules.mercurial.HgException;
54
import org.netbeans.modules.mercurial.HgException;
55
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
55
import org.openide.DialogDisplayer;
56
import org.openide.DialogDisplayer;
56
import org.openide.NotifyDescriptor;
57
import org.openide.NotifyDescriptor;
57
import org.openide.util.RequestProcessor;
58
import org.openide.util.RequestProcessor;
Lines 59-65 import org.netbeans.modules.mercurial.ut Link Here
59
import org.netbeans.modules.mercurial.util.HgCommand;
60
import org.netbeans.modules.mercurial.util.HgCommand;
60
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
62
import javax.swing.AbstractAction;
63
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
63
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
64
64
65
/**
65
/**
Lines 67-73 import org.netbeans.modules.mercurial.ut Link Here
67
 *
67
 *
68
 * @author Padraig O'Briain
68
 * @author Padraig O'Briain
69
 */
69
 */
70
public class RevertModificationsAction extends AbstractAction {
70
public class RevertModificationsAction extends ContextAction {
71
    
71
    
72
    private final VCSContext context;
72
    private final VCSContext context;
73
 
73
 
Lines 76-83 public class RevertModificationsAction e Link Here
76
        putValue(Action.NAME, name);
76
        putValue(Action.NAME, name);
77
    }
77
    }
78
78
79
    public void actionPerformed(ActionEvent e) {
79
    public void performAction(ActionEvent e) {
80
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
81
        if(!HgRepositoryContextCache.hasHistory(context)){
80
        if(!HgRepositoryContextCache.hasHistory(context)){
82
            HgUtils.outputMercurialTabInRed(
81
            HgUtils.outputMercurialTabInRed(
83
                    NbBundle.getMessage(UpdateAction.class,
82
                    NbBundle.getMessage(UpdateAction.class,
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/update/UpdateAction.java (-4 / +3 lines)
Lines 46-51 import org.netbeans.modules.mercurial.Hg Link Here
46
import org.netbeans.modules.mercurial.HgProgressSupport;
46
import org.netbeans.modules.mercurial.HgProgressSupport;
47
import org.netbeans.modules.mercurial.Mercurial;
47
import org.netbeans.modules.mercurial.Mercurial;
48
import org.netbeans.modules.mercurial.util.HgUtils;
48
import org.netbeans.modules.mercurial.util.HgUtils;
49
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
49
import org.netbeans.modules.versioning.spi.VCSContext;
50
import org.netbeans.modules.versioning.spi.VCSContext;
50
import javax.swing.*;
51
import javax.swing.*;
51
import java.awt.event.ActionEvent;
52
import java.awt.event.ActionEvent;
Lines 56-62 import org.openide.util.NbBundle; Link Here
56
import org.openide.util.NbBundle;
57
import org.openide.util.NbBundle;
57
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileUtil;
59
import org.openide.filesystems.FileUtil;
59
import javax.swing.AbstractAction;
60
60
61
/**
61
/**
62
 * Update action for mercurial: 
62
 * Update action for mercurial: 
Lines 64-70 import javax.swing.AbstractAction; Link Here
64
 * 
64
 * 
65
 * @author John Rice
65
 * @author John Rice
66
 */
66
 */
67
public class UpdateAction extends AbstractAction {
67
public class UpdateAction extends ContextAction {
68
    
68
    
69
    private final VCSContext context;
69
    private final VCSContext context;
70
70
Lines 73-80 public class UpdateAction extends Abstra Link Here
73
        putValue(Action.NAME, name);
73
        putValue(Action.NAME, name);
74
    }
74
    }
75
    
75
    
76
    public void actionPerformed(ActionEvent e) {
76
    public void performAction(ActionEvent e) {
77
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
78
        update(context, null);
77
        update(context, null);
79
    }
78
    }
80
    
79
    
(-)a/mercurial/src/org/netbeans/modules/mercurial/ui/view/ViewAction.java (-3 / +3 lines)
Lines 54-59 import javax.swing.*; Link Here
54
import javax.swing.*;
54
import javax.swing.*;
55
import java.awt.event.ActionEvent;
55
import java.awt.event.ActionEvent;
56
import org.netbeans.modules.mercurial.config.HgConfigFiles;
56
import org.netbeans.modules.mercurial.config.HgConfigFiles;
57
import org.netbeans.modules.mercurial.ui.actions.ContextAction;
57
import org.openide.util.NbBundle;
58
import org.openide.util.NbBundle;
58
import org.openide.util.Utilities;
59
import org.openide.util.Utilities;
59
60
Lines 63-69 import org.openide.util.Utilities; Link Here
63
 * 
64
 * 
64
 * @author John Rice
65
 * @author John Rice
65
 */
66
 */
66
public class ViewAction extends AbstractAction {
67
public class ViewAction extends ContextAction {
67
    
68
    
68
    private final VCSContext context;
69
    private final VCSContext context;
69
    private static final String HG_SCRIPTS_DIR = "scripts";
70
    private static final String HG_SCRIPTS_DIR = "scripts";
Lines 73-80 public class ViewAction extends Abstract Link Here
73
        putValue(Action.NAME, name);
74
        putValue(Action.NAME, name);
74
    }
75
    }
75
    
76
    
76
    public void actionPerformed(ActionEvent e) {
77
    public void performAction(ActionEvent e) {
77
        if(!Mercurial.getInstance().isGoodVersionAndNotify()) return;
78
        final File root = HgUtils.getRootFile(context);
78
        final File root = HgUtils.getRootFile(context);
79
        if (root == null) return;
79
        if (root == null) return;
80
        String repository = root.getAbsolutePath();
80
        String repository = root.getAbsolutePath();

Return to bug 126495