Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 135658
Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaLineBreakpointPage.java (-2 / +3 lines)
Lines 233-239 Link Here
233
		conditionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
233
		conditionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
234
		conditionComposite.setLayout(new GridLayout());
234
		conditionComposite.setLayout(new GridLayout());
235
		fEnableConditionButton= createCheckButton(conditionComposite, label);
235
		fEnableConditionButton= createCheckButton(conditionComposite, label);
236
		fEnableConditionButton.setSelection(breakpoint.isConditionEnabled());
236
		boolean condition = breakpoint.isConditionEnabled();
237
		fEnableConditionButton.setSelection(condition);
237
		fEnableConditionButton.addSelectionListener(new SelectionAdapter() {
238
		fEnableConditionButton.addSelectionListener(new SelectionAdapter() {
238
			public void widgetSelected(SelectionEvent e) {
239
			public void widgetSelected(SelectionEvent e) {
239
				setConditionEnabled(fEnableConditionButton.getSelection());
240
				setConditionEnabled(fEnableConditionButton.getSelection());
Lines 248-254 Link Here
248
		} else {
249
		} else {
249
			fConditionHasChanged.setSelection(true);
250
			fConditionHasChanged.setSelection(true);
250
		}
251
		}
251
		setConditionEnabled(fEnableConditionButton.getSelection());
252
		setConditionEnabled(condition);
252
	}
253
	}
253
254
254
	/**
255
	/**
(-)ui/org/eclipse/jdt/internal/debug/ui/propertypages/JavaBreakpointPage.java (-64 / +33 lines)
Lines 132-185 Link Here
132
	 */
132
	 */
133
	protected void doStore() throws CoreException {
133
	protected void doStore() throws CoreException {
134
		IJavaBreakpoint breakpoint= getBreakpoint();
134
		IJavaBreakpoint breakpoint= getBreakpoint();
135
		storeSuspendPolicy(breakpoint);
135
		//store the enabled state
136
		storeHitCount(breakpoint);
136
		breakpoint.setEnabled(fEnabledButton.getSelection());
137
		storeEnabled(breakpoint);
137
		
138
	}
138
		//store the suspend policy
139
139
		int suspendPolicy = IJavaBreakpoint.SUSPEND_VM;
140
	/**
140
		if(fSuspendPolicy.getSelectionIndex() == 0) {
141
	 * Stores the value of the enabled state in the breakpoint.
141
			suspendPolicy = IJavaBreakpoint.SUSPEND_THREAD;
142
	 * @param breakpoint the breakpoint to update
142
		}
143
	 * @throws CoreException if an exception occurs while setting
143
		breakpoint.setSuspendPolicy(suspendPolicy);
144
	 *  the enabled state
144
		
145
	 */
145
		//store the hit count
146
	private void storeEnabled(IJavaBreakpoint breakpoint) throws CoreException {
146
		int hitCount = -1;
147
		boolean enabled= fEnabledButton.getSelection();
147
		if (fHitCountButton.getSelection()) {
148
		breakpoint.setEnabled(enabled);
149
	}
150
151
	/**
152
	 * Stores the value of the hit count in the breakpoint.
153
	 * @param breakpoint the breakpoint to update
154
	 * @throws CoreException if an exception occurs while setting
155
	 *  the hit count
156
	 */
157
	private void storeHitCount(IJavaBreakpoint breakpoint) throws CoreException {
158
		boolean hitCountEnabled= fHitCountButton.getSelection();
159
		int hitCount= -1;
160
		if (hitCountEnabled) {
161
			try {
148
			try {
162
				hitCount= Integer.parseInt(fHitCountText.getText());
149
				hitCount = Integer.parseInt(fHitCountText.getText());
163
			} catch (NumberFormatException e) {
150
			} catch (NumberFormatException e) {
164
				JDIDebugUIPlugin.log(new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, MessageFormat.format(PropertyPageMessages.JavaBreakpointPage_2, new String[] { fHitCountText.getText() }), e)); 
151
				JDIDebugUIPlugin.log(new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, MessageFormat.format(PropertyPageMessages.JavaBreakpointPage_2, new String[] { fHitCountText.getText() }), e)); 
165
			}
152
			}
166
		}
153
		}
167
		breakpoint.setHitCount(hitCount);
154
		breakpoint.setHitCount(hitCount);
168
	}
155
	}
169
156
	
170
	/**
171
	 * Stores the value of the suspend policy in the breakpoint.
172
	 * @param breakpoint the breakpoint to update
173
	 * @throws CoreException if an exception occurs while setting the suspend policy
174
	 */
175
	private void storeSuspendPolicy(IJavaBreakpoint breakpoint) throws CoreException {
176
		int suspendPolicy= IJavaBreakpoint.SUSPEND_VM;
177
		if(fSuspendPolicy.getSelectionIndex() == 0) {
178
			suspendPolicy = IJavaBreakpoint.SUSPEND_THREAD;
179
		}
180
		breakpoint.setSuspendPolicy(suspendPolicy);
181
	}
182
183
	/**
157
	/**
184
	 * Creates the labels and editors displayed for the breakpoint.
158
	 * Creates the labels and editors displayed for the breakpoint.
185
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
159
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
Lines 193-201 Link Here
193
			createHitCountEditor(mainComposite);
167
			createHitCountEditor(mainComposite);
194
			createTypeSpecificEditors(mainComposite);
168
			createTypeSpecificEditors(mainComposite);
195
			createSuspendPolicyEditor(mainComposite); // Suspend policy is considered uncommon. Add it last.
169
			createSuspendPolicyEditor(mainComposite); // Suspend policy is considered uncommon. Add it last.
196
		} catch (CoreException e) {
170
		} 
197
			JDIDebugUIPlugin.log(e);
171
		catch (CoreException e) {JDIDebugUIPlugin.log(e);}
198
		}
199
		setValid(true);
172
		setValid(true);
200
		// if this breakpoint is being created, change the shell title to indicate 'creation'
173
		// if this breakpoint is being created, change the shell title to indicate 'creation'
201
		try {
174
		try {
Lines 206-223 Link Here
206
                        shell.setText(MessageFormat.format(PropertyPageMessages.JavaBreakpointPage_10, new String[]{getName(getBreakpoint())})); 
179
                        shell.setText(MessageFormat.format(PropertyPageMessages.JavaBreakpointPage_10, new String[]{getName(getBreakpoint())})); 
207
                        shell.removeShellListener(this);
180
                        shell.removeShellListener(this);
208
                    }
181
                    }
209
                    public void shellClosed(ShellEvent e) {
182
                    public void shellClosed(ShellEvent e) {}
210
                    }
183
                    public void shellDeactivated(ShellEvent e) {}
211
                    public void shellDeactivated(ShellEvent e) {
184
                    public void shellDeiconified(ShellEvent e) {}
212
                    }
185
                    public void shellIconified(ShellEvent e) {}
213
                    public void shellDeiconified(ShellEvent e) {
214
                    }
215
                    public void shellIconified(ShellEvent e) {
216
                    }
217
                });
186
                });
218
            }
187
            }
219
        } catch (CoreException e) {
188
        } 
220
        }
189
		catch (CoreException e) {}
221
		return mainComposite;
190
		return mainComposite;
222
	}
191
	}
223
	
192
	
Lines 261-270 Link Here
261
	 * 		editor will be created.
230
	 * 		editor will be created.
262
	 */
231
	 */
263
	private void createSuspendPolicyEditor(Composite parent) throws CoreException {
232
	private void createSuspendPolicyEditor(Composite parent) throws CoreException {
264
		IJavaBreakpoint breakpoint= getBreakpoint();
233
		IJavaBreakpoint breakpoint = getBreakpoint();
265
		Composite comp = createComposite(parent, 2);
234
		Composite comp = createComposite(parent, 2);
266
		createLabel(comp, PropertyPageMessages.JavaBreakpointPage_6); 
235
		createLabel(comp, PropertyPageMessages.JavaBreakpointPage_6); 
267
		boolean suspendThread= breakpoint.getSuspendPolicy() == IJavaBreakpoint.SUSPEND_THREAD;
236
		boolean suspendThread = breakpoint.getSuspendPolicy() == IJavaBreakpoint.SUSPEND_THREAD;
268
		fSuspendPolicy = new Combo(comp, SWT.BORDER|SWT.READ_ONLY);
237
		fSuspendPolicy = new Combo(comp, SWT.BORDER|SWT.READ_ONLY);
269
		fSuspendPolicy.add(PropertyPageMessages.JavaBreakpointPage_7);
238
		fSuspendPolicy.add(PropertyPageMessages.JavaBreakpointPage_7);
270
		fSuspendPolicy.add(PropertyPageMessages.JavaBreakpointPage_8);
239
		fSuspendPolicy.add(PropertyPageMessages.JavaBreakpointPage_8);
Lines 279-302 Link Here
279
	 * 		will be created
248
	 * 		will be created
280
	 */
249
	 */
281
	private void createHitCountEditor(Composite parent) throws CoreException {
250
	private void createHitCountEditor(Composite parent) throws CoreException {
282
		IJavaBreakpoint breakpoint= getBreakpoint();
251
		IJavaBreakpoint breakpoint = getBreakpoint();
283
		Composite hitCountComposite= createComposite(parent, 2);
252
		Composite hitCountComposite = createComposite(parent, 2);
284
		fHitCountButton= createCheckButton(hitCountComposite, PropertyPageMessages.JavaBreakpointPage_4); 
253
		fHitCountButton = createCheckButton(hitCountComposite, PropertyPageMessages.JavaBreakpointPage_4); 
285
		fHitCountButton.addSelectionListener(new SelectionAdapter() {
254
		fHitCountButton.addSelectionListener(new SelectionAdapter() {
286
			public void widgetSelected(SelectionEvent event) {
255
			public void widgetSelected(SelectionEvent event) {
287
				fHitCountText.setEnabled(fHitCountButton.getSelection());
256
				fHitCountText.setEnabled(fHitCountButton.getSelection());
288
				hitCountChanged();
257
				hitCountChanged();
289
			}
258
			}
290
		});
259
		});
291
		int hitCount= breakpoint.getHitCount();
260
		int hitCount = breakpoint.getHitCount();
292
		String hitCountString= EMPTY_STRING;
261
		String hitCountString = EMPTY_STRING;
293
		if (hitCount > 0) {
262
		if (hitCount > 0) {
294
			hitCountString= new Integer(hitCount).toString();
263
			hitCountString = new Integer(hitCount).toString();
295
			fHitCountButton.setSelection(true);
264
			fHitCountButton.setSelection(true);
296
		} else {
265
		} else {
297
			fHitCountButton.setSelection(false);
266
			fHitCountButton.setSelection(false);
298
		}
267
		}
299
		fHitCountText= createText(hitCountComposite, hitCountString); 
268
		fHitCountText = createText(hitCountComposite, hitCountString); 
300
		if (hitCount <= 0) {
269
		if (hitCount <= 0) {
301
			fHitCountText.setEnabled(false);
270
			fHitCountText.setEnabled(false);
302
		}
271
		}
Lines 317-323 Link Here
317
			return;
286
			return;
318
		}
287
		}
319
		String hitCountText= fHitCountText.getText();
288
		String hitCountText= fHitCountText.getText();
320
		int hitCount= -1;
289
		int hitCount = -1;
321
		try {
290
		try {
322
			hitCount= Integer.parseInt(hitCountText);
291
			hitCount= Integer.parseInt(hitCountText);
323
		} catch (NumberFormatException e1) {
292
		} catch (NumberFormatException e1) {
(-)ui/org/eclipse/jdt/internal/debug/ui/propertypages/BreakpointConditionEditor.java (-8 / +5 lines)
Lines 50-57 Link Here
50
public class BreakpointConditionEditor {
50
public class BreakpointConditionEditor {
51
	
51
	
52
	private JDISourceViewer fViewer;
52
	private JDISourceViewer fViewer;
53
	private IContentAssistProcessor fCompletionProcessor;
53
	private IContentAssistProcessor fCompletionProcessor;	
54
//	private boolean fIsValid;	
55
	private String fOldValue;
54
	private String fOldValue;
56
	private String fErrorMessage;
55
	private String fErrorMessage;
57
	private JavaLineBreakpointPage fPage;
56
	private JavaLineBreakpointPage fPage;
Lines 87-94 Link Here
87
			} 
86
			} 
88
			else {
87
			else {
89
				try {	
88
				try {	
90
					String source= null;
89
					String source = null;
91
					ICompilationUnit compilationUnit= type.getCompilationUnit();
90
					ICompilationUnit compilationUnit = type.getCompilationUnit();
92
					if (compilationUnit != null) {
91
					if (compilationUnit != null) {
93
						source = compilationUnit.getSource();
92
						source = compilationUnit.getSource();
94
					} 
93
					} 
Lines 117-122 Link Here
117
				}
116
				}
118
			});
117
			});
119
			fViewer.setEditable(true);
118
			fViewer.setEditable(true);
119
			document.set(condition);
120
			fViewer.setDocument(document);
120
			fViewer.setDocument(document);
121
			fViewer.setUndoManager(new TextViewerUndoManager(10));
121
			fViewer.setUndoManager(new TextViewerUndoManager(10));
122
			fViewer.getUndoManager().connect(fViewer);
122
			fViewer.getUndoManager().connect(fViewer);
Lines 132-140 Link Here
132
			gd.heightHint = fPage.convertHeightInCharsToPixels(10);
132
			gd.heightHint = fPage.convertHeightInCharsToPixels(10);
133
			gd.widthHint = fPage.convertWidthInCharsToPixels(40);
133
			gd.widthHint = fPage.convertWidthInCharsToPixels(40);
134
			fViewer.getControl().setLayoutData(gd);
134
			fViewer.getControl().setLayoutData(gd);
135
			document.set(condition);
136
			valueChanged();
137
			
138
			fHandler = new AbstractHandler() {
135
			fHandler = new AbstractHandler() {
139
				public Object execute(ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
136
				public Object execute(ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
140
					fViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
137
					fViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
Lines 194-204 Link Here
194
	 * Handle that the value changed
191
	 * Handle that the value changed
195
	 */
192
	 */
196
	protected void valueChanged() {
193
	protected void valueChanged() {
197
		refreshValidState();
198
		String newValue = fViewer.getDocument().get();
194
		String newValue = fViewer.getDocument().get();
199
		if (!newValue.equals(fOldValue)) {
195
		if (!newValue.equals(fOldValue)) {
200
			fOldValue = newValue;
196
			fOldValue = newValue;
201
		}
197
		}
198
		refreshValidState();
202
	}
199
	}
203
	
200
	
204
	/**
201
	/**

Return to bug 135658