|
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) { |