Bug 495957 - To set a trigger point for breakpoints for a workspace
Change-Id: Ic618888cd18f2c3482677ae18bb51ca9627299f0
diff --git a/org.eclipse.jdt.debug.tests/testprograms/TriggerPoint_01.java b/org.eclipse.jdt.debug.tests/testprograms/TriggerPoint_01.java
new file mode 100644
index 0000000..1e4a485
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/testprograms/TriggerPoint_01.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+public class TriggerPoint_01 {
+ int i =0, j=0;
+
+ public static void main(String[] args) {
+ TriggerPoint_01 t =new TriggerPoint_01();
+ t.test1();
+ t.test2();
+ t.test1();
+ t.test2();
+ t.test1();
+ }
+
+ public void test1(){
+ i++;
+ System.out.println("Test1");
+ }
+
+ public void test2(){
+ j++;
+ System.out.println("Test2");
+ }
+
+}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index 040f7d9..10a55cf 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -197,7 +197,7 @@
"bug329294", "bug401270", "org.eclipse.debug.tests.targets.HcrClass2", "org.eclipse.debug.tests.targets.HcrClass3", "org.eclipse.debug.tests.targets.HcrClass4",
"org.eclipse.debug.tests.targets.HcrClass5", "org.eclipse.debug.tests.targets.HcrClass6", "org.eclipse.debug.tests.targets.HcrClass7", "org.eclipse.debug.tests.targets.HcrClass8",
"org.eclipse.debug.tests.targets.HcrClass9", "TestContributedStepFilterClass", "TerminateAll_01", "TerminateAll_02", "StepResult1",
- "StepResult2", "StepResult3" };
+ "StepResult2", "StepResult3", "TriggerPoint_01" };
final String[] LAUNCH_CONFIG_NAMES_1_8 = {"LargeSourceFile"};
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
index c804c7b..4b4dd11 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,9 +11,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.debug.test.stepping.ForceReturnTests;
import org.eclipse.jdt.debug.test.stepping.StepFilterTests;
@@ -41,6 +38,7 @@
import org.eclipse.jdt.debug.tests.breakpoints.TestToggleBreakpointsTarget;
import org.eclipse.jdt.debug.tests.breakpoints.TestToggleBreakpointsTarget8;
import org.eclipse.jdt.debug.tests.breakpoints.ThreadFilterBreakpointsTests;
+import org.eclipse.jdt.debug.tests.breakpoints.TriggerPointBreakpointsTests;
import org.eclipse.jdt.debug.tests.breakpoints.TypeNameBreakpointTests;
import org.eclipse.jdt.debug.tests.breakpoints.WatchpointTests;
import org.eclipse.jdt.debug.tests.console.ConsoleTerminateAllActionTests;
@@ -127,6 +125,9 @@
import org.eclipse.jdt.debug.tests.variables.TestIntegerAccessUnboxing15;
import org.eclipse.jdt.debug.tests.variables.TestLogicalStructures;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
/**
* Tests for integration and nightly builds.
*/
@@ -189,6 +190,8 @@
addTest(new TestSuite(BreakpointLocationVerificationTests.class));
addTest(new TestSuite(RunToLineTests.class));
addTest(new TestSuite(TestToggleBreakpointsTarget.class));
+ addTest(new TestSuite(TriggerPointBreakpointsTests.class));
+
if (JavaProjectHelper.isJava8Compatible()) {
addTest(new TestSuite(TestToggleBreakpointsTarget8.class));
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java
new file mode 100644
index 0000000..3bf5881
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.debug.tests.breakpoints;
+
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
+import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
+import org.eclipse.jdt.debug.core.IJavaStackFrame;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.tests.AbstractDebugTest;
+
+/**
+ * Tests trigger point of breakpoints
+ */
+public class TriggerPointBreakpointsTests extends AbstractDebugTest {
+
+ /**
+ * Constructor
+ * @param name
+ */
+ public TriggerPointBreakpointsTests(String name) {
+ super(name);
+ }
+
+ /**
+ * Tests the trigger point
+ *
+ * @throws Exception
+ */
+ public void testTriggerPointBreakpoint() throws Exception {
+ String typeName = "TriggerPoint_01";
+ IJavaLineBreakpoint bp1 = createLineBreakpoint(25, typeName);
+ IJavaLineBreakpoint bp2 = createLineBreakpoint(30, typeName);
+ bp2.setTriggerPoint(true);
+ bp2.setTriggerPointActive(true);
+
+ IJavaThread thread= null;
+ try {
+ thread = launchToLineBreakpoint(typeName, bp2);
+
+ IJavaStackFrame frame = (IJavaStackFrame)thread.getTopStackFrame();
+ IVariable var = findVariable(frame, "i");
+ assertNotNull("Could not find variable 'i'", var);
+
+ IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
+ assertNotNull("variable 'i' has no value", value);
+ int iValue = value.getIntValue();
+ assertTrue("value of 'i' should be '1', but was " + iValue, iValue == 1);
+
+ var = findVariable(frame, "j");
+ assertNotNull("Could not find variable 'j'", var);
+
+ value = (IJavaPrimitiveValue) var.getValue();
+ assertNotNull("variable 'j' has no value", value);
+ int jValue = value.getIntValue();
+ assertTrue("value of 'j' should be '1', but was " + jValue, jValue == 1);
+
+ bp1.delete();
+ bp2.delete();
+ } finally {
+ terminateAndRemove(thread);
+ removeAllBreakpoints();
+ }
+ }
+}
diff --git a/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_ovr.png b/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_ovr.png
new file mode 100644
index 0000000..14f06f9
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_ovr.png
Binary files differ
diff --git a/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_suppressed_ovr.png b/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_suppressed_ovr.png
new file mode 100644
index 0000000..e53242b
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/icons/full/ovr16/trigger_suppressed_ovr.png
Binary files differ
diff --git a/org.eclipse.jdt.debug.ui/plugin.properties b/org.eclipse.jdt.debug.ui/plugin.properties
index 228f7bb..dada1dc 100644
--- a/org.eclipse.jdt.debug.ui/plugin.properties
+++ b/org.eclipse.jdt.debug.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2014 IBM Corporation and others.
+# Copyright (c) 2000, 2016 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -69,6 +69,10 @@
exitAction.label=E&xit
hitCount.label=&Hit Count...
+triggerPoint.label=Toggle Tri&gger
+triggerPoint.tooltip=Toggles the trigger point property of the selected breakpoint
+activateTriggerPoint.label=Toggle Acti&vate Trigger
+activateTriggerPoint.tooltip=Toggles the activation of trigger point property of the selected breakpoint
Inspect.label=Insp&ect
Inspect.tooltip=Inspect Result of Evaluating Selected Text
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIImageDescriptor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIImageDescriptor.java
index 8ea41f9..e42400f 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIImageDescriptor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIImageDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -57,6 +57,12 @@
/** Flag to render the synchronized stack frame adornment */
public final static int SYNCHRONIZED= 0x4000;
+ /** Flag to render the trigger point adornment */
+ public final static int TRIGGER_POINT = 0x10000;
+
+ /** Flag to render disabled due to trigger point adornment */
+ public final static int TRIGGER_SUPPRESSED = 0x20000;
+
private ImageDescriptor fBaseImage;
private int fFlags;
private Point fSize;
@@ -155,6 +161,21 @@
data= getImageData(JavaDebugImages.IMG_OVR_IN_DEADLOCK);
drawImage(data, x, y);
}
+ if ((flags & TRIGGER_POINT) != 0) {
+ x = getSize().x;
+ y = getSize().y;
+ data = getImageData(JavaDebugImages.IMG_OVR_IN_TRIGGER_POINT);
+ x -= data.width;
+ y -= data.height;
+ drawImage(data, x, y);
+ } else if ((flags & TRIGGER_SUPPRESSED) != 0) {
+ x = getSize().x;
+ y = getSize().y;
+ data = getImageData(JavaDebugImages.IMG_OVR_TRIGGER_SUPPRESSED);
+ x -= data.width;
+ y -= data.height;
+ drawImage(data, x, y);
+ }
if ((flags & OWNED_MONITOR) != 0) {
x= getSize().x;
y= getSize().y;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
index 409f6f8..9928d8b 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
@@ -1046,6 +1046,11 @@
if (breakpoint.isInstalled()) {
flags |= JDIImageDescriptor.INSTALLED;
}
+ if (breakpoint.isTriggerPointActive()) {
+ flags |= JDIImageDescriptor.TRIGGER_POINT;
+ } else if (!DebugPlugin.getDefault().getBreakpointManager().canSupendOnBreakpoint()) {
+ flags |= JDIImageDescriptor.TRIGGER_SUPPRESSED;
+ }
if (breakpoint instanceof IJavaLineBreakpoint) {
if (((IJavaLineBreakpoint)breakpoint).isConditionEnabled()) {
flags |= JDIImageDescriptor.CONDITIONAL;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugImages.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugImages.java
index 48afc7c..d8cd786 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugImages.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugImages.java
@@ -101,6 +101,10 @@
public static final String IMG_ELCL_ALL_REFERENCES = "IMG_ELCL_ALL_REFERENCES"; //$NON-NLS-1$
+ public static final String IMG_OVR_IN_TRIGGER_POINT = "IMG_OVR_IN_TRIGGER_POINT"; //$NON-NLS-1$
+
+ public static final String IMG_OVR_TRIGGER_SUPPRESSED = "IMG_OVR_TRIGGER_SUPPRESSED"; //$NON-NLS-1$
+
/*
* Set of predefined Image Descriptors.
*/
@@ -212,6 +216,11 @@
declareRegistryImage(IMG_ELCL_AUTO_FORMAT, E_LCL + "autoform_menu.png"); //$NON-NLS-1$
declareRegistryImage(IMG_ELCL_ALL_REFERENCES, E_LCL + "all_references.png"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_IN_TRIGGER_POINT, T_OVR + "trigger_ovr.png"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_OVR_TRIGGER_SUPPRESSED, T_OVR + "trigger_suppressed_ovr.png"); //$NON-NLS-1$
+
}
/**
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/ExceptionBreakpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/ExceptionBreakpointDetailPane.java
index 2a19cf0..5c1cd4c 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/ExceptionBreakpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/ExceptionBreakpointDetailPane.java
@@ -30,6 +30,7 @@
addAutosaveProperties(new int[]{
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY,
+ StandardJavaBreakpointEditor.PROP_TRIGGER_POINT, StandardJavaBreakpointEditor.PROP_TRIGER_POINT_ACTIVE,
ExceptionBreakpointEditor.PROP_CAUGHT,
ExceptionBreakpointEditor.PROP_UNCAUGHT,
ExceptionBreakpointEditor.PROP_SUBCLASSES
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/LineBreakpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/LineBreakpointDetailPane.java
index 5cd8d2a..c59967e 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/LineBreakpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/LineBreakpointDetailPane.java
@@ -32,7 +32,8 @@
JavaBreakpointConditionEditor.PROP_CONDITION_ENABLED,
JavaBreakpointConditionEditor.PROP_CONDITION_SUSPEND_POLICY,
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
- StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY});
+ StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY, StandardJavaBreakpointEditor.PROP_TRIGGER_POINT,
+ StandardJavaBreakpointEditor.PROP_TRIGER_POINT_ACTIVE });
}
/* (non-Javadoc)
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointDetailPane.java
index 57a94a7..3586400 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointDetailPane.java
@@ -31,6 +31,7 @@
addAutosaveProperties(new int[]{
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY,
+ StandardJavaBreakpointEditor.PROP_TRIGGER_POINT, StandardJavaBreakpointEditor.PROP_TRIGER_POINT_ACTIVE,
MethodBreakpointEditor.PROP_ENTRY,
MethodBreakpointEditor.PROP_EXIT,
JavaBreakpointConditionEditor.PROP_CONDITION_ENABLED,
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointEditor.java
index 654ce3f..293c495 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/MethodBreakpointEditor.java
@@ -38,9 +38,9 @@
*/
@Override
public Control createControl(Composite parent) {
- Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 2, 1, 0, 0, 0);
+ Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, 0, 0, 0);
// add standard controls
- super.createStandardControls(composite);
+ super.createControl(composite);
Composite watchComp = SWTFactory.createComposite(composite, parent.getFont(), 3, 1, 0, 0, 0);
fEntry = createSusupendPropertyEditor(watchComp, processMnemonics(PropertyPageMessages.JavaLineBreakpointPage_10), PROP_ENTRY);
fExit = createSusupendPropertyEditor(watchComp, processMnemonics(PropertyPageMessages.JavaLineBreakpointPage_11), PROP_EXIT);
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardBreakpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardBreakpointDetailPane.java
index 2154d65..9b258cb 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardBreakpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardBreakpointDetailPane.java
@@ -29,7 +29,8 @@
super(BreakpointMessages.StandardBreakpointDetailPane_0, BreakpointMessages.StandardBreakpointDetailPane_0, DETAIL_PANE_STANDARD);
addAutosaveProperties(new int[]{
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
- StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY});
+ StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY, StandardJavaBreakpointEditor.PROP_TRIGGER_POINT,
+ StandardJavaBreakpointEditor.PROP_TRIGER_POINT_ACTIVE });
}
/* (non-Javadoc)
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardJavaBreakpointEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardJavaBreakpointEditor.java
index 6dcadf7..9ad2b97 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardJavaBreakpointEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/StandardJavaBreakpointEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 IBM Corporation and others.
+ * Copyright (c) 2009, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,10 +13,12 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.jdt.debug.core.IJavaBreakpoint;
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
import org.eclipse.jdt.internal.debug.ui.propertypages.PropertyPageMessages;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -40,6 +42,8 @@
private Text fHitCountText;
private Button fSuspendThread;
private Button fSuspendVM;
+ protected Button fTriggerPointButton;
+ protected Button fTriggerPointButtonActive;
/**
* Property id for hit count enabled state.
@@ -56,14 +60,66 @@
*/
public static final int PROP_SUSPEND_POLICY = 0x1007;
+ /**
+ * Property id for trigger point.
+ */
+ public static final int PROP_TRIGGER_POINT = 0x1008;
+ /**
+ * Property id for trigger point active state.
+ */
+ public static final int PROP_TRIGER_POINT_ACTIVE = 0x1009;
+
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.debug.ui.breakpoints.AbstractJavaBreakpointEditor#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public Control createControl(Composite parent) {
+ createTriggerPointButton(parent);
return createStandardControls(parent);
}
+
+ protected Button createCheckButton(Composite parent, String text) {
+ return SWTFactory.createCheckButton(parent, text, null, false, 1);
+ }
+ /**
+ * Creates the button to toggle Triggering point property of the breakpoint
+ *
+ * @param parent
+ * the parent composite
+ */
+ protected void createTriggerPointButton(Composite parent) {
+ Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, 0, 0, 0);
+ fTriggerPointButton = createCheckButton(composite, PropertyPageMessages.JavaBreakpointPage_12);
+ composite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, 0, 0, 0);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan = 2;
+ gd.horizontalIndent = LayoutUtil.getIndent();
+ composite.setLayoutData(gd);
+ fTriggerPointButtonActive = createCheckButton(composite, PropertyPageMessages.JavaBreakpointPage_13);
+
+ fTriggerPointButton.setSelection(isTriggerPoint());
+ fTriggerPointButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ fTriggerPointButtonActive.setEnabled(fTriggerPointButton.getSelection());
+ fTriggerPointButtonActive.setSelection(fTriggerPointButton.getSelection());
+ setDirty(PROP_TRIGER_POINT_ACTIVE);
+ setDirty(PROP_TRIGGER_POINT);
+ }
+
+ });
+ fTriggerPointButtonActive.setEnabled(fTriggerPointButton.getSelection());
+ fTriggerPointButtonActive.setSelection(isActiveTriggerPoiint());
+ fTriggerPointButtonActive.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ setDirty(PROP_TRIGER_POINT_ACTIVE);
+ }
+
+ });
+
+ }
protected Control createStandardControls(Composite parent) {
Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 4, 1, 0, 0, 0);
fHitCountButton = SWTFactory.createCheckButton(composite, processMnemonics(PropertyPageMessages.JavaBreakpointPage_4), null, false, 1);
@@ -169,6 +225,10 @@
fSuspendVM.setEnabled(enabled);
fSuspendThread.setSelection(suspendThread);
fSuspendVM.setSelection(!suspendThread);
+ fTriggerPointButton.setEnabled(enabled);
+ fTriggerPointButton.setSelection(isTriggerPoint());
+ fTriggerPointButtonActive.setEnabled(enabled);
+ fTriggerPointButtonActive.setSelection(isActiveTriggerPoiint());
setDirty(false);
}
@@ -210,6 +270,9 @@
}
}
fBreakpoint.setHitCount(hitCount);
+ storeTriggerPoint(fBreakpoint);
+ storeTriggerPointActive(fBreakpoint);
+
}
setDirty(false);
}
@@ -256,4 +319,63 @@
});
return button;
}
+
+ private boolean isActiveTriggerPoiint() {
+ try {
+ if (getBreakpoint() != null) {
+ return getBreakpoint().isTriggerPointActive();
+ }
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ private boolean isTriggerPoint() {
+ try {
+ if (getBreakpoint() != null) {
+ return getBreakpoint().isTriggerPoint();
+ }
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return false;
+
+ }
+
+
+ /**
+ * Stores the value of the trigger point state in the breakpoint manager.
+ *
+ * @param breakpoint
+ * the breakpoint to be compared with trigger point in the workspace
+ * @throws CoreException
+ * if an exception occurs while setting the enabled state
+ */
+ private void storeTriggerPoint(IJavaBreakpoint breakpoint) throws CoreException {
+ boolean oldSelection = breakpoint.isTriggerPoint();
+ if (oldSelection == fTriggerPointButton.getSelection()) {
+ return;
+ }
+ breakpoint.setTriggerPoint(fTriggerPointButton.getSelection());
+ }
+
+ /**
+ * Stores the value of the trigger point active state in the breakpoint manager.
+ *
+ * @param breakpoint
+ * the breakpoint to be compared with trigger point in the workspace
+ * @throws CoreException
+ * if an exception occurs while setting the enabled state
+ */
+ private void storeTriggerPointActive(IJavaBreakpoint breakpoint) throws CoreException {
+ boolean oldSelection = breakpoint.isTriggerPointActive();
+ if (oldSelection == fTriggerPointButtonActive.getSelection()) {
+ return;
+ }
+ breakpoint.setTriggerPointActive(fTriggerPointButtonActive.getSelection());
+ DebugPlugin.getDefault().getBreakpointManager().refreshTriggerpointDisplay();
+ }
}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
index 9c0914f..9b300f3 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointDetailPane.java
@@ -30,6 +30,7 @@
addAutosaveProperties(new int[]{
StandardJavaBreakpointEditor.PROP_HIT_COUNT_ENABLED,
StandardJavaBreakpointEditor.PROP_SUSPEND_POLICY,
+ StandardJavaBreakpointEditor.PROP_TRIGGER_POINT, StandardJavaBreakpointEditor.PROP_TRIGER_POINT_ACTIVE,
WatchpointEditor.PROP_ACCESS,
WatchpointEditor.PROP_MODIFICATION
});
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointEditor.java
index 81145a8..e36bdb8 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/WatchpointEditor.java
@@ -41,7 +41,7 @@
public Control createControl(Composite parent) {
Composite container = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, 0, 0, 0);
// add standard controls
- super.createStandardControls(container);
+ super.createControl(container);
Composite watchComp = SWTFactory.createComposite(container, parent.getFont(), 2, 1, 0, 0, 0);
fAccess = createSusupendPropertyEditor(watchComp, processMnemonics(PropertyPageMessages.JavaLineBreakpointPage_7), PROP_ACCESS);
fModification = createSusupendPropertyEditor(watchComp, processMnemonics(PropertyPageMessages.JavaLineBreakpointPage_8), PROP_MODIFICATION);
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
index 1361494..6942df7 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -64,6 +64,9 @@
protected JavaElementLabelProvider fJavaLabelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
protected Button fEnabledButton;
+ /*
+ * protected Button fTriggerPointButton; protected Button fTriggerPointButtonActive;
+ */
protected List<String> fErrorMessages= new ArrayList<String>();
protected String fPrevMessage = null;
private AbstractJavaBreakpointEditor fEditor;
@@ -148,6 +151,8 @@
*/
protected void doStore() throws CoreException {
IJavaBreakpoint breakpoint = getBreakpoint();
+ // storeTriggerPoint(breakpoint);
+ // storeTriggerPointActive(breakpoint);
storeEnabled(breakpoint);
if (fEditor.isDirty()) {
fEditor.doSave();
@@ -174,7 +179,10 @@
Composite mainComposite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_HORIZONTAL, 0, 0);
createLabels(mainComposite);
createLabel(mainComposite, ""); //$NON-NLS-1$ // spacer
- createEnabledButton(mainComposite);
+
+ Composite composite = SWTFactory.createComposite(mainComposite, parent.getFont(), 4, 1, 0, 0, 0);
+ createEnabledButton(composite);
+
createTypeSpecificEditors(mainComposite);
setValid(true);
// if this breakpoint is being created, change the shell title to indicate 'creation'
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.java
index e0a802c..63597fb 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -47,6 +47,8 @@
public static String JavaBreakpointPage_10;
public static String JavaBreakpointPage_11;
+ public static String JavaBreakpointPage_12;
+ public static String JavaBreakpointPage_13;
public static String JavaBreakpointPage_3;
public static String JavaBreakpointPage_4;
public static String JavaBreakpointPage_5;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.properties b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.properties
index 68cf3c8..e0380dc 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.properties
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/propertypages/PropertyPageMessages.properties
@@ -36,6 +36,8 @@
JavaBreakpointPage_0=Hit count must be a positive integer
JavaBreakpointPage_10=Create Breakpoint for {0}
JavaBreakpointPage_11=Class Prepare Breakpoint
+JavaBreakpointPage_12=Trigger Point
+JavaBreakpointPage_13=Active Trigger
JavaBreakpointPage_3=&Type:
JavaBreakpointPage_4=&Hit count:
JavaBreakpointPage_5=&Enabled
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
index bac8583..2ea940f 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaBreakpoint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -106,6 +106,15 @@
* @since 3.5
*/
public static final String BREAKPOINT_LISTENERS = JDIDebugPlugin.EXTENSION_POINT_JAVA_BREAKPOINT_LISTENERS;
+ /**
+ * Breakpoint attribute storing the expired value of trigger point (value
+ * <code>"org.eclipse.jdt.debug.core.expiredTriggerPoint"</code>). This attribute is
+ * stored as a <code>boolean</code>. Once a trigger point is hit, a
+ * breakpoint is considered to be "expired" as trigger point for the session.
+ *
+ * @since 3.11
+ */
+ public static final String EXPIRED_TRIGGER_POINT = "org.eclipse.jdt.debug.core.expiredTriggerPoint"; //$NON-NLS-1$
/**
* Stores the collection of requests that this breakpoint has installed in
@@ -167,6 +176,12 @@
*/
protected static final String[] fgExpiredEnabledAttributes = new String[] {
EXPIRED, ENABLED };
+
+ /**
+ * JavaBreakpoint attributes for Trigger Point activation
+ */
+ protected static final String[] fgExpiredEnabledTriggerAttributes = new String[] {
+ EXPIRED_TRIGGER_POINT, getTriggerActivePropertyString() };
public JavaBreakpoint() {
fRequestsByTarget = new HashMap<JDIDebugTarget, List<EventRequest>>(1);
@@ -393,6 +408,7 @@
public boolean handleBreakpointEvent(Event event, JDIThread thread,
boolean suspendVote) {
expireHitCount(event);
+ inActivateTriggerPoint(event);
return !suspend(thread, suspendVote); // Resume if suspend fails
}
@@ -466,6 +482,20 @@
}
}
}
+
+ protected void inActivateTriggerPoint(Event event) {
+ try{
+ if (isTriggerPointActive()) {
+ setAttributes(fgExpiredEnabledTriggerAttributes, new Object[] {
+ Boolean.TRUE, Boolean.FALSE });
+ DebugPlugin.getDefault().getBreakpointManager().deActivateTriggerpoints(null);
+ // make a note that we auto-inactivated the trigger point for this breakpoint.
+ }
+ }catch (CoreException ce) {
+ JDIDebugPlugin.log(ce);
+ }
+
+ }
/**
* Returns whether this breakpoint should be "skipped". Breakpoints are
@@ -860,6 +890,13 @@
public int getInstallCount() throws CoreException {
return ensureMarker().getAttribute(INSTALL_COUNT, 0);
}
+
+ /**
+ * Returns whether this trigger breakpoint has expired.
+ */
+ public boolean isTriggerPointExpired() throws CoreException {
+ return ensureMarker().getAttribute(EXPIRED_TRIGGER_POINT, false);
+ }
/**
* Decrements the install count of this breakpoint.
@@ -875,6 +912,11 @@
setAttributes(fgExpiredEnabledAttributes, new Object[] {
Boolean.FALSE, Boolean.TRUE });
}
+ if (isTriggerPointExpired()) {
+ // if breakpoint was auto-disabled, re-enable it
+ setAttributes(fgExpiredEnabledTriggerAttributes, new Object[] {
+ Boolean.FALSE, Boolean.TRUE });
+ }
}
}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
index 7cebf50..d44e438 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
@@ -368,6 +368,7 @@
}
}
setExceptionName(name);
+ inActivateTriggerPoint(event);
if (getExclusionClassFilters().length >= 1
|| getInclusionClassFilters().length >= 1
|| filtersIncludeDefaultPackage(fInclusionClassFilters)
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
index 7366f16..6205508 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
@@ -449,6 +449,7 @@
protected boolean suspendForEvent(Event event, JDIThread thread,
boolean suspendVote) {
expireHitCount(event);
+ inActivateTriggerPoint(event);
return suspend(thread, suspendVote);
}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
index 73215fc..df30d52 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
@@ -431,11 +431,13 @@
if (event instanceof MethodEntryEvent) {
MethodEntryEvent entryEvent = (MethodEntryEvent) event;
fLastEventTypes.put(thread.getDebugTarget(), ENTRY_EVENT);
+ //inActivateTriggerPoint(event);
return handleMethodEvent(entryEvent, entryEvent.method(), thread,
suspendVote);
} else if (event instanceof MethodExitEvent) {
MethodExitEvent exitEvent = (MethodExitEvent) event;
fLastEventTypes.put(thread.getDebugTarget(), EXIT_EVENT);
+ //inActivateTriggerPoint(event);
return handleMethodEvent(exitEvent, exitEvent.method(), thread,
suspendVote);
} else if (event instanceof BreakpointEvent) {
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
index 5179c5e..9868a90 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
@@ -1428,6 +1428,19 @@
}
}
+ try {
+ if (!breakpoint.isTriggerPointActive()) {
+ if (!DebugPlugin.getDefault().getBreakpointManager().canSupendOnBreakpoint()){
+ DebugPlugin.getDefault().getBreakpointManager().deActivateTriggerpoints(null);
+ fSuspendVoteInProgress = false;
+ return false;
+ }
+
+ }
+ }
+ catch (CoreException e) {
+ e.printStackTrace();
+ }
// Evaluate breakpoint condition (if any). The condition is evaluated
// regardless of the current suspend vote status, since breakpoint
// listeners