KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > browser > ui > editors > searchresult > ShowQuickFilterAction


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20
21 package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
22
23
24 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
25 import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
26 import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
27 import org.eclipse.jface.action.Action;
28 import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
29
30
31 public class ShowQuickFilterAction extends Action
32 {
33
34     public static final String JavaDoc SHOW_QUICKFILTER_DIALOGSETTING_KEY = ShowQuickFilterAction.class.getName()
35         + ".showQuickFilter";
36
37     private SearchResultEditorQuickFilterWidget quickFilterWidget;
38
39
40     public ShowQuickFilterAction( SearchResultEditorQuickFilterWidget quickFilterWidget )
41     {
42         super( "Show Quick Filter", AS_CHECK_BOX );
43         super.setToolTipText( "Show Quick Filter" );
44         super.setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor( BrowserCommonConstants.IMG_FILTER ) );
45         super.setActionDefinitionId( IWorkbenchActionDefinitionIds.FIND_REPLACE );
46         super.setEnabled( true );
47
48         this.quickFilterWidget = quickFilterWidget;
49
50         if ( BrowserUIPlugin.getDefault().getDialogSettings().get( SHOW_QUICKFILTER_DIALOGSETTING_KEY ) == null )
51         {
52             BrowserUIPlugin.getDefault().getDialogSettings().put( SHOW_QUICKFILTER_DIALOGSETTING_KEY, false );
53         }
54         super.setChecked( BrowserUIPlugin.getDefault().getDialogSettings().getBoolean(
55             SHOW_QUICKFILTER_DIALOGSETTING_KEY ) );
56         this.quickFilterWidget.setActive( super.isChecked() );
57     }
58
59
60     public void run()
61     {
62
63         boolean checked = super.isChecked();
64         super.setChecked( !checked );
65
66         BrowserUIPlugin.getDefault().getDialogSettings().put( SHOW_QUICKFILTER_DIALOGSETTING_KEY, super.isChecked() );
67
68         if ( this.quickFilterWidget != null )
69         {
70             this.quickFilterWidget.setActive( super.isChecked() );
71         }
72     }
73
74
75     public void setChecked( boolean checked )
76     {
77         // super.setChecked(checked);
78
}
79
80
81     public boolean isChecked()
82     {
83         return super.isChecked();
84     }
85
86
87     public void dispose()
88     {
89         this.quickFilterWidget = null;
90     }
91
92 }
93
Popular Tags