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 105746
Collapse All | Expand All

(-)a/cnd.navigation/src/org/netbeans/modules/cnd/navigation/overrides/OverrideAnnotationAction.java (+8 lines)
Lines 81-86 Link Here
81
    public OverrideAnnotationAction() {
81
    public OverrideAnnotationAction() {
82
        putValue(NAME, NbBundle.getMessage(OverrideAnnotationAction.class,
82
        putValue(NAME, NbBundle.getMessage(OverrideAnnotationAction.class,
83
                                          "CTL_IsOverriddenAnnotationAction")); //NOI18N
83
                                          "CTL_IsOverriddenAnnotationAction")); //NOI18N
84
        putValue("supported-annotation-types", new String[] {
85
            "org-netbeans-modules-editor-annotations-is_overridden",
86
            "org-netbeans-modules-editor-annotations-overrides",
87
            "org-netbeans-modules-cnd-navigation-specializes",
88
            "org-netbeans-modules-cnd-navigation-is_specialized",
89
            "org-netbeans-modules-cnd-navigation-extended_specializes",
90
            "org-netbeans-modules-cnd-navigation-extended_is_specialized"
91
        });
84
        setEnabled(true);
92
        setEnabled(true);
85
    }
93
    }
86
94
(-)a/csl.api/src/org/netbeans/modules/csl/editor/overridden/IsOverriddenAnnotationAction.java (+6 lines)
Lines 89-94 Link Here
89
    public IsOverriddenAnnotationAction() {
89
    public IsOverriddenAnnotationAction() {
90
        putValue(NAME, NbBundle.getMessage(IsOverriddenAnnotationAction.class,
90
        putValue(NAME, NbBundle.getMessage(IsOverriddenAnnotationAction.class,
91
                                          "CTL_IsOverriddenAnnotationAction")); //NOI18N
91
                                          "CTL_IsOverriddenAnnotationAction")); //NOI18N
92
        putValue("supported-annotation-types", new String[] {
93
            "org-netbeans-modules-editor-annotations-is_overridden",
94
            "org-netbeans-modules-editor-annotations-has_implementations",
95
            "org-netbeans-modules-editor-annotations-implements",
96
            "org-netbeans-modules-editor-annotations-overrides"
97
        });
92
        setEnabled(true);
98
        setEnabled(true);
93
    }
99
    }
94
    
100
    
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/ToggleMethodFieldBreakpointAction.java (+18 lines)
Lines 72-83 Link Here
72
 */
72
 */
73
public class ToggleMethodFieldBreakpointAction extends AbstractAction {//implements PropertyChangeListener {
73
public class ToggleMethodFieldBreakpointAction extends AbstractAction {//implements PropertyChangeListener {
74
    
74
    
75
    private static final String[] BREAKPOINT_ANNOTATION_TYPES = new String[] {
76
        "Breakpoint_broken",
77
        "Breakpoint",
78
        "CondBreakpoint_broken",
79
        "CondBreakpoint",
80
        "DisabledBreakpoint",
81
        "DisabledCondBreakpoint",
82
        "ClassBreakpoint",
83
        "DisabledClassBreakpoint",
84
        "DisabledFieldBreakpoint",
85
        "DisabledMethodBreakpoint",
86
        "FieldBreakpoint",
87
        "MethodBreakpoint",
88
    };
89
    
75
    private Object action;
90
    private Object action;
76
    private RequestProcessor postponedToggleRP;
91
    private RequestProcessor postponedToggleRP;
77
92
78
    public ToggleMethodFieldBreakpointAction () {
93
    public ToggleMethodFieldBreakpointAction () {
79
        //EditorContextBridge.addPropertyChangeListener (this);
94
        //EditorContextBridge.addPropertyChangeListener (this);
80
        setEnabled (true);
95
        setEnabled (true);
96
        putValue("default-action", true);
97
        putValue("supported-annotation-types", BREAKPOINT_ANNOTATION_TYPES);
98
        putValue("default-action-excluded-annotation-types", BREAKPOINT_ANNOTATION_TYPES);
81
    }
99
    }
82
    
100
    
83
    public Object getAction () {
101
    public Object getAction () {
(-)a/editor.lib/apichanges.xml (+23 lines)
Lines 107-112 Link Here
107
    <!-- ACTUAL CHANGES BEGIN HERE: -->
107
    <!-- ACTUAL CHANGES BEGIN HERE: -->
108
108
109
    <changes>
109
    <changes>
110
        <change id="clickable-annotations">
111
            <summary>Clickable annotations in the editor glyph gutter</summary>
112
            <version major="3" minor="24"/>
113
            <date day="12" month="5" year="2012"/>
114
            <author login="jlahoda"/>
115
            <compatibility binary="compatible" semantic="incompatible" modification="yes"/>
116
            <description>
117
                <p>
118
                    <code>Editors/.../GlyphGutterActions</code> can now specify on which annotations they need to be invoked. Supported annotation value (set using 
119
                    <code>putValue</code>):
120
                </p>
121
                <dl>
122
                    <dt>default-action</dt>
123
                    <dd>if true, this action will be invoked when the free space is clicked</dd>
124
                    <dt>default-action-excluded-annotation-types</dt>
125
                    <dd>an array containing annotation types. When any of the annotations on the current line has any of these type, this action will not be invoked when the free space is clicked. (See below for combined annotations unrolling.)</dd>
126
                    <dt>supported-annotation-types</dt>
127
                    <dd>an array containing annotation types. When an annotation is clicked, the first action that contains its type in the supported-annotation-types attribute is invoked.</dd>
128
                </dl>
129
            </description>
130
            <issue number="105746"/>
131
        </change>
132
        
110
        <change id="typing-hooks-replace">
133
        <change id="typing-hooks-replace">
111
            <summary>Replace is done before insert and fix inserting empty text</summary>
134
            <summary>Replace is done before insert and fix inserting empty text</summary>
112
            <version major="3" minor="21"/>
135
            <version major="3" minor="21"/>
(-)a/editor.lib/nbproject/project.properties (-1 / +1 lines)
Lines 42-48 Link Here
42
42
43
javac.compilerargs=-Xlint:unchecked
43
javac.compilerargs=-Xlint:unchecked
44
javac.source=1.6
44
javac.source=1.6
45
spec.version.base=3.23.0
45
spec.version.base=3.24.0
46
is.autoload=true
46
is.autoload=true
47
47
48
javadoc.arch=${basedir}/arch.xml
48
javadoc.arch=${basedir}/arch.xml
(-)a/editor.lib/src/org/netbeans/editor/Annotations.java (-1 / +1 lines)
Lines 1333-1339 Link Here
1333
     * annotations which are representd by this combined annotation. The only
1333
     * annotations which are representd by this combined annotation. The only
1334
     * added functionality is for tooltip text and annotation type.
1334
     * added functionality is for tooltip text and annotation type.
1335
     */
1335
     */
1336
    private static final class AnnotationCombination extends AnnotationDesc implements Lookup.Provider {
1336
    static final class AnnotationCombination extends AnnotationDesc implements Lookup.Provider {
1337
        
1337
        
1338
        /** Delegate annotaiton */
1338
        /** Delegate annotaiton */
1339
        private AnnotationDesc delegate;
1339
        private AnnotationDesc delegate;
(-)a/editor.lib/src/org/netbeans/editor/GlyphGutter.java (-18 / +92 lines)
Lines 65-70 Link Here
65
import java.awt.event.*;
65
import java.awt.event.*;
66
import java.awt.font.FontRenderContext;
66
import java.awt.font.FontRenderContext;
67
import java.awt.font.TextLayout;
67
import java.awt.font.TextLayout;
68
import java.util.ArrayList;
69
import java.util.Arrays;
70
import java.util.Collection;
71
import java.util.Collections;
72
import java.util.HashSet;
73
import java.util.LinkedList;
74
import java.util.List;
68
import java.util.Map;
75
import java.util.Map;
69
import java.util.logging.Level;
76
import java.util.logging.Level;
70
import java.util.logging.Logger;
77
import java.util.logging.Logger;
Lines 88-93 Link Here
88
import org.netbeans.api.editor.settings.EditorStyleConstants;
95
import org.netbeans.api.editor.settings.EditorStyleConstants;
89
import org.netbeans.api.editor.settings.FontColorNames;
96
import org.netbeans.api.editor.settings.FontColorNames;
90
import org.netbeans.api.editor.settings.FontColorSettings;
97
import org.netbeans.api.editor.settings.FontColorSettings;
98
import org.netbeans.editor.AnnotationType.CombinationMember;
99
import org.netbeans.editor.Annotations.AnnotationCombination;
91
import org.netbeans.modules.editor.lib.ColoringMap;
100
import org.netbeans.modules.editor.lib.ColoringMap;
92
import org.netbeans.modules.editor.lib2.view.*;
101
import org.netbeans.modules.editor.lib2.view.*;
93
import org.openide.util.ImageUtilities;
102
import org.openide.util.ImageUtilities;
Lines 874-906 Link Here
874
                    annos.activateNextAnnotation(line);
883
                    annos.activateNextAnnotation(line);
875
                } else {
884
                } else {
876
                    Action actions[] = ImplementationProvider.getDefault().getGlyphGutterActions(eui.getComponent());
885
                    Action actions[] = ImplementationProvider.getDefault().getGlyphGutterActions(eui.getComponent());
877
                    if (actions != null && actions.length >0) {
886
                    if (actions == null && actions.length == 0) {
878
                        Action a = actions[0]; //TODO - create GUI chooser
887
                        Toolkit.getDefaultToolkit().beep();
879
                        if (a!=null && a.isEnabled()){
888
                        return;
880
                            int currentLine = -1;
889
                    }
881
                            int line = getLineFromMouseEvent(e);
890
                    int currentLine = -1;
882
                            if (line == -1) return;
891
                    int line = getLineFromMouseEvent(e);
883
                            BaseDocument document = eui.getDocument();
892
                    if (line == -1) {
884
                            try {
893
                        Toolkit.getDefaultToolkit().beep();
885
                                currentLine = Utilities.getLineOffset(document, eui.getComponent().getCaret().getDot());
894
                        return;
886
                            } catch (BadLocationException ex) {
895
                    }
887
                                return;
896
                    Action toInvoke = null;
897
                    Action defaultAction = null;
898
                    AnnotationDesc active = annos.getActiveAnnotation(line);
899
                    if (active == null || !isMouseOverGlyph(e)) {
900
                        Collection<AnnotationDesc> base = new HashSet<AnnotationDesc>();
901
                        if (active != null) {
902
                            base.add(active);
903
                        }
904
                        AnnotationDesc[] passive = annos.getPasiveAnnotations(line);
905
                        if (passive != null) {
906
                            base.addAll(Arrays.asList(passive));
907
                        }
908
                        Collection<String> annotationTypes = computeAnnotationTypesToAnalyze(base);
909
                        for (Action a : actions) {
910
                            Object defAction = a.getValue("default-action");
911
                            if (toInvoke == null && defAction != null && ((Boolean) defAction)) {
912
                                Object supportedAnnotationTypes = a.getValue("default-action-excluded-annotation-types");
913
                                if (supportedAnnotationTypes == null || !(supportedAnnotationTypes instanceof String[]) || Collections.disjoint(Arrays.asList((String[]) supportedAnnotationTypes), annotationTypes)) {
914
                                    toInvoke = a;
915
                                }
888
                            }
916
                            }
889
                            if (line != currentLine) {
917
                            if (defaultAction == null && isLegacyAction(a)) {
890
                                int offset = Utilities.getRowStartFromLineOffset(document, line);
918
                                defaultAction = a;
891
                                JumpList.checkAddEntry();
892
                                eui.getComponent().getCaret().setDot(offset);
893
                            }
919
                            }
894
                            e.consume();
895
                            a.actionPerformed(new ActionEvent(eui.getComponent(), 0, ""));
896
                            repaint();
897
                        }
920
                        }
898
                    } else {
921
                    } else {
922
                        Collection<String> annotationTypes = computeAnnotationTypesToAnalyze(Arrays.asList(active));
923
                        for (Action a : actions) {
924
                            Object supportedAnnotationTypes = a.getValue("supported-annotation-types");
925
                            if (supportedAnnotationTypes instanceof String[]) {
926
                                if (toInvoke == null && !Collections.disjoint(Arrays.asList((String[]) supportedAnnotationTypes), annotationTypes)) {
927
                                    toInvoke = a;
928
                                }
929
                                if (defaultAction == null && isLegacyAction(a)) {
930
                                    defaultAction = a;
931
                                }
932
                            }
933
                        }
934
                    }
935
                    toInvoke = toInvoke != null ? toInvoke : defaultAction;
936
                    if (toInvoke != null && toInvoke.isEnabled()){
937
                        BaseDocument document = eui.getDocument();
938
                        try {
939
                            currentLine = Utilities.getLineOffset(document, eui.getComponent().getCaret().getDot());
940
                        } catch (BadLocationException ex) {
941
                            return;
942
                        }
943
                        if (line != currentLine) {
944
                            int offset = Utilities.getRowStartFromLineOffset(document, line);
945
                            JumpList.checkAddEntry();
946
                            eui.getComponent().getCaret().setDot(offset);
947
                        }
948
                        e.consume();
949
                        toInvoke.actionPerformed(new ActionEvent(eui.getComponent(), 0, ""));
950
                        repaint();
951
                    } else {
899
                        Toolkit.getDefaultToolkit().beep();
952
                        Toolkit.getDefaultToolkit().beep();
900
                    }
953
                    }
901
                }
954
                }
902
            }
955
            }
903
        }
956
        }
957
        
958
        private boolean isLegacyAction(Action a) {
959
            return a.getValue("default-action") == null && a.getValue("supported-annotation-types") == null;
960
        }
961
        
962
        private Collection<String> computeAnnotationTypesToAnalyze(Collection<AnnotationDesc> startAt) {
963
            Collection<String> annotationTypes = new HashSet<String>();
964
            List<AnnotationDesc> combinationsToAnalyze = new LinkedList<AnnotationDesc>(startAt);
965
            
966
            while (!combinationsToAnalyze.isEmpty()) {
967
                AnnotationDesc desc = combinationsToAnalyze.remove(0);
968
                
969
                annotationTypes.add(desc.getAnnotationType());
970
                
971
                if (!(desc instanceof AnnotationCombination)) continue;
972
                
973
                combinationsToAnalyze.addAll(((AnnotationCombination) desc).getCombinedAnnotations());
974
            }
975
            
976
            return annotationTypes;
977
        }
904
978
905
        private void showPopup(MouseEvent e) {
979
        private void showPopup(MouseEvent e) {
906
            final EditorUI eui = editorUI;
980
            final EditorUI eui = editorUI;
(-)a/java.editor/src/org/netbeans/modules/java/editor/overridden/IsOverriddenAnnotationAction.java (+6 lines)
Lines 86-91 Link Here
86
    public IsOverriddenAnnotationAction() {
86
    public IsOverriddenAnnotationAction() {
87
        putValue(NAME, NbBundle.getMessage(IsOverriddenAnnotationAction.class,
87
        putValue(NAME, NbBundle.getMessage(IsOverriddenAnnotationAction.class,
88
                                          "CTL_IsOverriddenAnnotationAction")); //NOI18N
88
                                          "CTL_IsOverriddenAnnotationAction")); //NOI18N
89
        putValue("supported-annotation-types", new String[] {
90
            "org-netbeans-modules-editor-annotations-is_overridden",
91
            "org-netbeans-modules-editor-annotations-has_implementations",
92
            "org-netbeans-modules-editor-annotations-implements",
93
            "org-netbeans-modules-editor-annotations-overrides"
94
        });
89
        setEnabled(true);
95
        setEnabled(true);
90
    }
96
    }
91
    
97
    
(-)a/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/DebuggerAction.java (+12 lines)
Lines 278-286 Link Here
278
        return action;
278
        return action;
279
    }
279
    }
280
    
280
    
281
    private static final String[] BREAKPOINT_ANNOTATION_TYPES = new String[] {
282
        "Breakpoint_broken",
283
        "Breakpoint",
284
        "CondBreakpoint_broken",
285
        "CondBreakpoint",
286
        "DisabledBreakpoint",
287
        "DisabledCondBreakpoint"
288
    };
289
    
281
    public static DebuggerAction createToggleBreakpointAction () {
290
    public static DebuggerAction createToggleBreakpointAction () {
282
        DebuggerAction action = new DebuggerAction(ActionsManager.ACTION_TOGGLE_BREAKPOINT);
291
        DebuggerAction action = new DebuggerAction(ActionsManager.ACTION_TOGGLE_BREAKPOINT);
283
        action.putValue (Action.NAME, "CTL_Toggle_breakpoint");
292
        action.putValue (Action.NAME, "CTL_Toggle_breakpoint");
293
        action.putValue("default-action", true);
294
        action.putValue("supported-annotation-types", BREAKPOINT_ANNOTATION_TYPES);
295
        action.putValue("default-action-excluded-annotation-types", BREAKPOINT_ANNOTATION_TYPES);
284
        return action;
296
        return action;
285
    }
297
    }
286
298
(-)a/spi.editor.hints/src/org/netbeans/modules/editor/hints/FixAction.java (+6 lines)
Lines 61-66 Link Here
61
    
61
    
62
    public FixAction() {
62
    public FixAction() {
63
        putValue(NAME, NbBundle.getMessage(FixAction.class, "NM_FixAction"));
63
        putValue(NAME, NbBundle.getMessage(FixAction.class, "NM_FixAction"));
64
        putValue("supported-annotation-types", new String[] {
65
            "org-netbeans-spi-editor-hints-parser_annotation_err_fixable",
66
            "org-netbeans-spi-editor-hints-parser_annotation_warn_fixable",
67
            "org-netbeans-spi-editor-hints-parser_annotation_verifier_fixable",
68
            "org-netbeans-spi-editor-hints-parser_annotation_hint_fixable"
69
        });
64
    }
70
    }
65
    
71
    
66
    public void actionPerformed(ActionEvent e) {
72
    public void actionPerformed(ActionEvent e) {
(-)a/web.beans/src/org/netbeans/modules/web/beans/navigation/actions/CdiGlyphAction.java (+9 lines)
Lines 74-79 Link Here
74
74
75
    public CdiGlyphAction(){
75
    public CdiGlyphAction(){
76
        putValue(NAME, NbBundle.getMessage(CdiGlyphAction.class, "TXT_GlyphActionName"));  // NOI18N
76
        putValue(NAME, NbBundle.getMessage(CdiGlyphAction.class, "TXT_GlyphActionName"));  // NOI18N
77
        putValue("supported-annotation-types", new String[] {
78
            "org-netbeans-modules-web-beans-annotations-injection-point",
79
            "org-netbeans-modules-web-beans-annotations-delegate-point",
80
            "org-netbeans-modules-web-beans-annotations-decorated-bean",
81
            "org-netbeans-modules-web-beans-annotations-event",
82
            "org-netbeans-modules-web-beans-annotations-observer",
83
            "org-netbeans-modules-editor-annotations-intercepted"
84
        });
85
        
77
    }
86
    }
78
87
79
    /* (non-Javadoc)
88
    /* (non-Javadoc)

Return to bug 105746