001: /*******************************************************************************
002: * Copyright (c) 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: ******************************************************************************/package org.eclipse.ui.internal.keys;
011:
012: import org.eclipse.swt.SWT;
013: import org.eclipse.swt.layout.GridData;
014: import org.eclipse.swt.layout.GridLayout;
015: import org.eclipse.swt.widgets.Button;
016: import org.eclipse.swt.widgets.Composite;
017: import org.eclipse.swt.widgets.Control;
018: import org.eclipse.swt.widgets.Shell;
019: import org.eclipse.ui.preferences.ViewSettingsDialog;
020:
021: /**
022: * Creates a dialog box for applying filter selection of When combo box in
023: * NewKeysPreferencePage
024: *
025: * @since 3.3
026: *
027: */
028: public class KeysPreferenceFiltersDialog extends ViewSettingsDialog {
029:
030: private Button actionSetFilterCheckBox;
031: private Button internalFilterCheckBox;
032: private Button uncategorizedFilterCheckBox;
033:
034: private boolean filterActionSet;
035: private boolean filterInternal;
036: private boolean filterUncategorized;
037:
038: void setFilterActionSet(boolean b) {
039: filterActionSet = b;
040: }
041:
042: void setFilterInternal(boolean b) {
043: filterInternal = b;
044: }
045:
046: void setFilterUncategorized(boolean b) {
047: filterUncategorized = b;
048: }
049:
050: boolean getFilterActionSet() {
051: return filterActionSet;
052: }
053:
054: boolean getFilterInternal() {
055: return filterInternal;
056: }
057:
058: boolean getFilterUncategorized() {
059: return filterUncategorized;
060: }
061:
062: /**
063: * @param parentShell
064: */
065: public KeysPreferenceFiltersDialog(Shell parentShell) {
066: super (parentShell);
067: }
068:
069: /*
070: * (non-Javadoc)
071: *
072: * @see org.eclipse.ui.preferences.ViewSettingsDialog#performDefaults()
073: */
074: protected void performDefaults() {
075: actionSetFilterCheckBox.setSelection(true);
076: internalFilterCheckBox.setSelection(true);
077: uncategorizedFilterCheckBox.setSelection(true);
078: super .performDefaults();
079: }
080:
081: /*
082: * (non-Javadoc)
083: *
084: * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
085: */
086: protected Control createDialogArea(Composite parent) {
087: Composite topComposite = (Composite) super
088: .createDialogArea(parent);
089: GridLayout layout = new GridLayout(1, false);
090: topComposite.setLayout(layout);
091: topComposite.setLayoutData(new GridData(
092: GridData.GRAB_HORIZONTAL));
093: actionSetFilterCheckBox = new Button(topComposite, SWT.CHECK);
094: actionSetFilterCheckBox
095: .setText(NewKeysPreferenceMessages.ActionSetFilterCheckBox_Text);
096: internalFilterCheckBox = new Button(topComposite, SWT.CHECK);
097: internalFilterCheckBox
098: .setText(NewKeysPreferenceMessages.InternalFilterCheckBox_Text);
099: uncategorizedFilterCheckBox = new Button(topComposite,
100: SWT.CHECK);
101: uncategorizedFilterCheckBox
102: .setText(NewKeysPreferenceMessages.UncategorizedFilterCheckBox_Text);
103:
104: actionSetFilterCheckBox.setSelection(filterActionSet);
105: internalFilterCheckBox.setSelection(filterInternal);
106: uncategorizedFilterCheckBox.setSelection(filterUncategorized);
107: applyDialogFont(topComposite);
108:
109: return topComposite;
110: }
111:
112: /*
113: * (non-Javadoc)
114: *
115: * @see org.eclipse.jface.dialogs.Dialog#okPressed()
116: */
117: protected void okPressed() {
118: filterActionSet = actionSetFilterCheckBox.getSelection();
119: filterInternal = internalFilterCheckBox.getSelection();
120: filterUncategorized = uncategorizedFilterCheckBox
121: .getSelection();
122: super .okPressed();
123: }
124:
125: /*
126: * (non-Javadoc)
127: *
128: * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
129: */
130: protected void configureShell(Shell newShell) {
131: super.configureShell(newShell);
132: newShell
133: .setText(NewKeysPreferenceMessages.KeysPreferenceFilterDialog_Title);
134: }
135:
136: }
|