KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > keys > KeysPreferenceFiltersDialog


1 /*******************************************************************************
2  * Copyright (c) 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
12 package org.eclipse.ui.internal.keys;
13
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.layout.GridData;
16 import org.eclipse.swt.layout.GridLayout;
17 import org.eclipse.swt.widgets.Button;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.swt.widgets.Control;
20 import org.eclipse.swt.widgets.Shell;
21 import org.eclipse.ui.preferences.ViewSettingsDialog;
22
23 /**
24  * Creates a dialog box for applying filter selection of When combo box in
25  * NewKeysPreferencePage
26  *
27  * @since 3.3
28  *
29  */

30 public class KeysPreferenceFiltersDialog extends ViewSettingsDialog {
31
32     private Button actionSetFilterCheckBox;
33     private Button internalFilterCheckBox;
34     private Button uncategorizedFilterCheckBox;
35
36     private boolean filterActionSet;
37     private boolean filterInternal;
38     private boolean filterUncategorized;
39
40     void setFilterActionSet(boolean b) {
41         filterActionSet = b;
42     }
43
44     void setFilterInternal(boolean b) {
45         filterInternal = b;
46     }
47     
48     void setFilterUncategorized(boolean b) {
49         filterUncategorized = b;
50     }
51
52     boolean getFilterActionSet() {
53         return filterActionSet;
54     }
55
56     boolean getFilterInternal() {
57         return filterInternal;
58     }
59     
60     boolean getFilterUncategorized() {
61         return filterUncategorized;
62     }
63
64     /**
65      * @param parentShell
66      */

67     public KeysPreferenceFiltersDialog(Shell parentShell) {
68         super(parentShell);
69     }
70
71     /*
72      * (non-Javadoc)
73      *
74      * @see org.eclipse.ui.preferences.ViewSettingsDialog#performDefaults()
75      */

76     protected void performDefaults() {
77         actionSetFilterCheckBox.setSelection(true);
78         internalFilterCheckBox.setSelection(true);
79         uncategorizedFilterCheckBox.setSelection(true);
80         super.performDefaults();
81     }
82
83     /*
84      * (non-Javadoc)
85      *
86      * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
87      */

88     protected Control createDialogArea(Composite parent) {
89         Composite topComposite = (Composite) super.createDialogArea(parent);
90         GridLayout layout = new GridLayout(1, false);
91         topComposite.setLayout(layout);
92         topComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
93         actionSetFilterCheckBox = new Button(topComposite, SWT.CHECK);
94         actionSetFilterCheckBox
95                 .setText(NewKeysPreferenceMessages.ActionSetFilterCheckBox_Text);
96         internalFilterCheckBox = new Button(topComposite, SWT.CHECK);
97         internalFilterCheckBox
98                 .setText(NewKeysPreferenceMessages.InternalFilterCheckBox_Text);
99         uncategorizedFilterCheckBox = new Button(topComposite, SWT.CHECK);
100         uncategorizedFilterCheckBox
101                 .setText(NewKeysPreferenceMessages.UncategorizedFilterCheckBox_Text);
102
103         actionSetFilterCheckBox.setSelection(filterActionSet);
104         internalFilterCheckBox.setSelection(filterInternal);
105         uncategorizedFilterCheckBox.setSelection(filterUncategorized);
106         applyDialogFont(topComposite);
107
108         return topComposite;
109     }
110
111     /*
112      * (non-Javadoc)
113      *
114      * @see org.eclipse.jface.dialogs.Dialog#okPressed()
115      */

116     protected void okPressed() {
117         filterActionSet = actionSetFilterCheckBox.getSelection();
118         filterInternal = internalFilterCheckBox.getSelection();
119         filterUncategorized = uncategorizedFilterCheckBox.getSelection();
120         super.okPressed();
121     }
122
123     /*
124      * (non-Javadoc)
125      *
126      * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
127      */

128     protected void configureShell(Shell newShell) {
129         super.configureShell(newShell);
130         newShell
131                 .setText(NewKeysPreferenceMessages.KeysPreferenceFilterDialog_Title);
132     }
133
134 }
135
Popular Tags