diff -r 6552f6e77b1d api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDABreakpointBeanInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDABreakpointBeanInfo.java Thu Mar 20 20:24:18 2008 +0100 @@ -0,0 +1,67 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.api.debugger.jpda; + +import java.beans.BeanDescriptor; +import java.beans.SimpleBeanInfo; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; + +/** + * + * @author Martin Entlicher + */ +class JPDABreakpointBeanInfo extends SimpleBeanInfo { + + public JPDABreakpointBeanInfo() {} + + @Override + public BeanDescriptor getBeanDescriptor() { + try { + return new BeanDescriptor( + JPDABreakpoint.class, + Class.forName("org.netbeans.modules.debugger.jpda.ui.breakpoints.JPDABreakpointCustomizer", true, Lookup.getDefault().lookup(ClassLoader.class))); // NOI18N + } catch (ClassNotFoundException ex) { + Exceptions.printStackTrace(ex); + return null; + } + } + +} diff -r 6552f6e77b1d debugger.jpda.projects/nbproject/project.xml --- a/debugger.jpda.projects/nbproject/project.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/debugger.jpda.projects/nbproject/project.xml Thu Mar 20 20:24:18 2008 +0100 @@ -140,6 +140,15 @@ made subject to such option by the copyr + org.netbeans.spi.debugger.ui + + + + 1 + 2.10 + + + org.netbeans.spi.viewmodel diff -r 6552f6e77b1d debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/BreakpointAnnotationProvider.java --- a/debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/BreakpointAnnotationProvider.java Tue Mar 18 16:40:56 2008 +0100 +++ b/debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/BreakpointAnnotationProvider.java Thu Mar 20 20:24:18 2008 +0100 @@ -292,11 +292,11 @@ public class BreakpointAnnotationProvide } LineCookie lc = dataObject.getCookie(LineCookie.class); if (lc == null) return; - List annotations = new ArrayList(); + List annotations = new ArrayList(); for (int l : lines) { try { Line line = lc.getLineSet().getCurrent(l - 1); - DebuggerAnnotation annotation = new DebuggerAnnotation (annotationType, line); + DebuggerBreakpointAnnotation annotation = new DebuggerBreakpointAnnotation (annotationType, line, b); annotations.add(annotation); } catch (IndexOutOfBoundsException e) { } catch (IllegalArgumentException e) { diff -r 6552f6e77b1d debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/DebuggerBreakpointAnnotation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/DebuggerBreakpointAnnotation.java Thu Mar 20 20:24:18 2008 +0100 @@ -0,0 +1,123 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ + +package org.netbeans.modules.debugger.jpda.projects; + +import org.netbeans.api.debugger.Breakpoint; +import org.netbeans.api.debugger.jpda.JPDABreakpoint; +import org.netbeans.spi.debugger.jpda.EditorContext; +import org.netbeans.spi.debugger.ui.BreakpointAnnotation; + +import org.openide.ErrorManager; +import org.openide.text.Line; +import org.openide.util.NbBundle; + + +/** + * Debugger Breakpoint Annotation class. + * + * @author Jan Jancura + */ +public class DebuggerBreakpointAnnotation extends BreakpointAnnotation { + + private Line line; + private String type; + private JPDABreakpoint breakpoint; + + + DebuggerBreakpointAnnotation (String type, Line line, JPDABreakpoint breakpoint) { + this.type = type; + this.line = line; + this.breakpoint = breakpoint; + attach (line); + } + + public String getAnnotationType () { + return type; + } + + Line getLine () { + return line; + } + + public String getShortDescription () { + if (type.endsWith("_broken")) { + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_BREAKPOINT_BROKEN"); // NOI18N + } + if (type == EditorContext.BREAKPOINT_ANNOTATION_TYPE) + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_BREAKPOINT"); // NOI18N + else + if (type == EditorContext.DISABLED_BREAKPOINT_ANNOTATION_TYPE) + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_DISABLED_BREAKPOINT"); // NOI18N + else + if (type == EditorContext.CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE) + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_CONDITIONAL_BREAKPOINT"); // NOI18N + else + if (type == EditorContext.DISABLED_CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE) + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_DISABLED_CONDITIONAL_BREAKPOINT"); // NOI18N + else + if (type == EditorContext.FIELD_BREAKPOINT_ANNOTATION_TYPE) + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_FIELD_BREAKPOINT"); // NOI18N + if (type == EditorContext.DISABLED_FIELD_BREAKPOINT_ANNOTATION_TYPE) + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_DISABLED_FIELD_BREAKPOINT"); // NOI18N + if (type == EditorContext.METHOD_BREAKPOINT_ANNOTATION_TYPE) + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_METHOD_BREAKPOINT"); // NOI18N + if (type == EditorContext.DISABLED_METHOD_BREAKPOINT_ANNOTATION_TYPE) + return NbBundle.getBundle (DebuggerBreakpointAnnotation.class).getString + ("TOOLTIP_DISABLED_METHOD_BREAKPOINT"); // NOI18N + ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, new IllegalStateException("Unknown breakpoint type '"+type+"'.")); + return null; + } + + @Override + public Breakpoint getBreakpoint() { + return breakpoint; + } + +} diff -r 6552f6e77b1d debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/EditorContextImpl.java --- a/debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/EditorContextImpl.java Tue Mar 18 16:40:56 2008 +0100 +++ b/debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/EditorContextImpl.java Thu Mar 20 20:24:18 2008 +0100 @@ -95,6 +95,7 @@ import javax.lang.model.type.DeclaredTyp import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; +import org.netbeans.api.debugger.jpda.JPDABreakpoint; import org.netbeans.api.debugger.jpda.LineBreakpoint; import org.netbeans.api.java.classpath.ClassPath; @@ -136,6 +137,7 @@ import org.netbeans.spi.debugger.jpda.So import org.netbeans.spi.debugger.jpda.SourcePathProvider; import org.netbeans.spi.java.classpath.support.ClassPathSupport; import org.openide.filesystems.FileUtil; +import org.openide.text.Annotation; import org.openide.util.RequestProcessor; /** @@ -280,11 +282,15 @@ public class EditorContextImpl extends E Line l = LineTranslations.getTranslations().getLine ( url, lineNumber, - timeStamp + (timeStamp instanceof JPDABreakpoint) ? null : timeStamp ); if (l == null) return null; - DebuggerAnnotation annotation = - new DebuggerAnnotation (annotationType, l); + Annotation annotation; + if (timeStamp instanceof JPDABreakpoint) { + annotation = new DebuggerBreakpointAnnotation(annotationType, l, (JPDABreakpoint) timeStamp); + } else { + annotation = new DebuggerAnnotation (annotationType, l); + } annotationToURL.put (annotation, url); return annotation; @@ -346,14 +352,14 @@ public class EditorContextImpl extends E if (a instanceof Collection) { Collection annotations = ((Collection) a); for (Iterator it = annotations.iterator(); it.hasNext(); ) { - removeAnnotation((DebuggerAnnotation) it.next()); + removeAnnotation((Annotation) it.next()); } } else { - removeAnnotation((DebuggerAnnotation) a); - } - } - - private void removeAnnotation(DebuggerAnnotation annotation) { + removeAnnotation((Annotation) a); + } + } + + private void removeAnnotation(Annotation annotation) { annotation.detach (); annotationToURL.remove (annotation); } @@ -382,12 +388,17 @@ public class EditorContextImpl extends E int line = ((Integer) urlLine[1]).intValue(); return LineTranslations.getTranslations().getOriginalLineNumber(url, line, timeStamp); }*/ - DebuggerAnnotation a = (DebuggerAnnotation) annotation; + Line line; + if (annotation instanceof DebuggerBreakpointAnnotation) { + line = ((DebuggerBreakpointAnnotation) annotation).getLine(); + } else { + line = ((DebuggerAnnotation) annotation).getLine(); + } if (timeStamp == null) - return a.getLine ().getLineNumber () + 1; - String url = (String) annotationToURL.get (a); + return line.getLineNumber () + 1; + String url = (String) annotationToURL.get (annotation); Line.Set lineSet = LineTranslations.getTranslations().getLineSet (url, timeStamp); - return lineSet.getOriginalLineNumber (a.getLine ()) + 1; + return lineSet.getOriginalLineNumber (line) + 1; } /** diff -r 6552f6e77b1d debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/resources/mf-layer.xml --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/resources/mf-layer.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/resources/mf-layer.xml Thu Mar 20 20:24:18 2008 +0100 @@ -82,14 +82,6 @@ made subject to such option by the copyr - - - - - - - - @@ -112,8 +104,6 @@ made subject to such option by the copyr - - diff -r 6552f6e77b1d debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/EditorContextBridge.java --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/EditorContextBridge.java Tue Mar 18 16:40:56 2008 +0100 +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/EditorContextBridge.java Thu Mar 20 20:24:18 2008 +0100 @@ -180,7 +180,7 @@ public class EditorContextBridge { url, lineNumber, annotationType, - null + b ); } @@ -265,7 +265,7 @@ public class EditorContextBridge { List annotations = new ArrayList(URLs.length); for (int i = 0; i < URLs.length; i++) { if (lineNumbers[i] >= 1) { - Object annotation = getContext().annotate (URLs[i], lineNumbers[i], annotationType, null); + Object annotation = getContext().annotate (URLs[i], lineNumbers[i], annotationType, b); if (annotation != null) { annotations.add(annotation); } diff -r 6552f6e77b1d debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/BreakpointCustomizeAction.java --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/BreakpointCustomizeAction.java Tue Mar 18 16:40:56 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun - * Microsystems, Inc. All Rights Reserved. - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - */ - -package org.netbeans.modules.debugger.jpda.ui.actions; - -import java.net.MalformedURLException; -import java.net.URL; -import org.netbeans.api.debugger.Breakpoint; -import org.netbeans.api.debugger.DebuggerManager; -import org.netbeans.api.debugger.jpda.JPDABreakpoint; -import org.netbeans.api.debugger.jpda.LineBreakpoint; -import org.netbeans.modules.debugger.jpda.ui.EditorContextBridge; -import org.netbeans.modules.debugger.jpda.ui.models.BreakpointsActionsProvider; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.actions.NodeAction; - -/** - * Customize action for line breakpoint, which is available from the gutter popup. - * - * @author Martin Entlicher - */ -public class BreakpointCustomizeAction extends NodeAction { - - /** Creates a new instance of BreakpointCustomizeAction */ - public BreakpointCustomizeAction() { - } - - static LineBreakpoint getCurrentLineBreakpoint() { - String currentURLStr = EditorContextBridge.getContext().getCurrentURL(); - if (currentURLStr == null) return null; - URL currentURL; - try { - currentURL = new URL(currentURLStr); - } catch (MalformedURLException muex) { - return null; - } - int lineNumber = EditorContextBridge.getContext().getCurrentLineNumber(); - if (lineNumber < 0) return null; - Breakpoint[] bs = DebuggerManager.getDebuggerManager (). - getBreakpoints (); - for (int i = 0; i < bs.length; i++) { - if (bs[i] instanceof LineBreakpoint) { - LineBreakpoint lb = (LineBreakpoint) bs[i]; - URL url; - try { - url = new URL(lb.getURL()); - } catch (MalformedURLException muex) { - continue; - } - if (currentURL.equals(url)) { - if (lineNumber == lb.getLineNumber()) { - return lb; - } - } - } - } - return null; - } - - public boolean isEnabled() { // overriden, because orig impl caches the nodes - return enable(null); - } - - protected boolean enable(org.openide.nodes.Node[] activatedNodes) { - JPDABreakpoint b = getCurrentLineBreakpoint(); - if (b == null) { - try { - b = ToggleMethodFieldBreakpointAction.getCurrentFieldMethodBreakpoint(); - } catch (java.awt.IllegalComponentStateException icsex) {} - } - return b != null; - } - - public String getName() { - return NbBundle.getMessage(BreakpointCustomizeAction.class, "CTL_customize"); - } - - protected void performAction(org.openide.nodes.Node[] activatedNodes) { - JPDABreakpoint b = getCurrentLineBreakpoint(); - if (b == null) { - try { - b = ToggleMethodFieldBreakpointAction.getCurrentFieldMethodBreakpoint(); - } catch (java.awt.IllegalComponentStateException icsex) {} - } - if (b == null) return ; - BreakpointsActionsProvider.customize(b); - } - - protected boolean asynchronous() { - return false; //This action should run in AWT. - } - - public HelpCtx getHelpCtx() { - return null; - } - -} diff -r 6552f6e77b1d debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/BreakpointEnableAction.java --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/BreakpointEnableAction.java Tue Mar 18 16:40:56 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * Contributor(s): - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - */ - -package org.netbeans.modules.debugger.jpda.ui.actions; - -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JMenuItem; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; -import org.openide.util.actions.BooleanStateAction; -import org.openide.util.actions.NodeAction; - -import org.netbeans.api.debugger.jpda.JPDABreakpoint; - - -/** - * Enables or disables breakpoints. - * - * @author Martin Entlicher - */ -public class BreakpointEnableAction extends BooleanStateAction { - - public boolean isEnabled() { - JPDABreakpoint b = BreakpointCustomizeAction.getCurrentLineBreakpoint(); - if (b == null) { - try { - b = ToggleMethodFieldBreakpointAction.getCurrentFieldMethodBreakpoint(); - } catch (java.awt.IllegalComponentStateException icsex) {} - } - if (b != null) { - boolean value = b.isEnabled(); - super.setBooleanState(value); - return true; - } - return false; - } - - public String getName() { - return NbBundle.getMessage(BreakpointEnableAction.class, "CTL_enabled"); - } - - public void setBooleanState(boolean value) { - JPDABreakpoint b = BreakpointCustomizeAction.getCurrentLineBreakpoint(); - if (b == null) { - try { - b = ToggleMethodFieldBreakpointAction.getCurrentFieldMethodBreakpoint(); - } catch (java.awt.IllegalComponentStateException icsex) {} - } - if (value) { - b.enable(); - } else { - b.disable(); - } - super.setBooleanState(value); - } - - public HelpCtx getHelpCtx() { - return null; - } - -} diff -r 6552f6e77b1d debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/Bundle.properties --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/Bundle.properties Tue Mar 18 16:40:56 2008 +0100 +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/Bundle.properties Thu Mar 20 20:24:18 2008 +0100 @@ -40,14 +40,6 @@ #ToggleBreakpointActionProvider CTL_Line_Breakpoint_Print_Text=Breakpoint hit at line {lineNumber} in class {className} by thread {threadName}. - -# BreakpointEnableAction - - CTL_enabled=Enabled - -# BreakpointCustomizeAction - - CTL_customize=Customize #classesViewAction CTL_ClassesAction=&Classes diff -r 6552f6e77b1d debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/JPDABreakpointCustomizer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/breakpoints/JPDABreakpointCustomizer.java Thu Mar 20 20:24:18 2008 +0100 @@ -0,0 +1,92 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.debugger.jpda.ui.breakpoints; + +import java.beans.Customizer; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import org.netbeans.api.debugger.jpda.ClassLoadUnloadBreakpoint; +import org.netbeans.api.debugger.jpda.ExceptionBreakpoint; +import org.netbeans.api.debugger.jpda.FieldBreakpoint; +import org.netbeans.api.debugger.jpda.JPDABreakpoint; + +import org.netbeans.api.debugger.jpda.LineBreakpoint; +import org.netbeans.api.debugger.jpda.MethodBreakpoint; +import org.netbeans.api.debugger.jpda.ThreadBreakpoint; +import org.netbeans.modules.debugger.jpda.ui.models.BreakpointsActionsProvider; +import org.netbeans.spi.debugger.ui.Controller; +import org.openide.DialogDescriptor; +import org.openide.util.NbBundle; + +/** + * + * @author martin + */ +public class JPDABreakpointCustomizer extends JPanel implements Customizer, Controller { + + private JPDABreakpoint b; + private JComponent c; + + public JPDABreakpointCustomizer() { + } + + public void setObject(Object bean) { + if (!(bean instanceof JPDABreakpoint)) { + throw new IllegalArgumentException(bean.toString()); + } + this.b = (JPDABreakpoint) bean; + init(b); + } + + private void init(JPDABreakpoint b) { + c = BreakpointsActionsProvider.getCustomizerComponent(b); + add(c); + } + + public boolean ok() { + return ((Controller) c).ok(); + } + + public boolean cancel() { + return ((Controller) c).cancel(); + } + +} diff -r 6552f6e77b1d debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/BreakpointsActionsProvider.java --- a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/BreakpointsActionsProvider.java Tue Mar 18 16:40:56 2008 +0100 +++ b/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/BreakpointsActionsProvider.java Thu Mar 20 20:24:18 2008 +0100 @@ -109,8 +109,8 @@ public class BreakpointsActionsProvider else original.performDefaultAction (node); } - - public static void customize (Breakpoint b) { + + public static JComponent getCustomizerComponent(Breakpoint b) { JComponent c = null; if (b instanceof LineBreakpoint) c = new LineBreakpointPanel ((LineBreakpoint) b); @@ -132,6 +132,11 @@ public class BreakpointsActionsProvider c.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(BreakpointsActionsProvider.class, "ACSD_Breakpoint_Customizer_Dialog")); // NOI18N + return c; + } + + public static void customize (Breakpoint b) { + JComponent c = getCustomizerComponent(b); HelpCtx helpCtx = HelpCtx.findHelp (c); if (helpCtx == null) { helpCtx = new HelpCtx ("debug.add.breakpoint"); // NOI18N diff -r 6552f6e77b1d editor.lib/src/org/netbeans/editor/Annotations.java --- a/editor.lib/src/org/netbeans/editor/Annotations.java Tue Mar 18 16:40:56 2008 +0100 +++ b/editor.lib/src/org/netbeans/editor/Annotations.java Thu Mar 20 20:24:18 2008 +0100 @@ -61,9 +61,12 @@ import javax.swing.JMenuItem; import javax.swing.JMenuItem; import javax.swing.SwingUtilities; import org.netbeans.editor.ext.ExtKit; +import org.openide.util.ContextAwareAction; +import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; import org.openide.util.actions.Presenter; +import org.openide.util.lookup.Lookups; /** Annotations class act as data model containing all annotations attached * to one document. Class uses instances of private class LineAnnotations for @@ -642,6 +645,14 @@ public class Annotations implements Docu } } + private Action getAction(AnnotationDesc anno, Action action) { + if (action instanceof ContextAwareAction && anno instanceof Lookup.Provider) { + Lookup lookup = ((Lookup.Provider) anno).getLookup(); + action = ((ContextAwareAction) action).createContextAwareInstance(lookup); + } + return action; + } + /** Creates menu item for the given action. It must handle the BaseActions, which * have localized name stored not in Action.NAME property. */ private JMenuItem createMenuItem(Action action, BaseKit kit) { @@ -684,7 +695,7 @@ public class Annotations implements Docu if (actions != null) { subMenu = new JMenu(anno.getAnnotationTypeInstance().getDescription()); for (int j=0; j 0) { orderedSubMenus.add(subMenu); @@ -703,7 +714,7 @@ public class Annotations implements Docu if (actions != null) { subMenu = new JMenu(pasiveAnnos[i].getAnnotationTypeInstance().getDescription()); for (int j=0; j= 0; i--) { - Class cls = inners[i]; - if (cls.getName().endsWith("AnnotationDescDelegate")) { - delegate = cls.getDeclaredField("delegate"); - delegate.setAccessible(true); - } - } for (Iterator it = lineAnnotations.getAnnotations(); it.hasNext();) { AnnotationDesc annoDesc = (AnnotationDesc)it.next(); - Annotation anno = (Annotation)delegate.get(annoDesc); + Annotation anno = ((Lookup.Provider) annoDesc).getLookup().lookup(Annotation.class); annotations.add(anno); } diff -r 6552f6e77b1d spi.debugger.ui/apichanges.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spi.debugger.ui/apichanges.xml Thu Mar 20 20:24:18 2008 +0100 @@ -0,0 +1,132 @@ + + + + + + + + + + + + + Debugger Core SPI + + + + + + + + BreakpointAnnotation class added. + + + + + +

+ BreakpointAnnotation class added, in order to bind annotations to breakpoints. + BreakpointEnableAction and BreakpointCustomizeAction are also moved to spi.debugger.ui module + so thatthey do not have to be duplicated in every debugger module. It's enough to implement + the new BreakpointAnnotation class and these action will automatically retrieve the breakpoint. +

+
+ + +
+ +
+ + + + + + + Debugger Core API changes by date + + + + + + +

Introduction

+ +

This document lists changes made to the Debugger Core APIs. Please ask on the + nbdev@netbeans.org + mailing list if you have any questions about the details of a + change, or are wondering how to convert existing code to be compatible. +

+ +
+ +

@FOOTER@

+ + +
+
diff -r 6552f6e77b1d spi.debugger.ui/manifest.mf --- a/spi.debugger.ui/manifest.mf Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/manifest.mf Thu Mar 20 20:24:18 2008 +0100 @@ -2,6 +2,6 @@ OpenIDE-Module: org.netbeans.spi.debugge OpenIDE-Module: org.netbeans.spi.debugger.ui/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/debugger/ui/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/debugger/resources/mf-layer.xml -OpenIDE-Module-Specification-Version: 2.10 +OpenIDE-Module-Specification-Version: 2.11 OpenIDE-Module-Provides: org.netbeans.spi.debugger.ui OpenIDE-Module-Install: org/netbeans/modules/debugger/ui/DebuggerModule.class diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/CondBreakpoint.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/CondBreakpoint.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/CondBreakpoint.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/ConditionalBreakpoint.png' highlight='0xFC9D9F' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5' diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/CondBreakpoint_broken.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/CondBreakpoint_broken.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/CondBreakpoint_broken.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/ConditionalBreakpoint_broken.png' highlight='0xDCDCD8' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5' diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/DisabledBreakpoint.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/DisabledBreakpoint.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/DisabledBreakpoint.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,4 +50,5 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/DisabledBreakpoint.png' highlight='0xDCDCD8' type='line' + actions='BreakpointActions' /> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/DisabledCondBreakpoint.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/DisabledCondBreakpoint.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/DisabledCondBreakpoint.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,4 +50,5 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/DisabledConditionalBreakpoint.png' highlight='0xDCDCD8' type='line' + actions='BreakpointActions' /> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_BP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_BP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_BP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/Breakpoint+PC.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_BP_broken.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_BP_broken.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_BP_broken.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/Breakpoint+PC_broken.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_CBP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_CBP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_CBP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/ConditionalBreakpoint+PC.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_CBP_broken.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_CBP_broken.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_CBP_broken.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/ConditionalBreakpoint+PC_broken.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_DBP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_DBP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_DBP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/DisabledBreakpoint+PC.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xBDE6AA'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_DCBP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_DCBP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_DCBP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/DisabledConditionalBreakpoint+PC.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xBDE6AA'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_mixedBP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_mixedBP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_mixedBP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiBreakpoint+PC.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_mixedBP_broken.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_mixedBP_broken.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_mixedBP_broken.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiBreakpoint+PC_broken.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_BPCBP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_BPCBP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_BPCBP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiBreakpoint+PC.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xBDE6AA'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_BPCBP_broken.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_BPCBP_broken.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_BPCBP_broken.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiBreakpoint+PC_broken.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xBDE6AA'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_DBPCBP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_DBPCBP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/PC_multi_DBPCBP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiDisabledBreakpoint+PC.png' highlight='0xBDE6AA' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xBDE6AA'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mf-layer.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mf-layer.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mf-layer.xml Thu Mar 20 20:24:18 2008 +0100 @@ -361,6 +361,14 @@ made subject to such option by the copyr + + + + + + + + diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mixed_BP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mixed_BP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mixed_BP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiBreakpoint.png' highlight='0xFC9D9F' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mixed_BP_broken.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mixed_BP_broken.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/mixed_BP_broken.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiBreakpoint_broken.png' highlight='0xDCDCD8' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_BPCBP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_BPCBP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_BPCBP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiBreakpoint.png' highlight='0xFC9D9F' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_BPCBP_broken.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_BPCBP_broken.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_BPCBP_broken.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiBreakpoint_broken.png' highlight='0xDCDCD8' type='line' + actions='BreakpointActions' severity='ok' priority='100' custom_sidebar_color='0xFF8FD5'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_DBPCBP.xml --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_DBPCBP.xml Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/resources/multi_DBPCBP.xml Thu Mar 20 20:24:18 2008 +0100 @@ -50,6 +50,7 @@ made subject to such option by the copyr glyph='nbresloc:/org/netbeans/modules/debugger/resources/editor/MultiDisabledBreakpoint.png' highlight='0xDCDCD8' type='line' + actions='BreakpointActions' severity='ok' priority='100'> diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/BreakpointCustomizeAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/BreakpointCustomizeAction.java Thu Mar 20 20:24:18 2008 +0100 @@ -0,0 +1,243 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ + +package org.netbeans.modules.debugger.ui.actions; + +import java.awt.Dialog; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.BeanDescriptor; +import java.beans.BeanInfo; +import java.beans.Customizer; +import java.beans.Introspector; +import java.beans.PropertyChangeListener; +import javax.swing.Action; +import javax.swing.JMenuItem; + +import org.netbeans.api.debugger.Breakpoint; +import org.netbeans.spi.debugger.ui.BreakpointAnnotation; + +import org.netbeans.spi.debugger.ui.Controller; +import org.openide.DialogDescriptor; +import org.openide.DialogDisplayer; +import org.openide.util.ContextAwareAction; +import org.openide.util.Exceptions; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; +import org.openide.util.NbBundle; +import org.openide.util.actions.SystemAction; + +/** + * Customize action for line breakpoint, which is available from the gutter popup. + * + * @author Martin Entlicher + */ +public class BreakpointCustomizeAction extends SystemAction implements ContextAwareAction { + + /** Creates a new instance of BreakpointCustomizeAction */ + public BreakpointCustomizeAction() { + setEnabled(false); + } + + public String getName() { + return NbBundle.getMessage(BreakpointCustomizeAction.class, "CTL_customize"); + } + + public HelpCtx getHelpCtx() { + return null; + } + + public void actionPerformed(ActionEvent ev) { + } + + public Action createContextAwareInstance(Lookup actionContext) { + BreakpointAnnotation ann = actionContext.lookup(BreakpointAnnotation.class); + if (ann != null) { + return new BreakpointAwareAction(ann); + } else { + //Exceptions.printStackTrace(new IllegalStateException("expecting BreakpointAnnotation object in lookup "+actionContext)); + return this; + } + } + + private class BreakpointAwareAction implements Action { + + private BreakpointAnnotation ann; + + public BreakpointAwareAction(BreakpointAnnotation ann) { + this.ann = ann; + } + + public Object getValue(String key) { + return BreakpointCustomizeAction.this.getValue(key); + } + + public void putValue(String key, Object value) { + //BreakpointCustomizeAction.this.putValue(key, value); + } + + public void setEnabled(boolean b) { + //BreakpointCustomizeAction.this.setEnabled(b); + } + + public boolean isEnabled() { + return getCustomizer(ann.getBreakpoint()) != null; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + BreakpointCustomizeAction.this.addPropertyChangeListener(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + BreakpointCustomizeAction.this.removePropertyChangeListener(listener); + } + + public void actionPerformed(ActionEvent e) { + customize(ann.getBreakpoint()); + } + + private BeanInfo findBeanInfo(Class clazz) { + Class biClass; + try { + biClass = Lookup.getDefault().lookup(ClassLoader.class).loadClass(clazz.getName()+"BeanInfo"); + } catch (ClassNotFoundException cnfex) { + biClass = null; + } + if (biClass == null) { + clazz = clazz.getSuperclass(); + if (clazz != null) { + return findBeanInfo(clazz); + } else { + return null; + } + } else { + try { + java.lang.reflect.Constructor c = biClass.getConstructor(new Class[0]); + c.setAccessible(true); + return (BeanInfo) c.newInstance(new Object[0]); + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + return null; + } + } + } + + private Customizer getCustomizer(Breakpoint b) { + BeanInfo bi = findBeanInfo(b.getClass()); + if (bi == null) { + try { + bi = Introspector.getBeanInfo(b.getClass()); + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + return null; + } + } + BeanDescriptor bd = bi.getBeanDescriptor(); + if (bd == null) return null; + Class cc = bd.getCustomizerClass(); + if (cc == null) return null; + try { + Customizer c = (Customizer) cc.newInstance(); + c.setObject(b); + return c; + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + return null; + } + } + + private void customize(Breakpoint b) { + Customizer c = getCustomizer(b); + if (c == null) { + return; + } + + HelpCtx helpCtx = HelpCtx.findHelp (c); + if (helpCtx == null) { + helpCtx = new HelpCtx ("debug.add.breakpoint"); // NOI18N + } + final Controller[] cPtr = new Controller[] { null }; + if (c instanceof Controller) { + cPtr[0] = (Controller) c; + } + final DialogDescriptor[] descriptorPtr = new DialogDescriptor[1]; + final Dialog[] dialogPtr = new Dialog[1]; + ActionListener buttonsActionListener = null; + if (cPtr[0] != null) { + buttonsActionListener = new ActionListener() { + public void actionPerformed(ActionEvent ev) { + if (descriptorPtr[0].getValue() == DialogDescriptor.OK_OPTION) { + boolean ok = cPtr[0].ok(); + if (ok) { + dialogPtr[0].setVisible(false); + } + } else { + dialogPtr[0].setVisible(false); + } + } + }; + } + DialogDescriptor descriptor = new DialogDescriptor ( + c, + NbBundle.getMessage ( + BreakpointCustomizeAction.class, + "CTL_Breakpoint_Customizer_Title" // NOI18N + ), + true, + DialogDescriptor.OK_CANCEL_OPTION, + DialogDescriptor.OK_OPTION, + DialogDescriptor.DEFAULT_ALIGN, + helpCtx, + buttonsActionListener + ); + if (buttonsActionListener != null) { + descriptor.setClosingOptions(new Object[] {}); + } + Dialog d = DialogDisplayer.getDefault ().createDialog (descriptor); + d.pack (); + descriptorPtr[0] = descriptor; + dialogPtr[0] = d; + d.setVisible (true); + } + + } + +} diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/BreakpointEnableAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/BreakpointEnableAction.java Thu Mar 20 20:24:18 2008 +0100 @@ -0,0 +1,187 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ + +package org.netbeans.modules.debugger.ui.actions; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeListener; +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; +import javax.swing.Action; +import javax.swing.JMenuItem; +import javax.swing.text.BadLocationException; +import javax.swing.text.JTextComponent; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle; +import org.openide.util.actions.BooleanStateAction; + +import org.netbeans.api.debugger.Breakpoint; +import org.netbeans.spi.debugger.ui.BreakpointAnnotation; +import org.openide.text.Annotation; +import org.openide.util.ContextAwareAction; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.actions.Presenter; +import org.openide.util.actions.SystemAction; + +/** + * Enables or disables breakpoints. + * + * @author Martin Entlicher + */ +public class BreakpointEnableAction extends BooleanStateAction implements ContextAwareAction { + + @Override + public boolean isEnabled() { + return false; + } + + public String getName() { + return NbBundle.getMessage(BreakpointEnableAction.class, "CTL_enabled"); + } + + public HelpCtx getHelpCtx() { + return null; + } + + public Action createContextAwareInstance(Lookup actionContext) { + BreakpointAnnotation ann = actionContext.lookup(BreakpointAnnotation.class); + if (ann != null) { + BreakpointAwareAction a = new BreakpointAwareAction(ann); + return a; + } else { + return this; + } + } + + private class BreakpointAwareAction implements Action, Presenter.Menu, Presenter.Popup { + + private BreakpointAnnotation ann; + private HiddenBooleanStateAction hba; + + public BreakpointAwareAction(BreakpointAnnotation ann) { + this.ann = ann; + hba = SystemAction.get(HiddenBooleanStateAction.class); + } + + public Object getValue(String key) { + return hba.getValue(key); + } + + public void putValue(String key, Object value) { + hba.putValue(key, value); + } + + public void setEnabled(boolean b) { + //BreakpointEnableAction.this.setEnabled(b); + } + + public boolean isEnabled() { + hba.setFor(ann.getBreakpoint()); + return true; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + hba.addPropertyChangeListener(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + hba.removePropertyChangeListener(listener); + } + + public void actionPerformed(ActionEvent e) { + //perform(); + } + + public JMenuItem getMenuPresenter() { + hba.setFor(ann.getBreakpoint()); + return hba.getMenuPresenter(); + } + + public JMenuItem getPopupPresenter() { + hba.setFor(ann.getBreakpoint()); + return hba.getPopupPresenter(); + } + + } + + private static class HiddenBooleanStateAction extends BooleanStateAction { + + private Reference bRef = new WeakReference(null); + + public HiddenBooleanStateAction() { + setEnabled(true); + } + + public void setFor(Breakpoint b) { + bRef = new WeakReference(b); + setBooleanState(b.isEnabled()); + } + + @Override + public String getName() { + return NbBundle.getMessage(BreakpointEnableAction.class, "CTL_enabled"); + } + + @Override + public HelpCtx getHelpCtx() { + return null; + } + + @Override + public void actionPerformed(ActionEvent ev) { + super.actionPerformed(ev); + Breakpoint b = bRef.get(); + if (b != null) { + boolean enabled = b.isEnabled(); + enabled = !enabled; + if (enabled) { + b.enable(); + } else { + b.disable(); + } + } + } + + } + +} diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/Bundle.properties --- a/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/Bundle.properties Tue Mar 18 16:40:56 2008 +0100 +++ b/spi.debugger.ui/src/org/netbeans/modules/debugger/ui/actions/Bundle.properties Thu Mar 20 20:24:18 2008 +0100 @@ -198,3 +198,12 @@ CTL_PopTopmostCallAction_name=&Pop Topmo CTL_PopTopmostCallAction_name=&Pop Topmost Call CTL_Debugger_Window=Debugger Window + +# BreakpointEnableAction + + CTL_enabled=Enabled + +# BreakpointCustomizeAction + + CTL_customize=Customize + CTL_Breakpoint_Customizer_Title=Customize Breakpoint diff -r 6552f6e77b1d spi.debugger.ui/src/org/netbeans/spi/debugger/ui/BreakpointAnnotation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spi.debugger.ui/src/org/netbeans/spi/debugger/ui/BreakpointAnnotation.java Thu Mar 20 20:24:18 2008 +0100 @@ -0,0 +1,59 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.spi.debugger.ui; + +import org.netbeans.api.debugger.Breakpoint; +import org.openide.text.Annotation; + +/** + * The base class for breakpoint annotations. + * + * @author Martin Entlicher + */ +public abstract class BreakpointAnnotation extends Annotation { + + /** + * Get the breakpoint that is annotated by this annotation. + * + * @return The annotated breakpoint + */ + public abstract Breakpoint getBreakpoint(); + +}