Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 192948 | Differences between
and this patch

Collapse All | Expand All

(-)a/openide.actions/apichanges.xml (-2 / +16 lines)
 Lines 52-57    Link Here 
52
<changes>
52
<changes>
53
<change>
53
<change>
54
      <api name="actions"/>
54
      <api name="actions"/>
55
      <summary><code>SelectionType ANY in SaveAction</code></summary>
56
      <version major="6" minor="20"/>
57
      <date day="14" month="12" year="2010"/>
58
      <author login="krissco"/>
59
      <compatibility binary="compatible" source="compatible" semantic="compatible" addition="no" deprecation="no" deletion="no" modification="yes"/>
60
      <description>
61
          <code>SaveAction</code> has been modified to allow one or more <code>SaveCookie</code>s
62
          into it's context. The previous behavior was to allow EXACTLY_ONE.
63
      </description>
64
      <class package="org.openide.actions" name="SaveAction"/>
65
      <issue number="192948"/>
66
</change>
67
<change>
68
      <api name="actions"/>
55
      <summary><code>ToolsAction via layers</code></summary>
69
      <summary><code>ToolsAction via layers</code></summary>
56
      <version major="6" minor="15"/>
70
      <version major="6" minor="15"/>
57
      <date day="26" month="2" year="2010"/>
71
      <date day="26" month="2" year="2010"/>
 Lines 91-97    Link Here 
91
 topComponent.getActionMap().put("jumpPrev", new YourPrevAction());
105
 topComponent.getActionMap().put("jumpPrev", new YourPrevAction());
92
 topComponent.getActionMap().put("jumpNext", new YourNextAction());
106
 topComponent.getActionMap().put("jumpNext", new YourNextAction());
93
          </pre>
107
          </pre>
94
          if your component provides items and you want the user to jump 
108
          if your component provides items and you want the user to jump
95
          among them using standard next/prev actions.
109
          among them using standard next/prev actions.
96
        </description>
110
        </description>
97
        <issue number="40185"/>
111
        <issue number="40185"/>
 Lines 107-113    Link Here 
107
        This action was used only as default action on templates. It instantiates the
121
        This action was used only as default action on templates. It instantiates the
108
        template when it was double clicked in the Options dialog. This behaviour
122
        template when it was double clicked in the Options dialog. This behaviour
109
        was changed and action is not useful anymore. It is deprecated and it usage
123
        was changed and action is not useful anymore. It is deprecated and it usage
110
        should be avoided. Part of the deprecatation was that 
124
        should be avoided. Part of the deprecatation was that
111
        org.openide.loadersDataNode.getDefaultAction() does not return this action
125
        org.openide.loadersDataNode.getDefaultAction() does not return this action
112
        on templates anymore.
126
        on templates anymore.
113
     </description>
127
     </description>
(-)a/openide.actions/manifest.mf (-1 / +1 lines)
 Lines 2-6    Link Here 
2
OpenIDE-Module: org.openide.actions
2
OpenIDE-Module: org.openide.actions
3
OpenIDE-Module-Localizing-Bundle: org/openide/actions/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/actions/Bundle.properties
4
AutoUpdate-Essential-Module: true
4
AutoUpdate-Essential-Module: true
5
OpenIDE-Module-Specification-Version: 6.19
5
OpenIDE-Module-Specification-Version: 6.20
6
6
(-)a/openide.actions/src/org/openide/actions/SaveAction.java (-18 / +34 lines)
 Lines 47-52    Link Here 
47
import java.awt.event.ActionEvent;
47
import java.awt.event.ActionEvent;
48
import java.beans.PropertyChangeListener;
48
import java.beans.PropertyChangeListener;
49
import java.io.IOException;
49
import java.io.IOException;
50
import java.util.Collection;
51
import java.util.LinkedList;
50
import java.util.logging.Level;
52
import java.util.logging.Level;
51
import java.util.logging.Logger;
53
import java.util.logging.Logger;
52
import javax.swing.AbstractAction;
54
import javax.swing.AbstractAction;
 Lines 64-74    Link Here 
64
import org.openide.util.UserQuestionException;
66
import org.openide.util.UserQuestionException;
65
import org.openide.util.actions.CookieAction;
67
import org.openide.util.actions.CookieAction;
66
68
67
/** Save a single object.
69
/** Save a one or more objects. Since version 6.20 this handles ANY selection
68
* @see SaveCookie
70
 * instead of EXACTLY_ONE selection.
69
*
71
 * @see SaveCookie
70
* @author   Jan Jancura, Petr Hamernik, Ian Formanek, Dafe Simonek
72
 *
71
*/
73
 * @author   Jan Jancura, Petr Hamernik, Ian Formanek, Dafe Simonek
74
 */
72
public class SaveAction extends CookieAction {
75
public class SaveAction extends CookieAction {
73
    private static Class<? extends Node.Cookie> dataObject;
76
    private static Class<? extends Node.Cookie> dataObject;
74
    private static java.lang.reflect.Method getNodeDelegate;
77
    private static java.lang.reflect.Method getNodeDelegate;
 Lines 87-110    Link Here 
87
    }
90
    }
88
91
89
    final void performAction(Lookup context) {
92
    final void performAction(Lookup context) {
90
        SaveCookie sc = context.lookup(SaveCookie.class);
93
        Collection<? extends SaveCookie> cookieList = context.lookupAll(SaveCookie.class);
91
        if (sc == null) {
94
        Collection<? extends Node> nodeList = new LinkedList<Node>(context.lookupAll(Node.class));
92
            return;
95
96
        COOKIE: for (SaveCookie saveCookie : cookieList) {
97
98
            //Determine if the saveCookie belongs to a node in our context
99
            for (Node node : nodeList) {
100
                if (saveCookie.equals(node.getCookie(SaveCookie.class))) {
101
                    performAction(saveCookie, node);
102
                    nodeList.remove(node);
103
                    continue COOKIE;
104
                }
105
            }
106
107
            //The saveCookie was not found in any node in our context - save it by itself.
108
            performAction(saveCookie, null);
93
        }
109
        }
94
        Node n = context.lookup(Node.class);
95
        performAction(sc, n);
96
    }
110
    }
97
111
112
    protected void performAction(final Node[] activatedNodes) {
113
        for (int i = 0; i < activatedNodes.length; i++) {
114
            Node node = activatedNodes[i];
115
            SaveCookie sc = node.getCookie(SaveCookie.class);
116
            assert sc != null : "SaveCookie must be present on " + node + ". "
117
                    + "See http://www.netbeans.org/issues/show_bug.cgi?id=68285 for details on overriding " + node.getClass().getName() + ".getCookie correctly.";
98
118
99
    protected void performAction(final Node[] activatedNodes) {
119
            // avoid NPE if disabled assertions
100
        SaveCookie sc = activatedNodes[0].getCookie(SaveCookie.class);
120
            if (sc == null) return ;
101
        assert sc != null : "SaveCookie must be present on " + activatedNodes[0] + ". " +
102
                "See http://www.netbeans.org/issues/show_bug.cgi?id=68285 for details on overriding " + activatedNodes[0].getClass().getName() + ".getCookie correctly.";
103
        
104
        // avoid NPE if disabled assertions
105
        if (sc == null) return ;
106
121
107
        performAction(sc, activatedNodes[0]);
122
            performAction(sc, node);
123
        }
108
    }
124
    }
109
125
110
    private void performAction(SaveCookie sc, Node n) {
126
    private void performAction(SaveCookie sc, Node n) {

Return to bug 192948
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo