KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > propertypages > JavaBreakpointAdvancedPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.ui.propertypages;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.jdt.debug.core.IJavaBreakpoint;
15 import org.eclipse.jdt.debug.core.IJavaObject;
16 import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds;
17 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.layout.GridData;
20 import org.eclipse.swt.layout.GridLayout;
21 import org.eclipse.swt.widgets.Composite;
22 import org.eclipse.swt.widgets.Control;
23 import org.eclipse.ui.PlatformUI;
24 import org.eclipse.ui.dialogs.PropertyPage;
25
26 /**
27  *
28  */

29 public class JavaBreakpointAdvancedPage extends PropertyPage {
30
31     ThreadFilterEditor fThreadFilterEditor;
32     InstanceFilterEditor fInstanceFilterEditor;
33
34     /**
35      * @see org.eclipse.jface.preference.IPreferencePage#performOk()
36      */

37     public boolean performOk() {
38         doStore();
39         return super.performOk();
40     }
41
42     /**
43      * Stores the values configured in this page.
44      */

45     protected void doStore() {
46         fThreadFilterEditor.doStore();
47         if (fInstanceFilterEditor != null) {
48             fInstanceFilterEditor.doStore();
49         }
50     }
51
52     /**
53      * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
54      */

55     protected Control createContents(Composite parent) {
56         noDefaultAndApplyButton();
57         Composite mainComposite = new Composite(parent, SWT.NONE);
58         mainComposite.setFont(parent.getFont());
59         mainComposite.setLayout(new GridLayout());
60         mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
61         createThreadFilterEditor(mainComposite);
62         createTypeSpecificEditors(mainComposite);
63         createInstanceFilterEditor(mainComposite);
64         setValid(true);
65         return mainComposite;
66     }
67     
68     public void createInstanceFilterEditor(Composite parent) {
69         IJavaBreakpoint breakpoint= getBreakpoint();
70         try {
71             IJavaObject[] instances = breakpoint.getInstanceFilters();
72             if (instances.length > 0) {
73                 fInstanceFilterEditor= new InstanceFilterEditor(parent, breakpoint);
74             }
75         } catch (CoreException e) {
76             JDIDebugUIPlugin.log(e);
77         }
78     }
79
80     /**
81      * Allow subclasses to create type-specific editors.
82      * @param parent
83      */

84     protected void createTypeSpecificEditors(Composite parent) {
85         // Do nothing.
86
}
87
88     protected void createThreadFilterEditor(Composite parent) {
89         fThreadFilterEditor = new ThreadFilterEditor(parent, this);
90     }
91
92     public IJavaBreakpoint getBreakpoint() {
93         return (IJavaBreakpoint) getElement();
94     }
95
96     /* (non-Javadoc)
97      * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite)
98      */

99     public void createControl(Composite parent) {
100         super.createControl(parent);
101         PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaDebugHelpContextIds.JAVA_BREAKPOINT_ADVANCED_PROPERTY_PAGE);
102     }
103 }
104
Popular Tags