KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > browser > ui > views > modificationlogs > ModificationLogsView


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.views.modificationlogs;
22
23
24 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
25 import org.apache.directory.ldapstudio.ldifeditor.widgets.LdifEditorWidget;
26 import org.eclipse.swt.SWT;
27 import org.eclipse.swt.layout.GridData;
28 import org.eclipse.swt.layout.GridLayout;
29 import org.eclipse.swt.widgets.Composite;
30 import org.eclipse.ui.PlatformUI;
31 import org.eclipse.ui.part.ViewPart;
32
33
34 /**
35  * The ModificationLogsView displays all modifications applied
36  * to a connection using LDIF change format.
37  *
38  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
39  * @version $Rev$, $Date$
40  */

41 public class ModificationLogsView extends ViewPart
42 {
43
44     /** The action group. */
45     private ModificationLogsViewActionGroup actionGroup;
46
47     /** The main widget. */
48     private LdifEditorWidget mainWidget;
49
50     /** The universal listener. */
51     private ModificationLogsViewUniversalListener universalListener;
52
53
54     /**
55      * Gets the id.
56      *
57      * @return the id
58      */

59     public static String JavaDoc getId()
60     {
61         return ModificationLogsView.class.getName();
62     }
63
64
65     /**
66      * Creates a new instance of ModificationLogsView.
67      */

68     public ModificationLogsView()
69     {
70         super();
71     }
72
73
74     /**
75      * {@inheritDoc}
76      */

77     public void setFocus()
78     {
79         mainWidget.getSourceViewer().getTextWidget().setFocus();
80     }
81
82
83     /**
84      * {@inheritDoc}
85      */

86     public void dispose()
87     {
88         if ( mainWidget != null )
89         {
90             actionGroup.dispose();
91             actionGroup = null;
92             universalListener.dispose();
93             universalListener = null;
94             mainWidget.dispose();
95             mainWidget = null;
96         }
97         super.dispose();
98     }
99
100
101     /**
102      * {@inheritDoc}
103      */

104     public void createPartControl( Composite parent )
105     {
106         Composite composite = new Composite( parent, SWT.NONE );
107         composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
108         GridLayout layout = new GridLayout();
109         layout.marginWidth = 0;
110         layout.marginHeight = 0;
111         composite.setLayout( layout );
112
113         // create main widget
114
mainWidget = new LdifEditorWidget( null, "", false );
115         mainWidget.createWidget( composite );
116         mainWidget.getSourceViewer().setEditable( false );
117
118         // create actions and context menu (and register global actions)
119
actionGroup = new ModificationLogsViewActionGroup( this );
120         actionGroup.fillActionBars( getViewSite().getActionBars() );
121         // this.actionGroup.fillContextMenu(this.configuration.getContextMenuManager(this.mainWidget.getViewer()));
122

123         // create the listener
124
universalListener = new ModificationLogsViewUniversalListener( this );
125
126         // set help context
127
PlatformUI.getWorkbench().getHelpSystem().setHelp( mainWidget.getSourceViewer().getTextWidget(),
128             BrowserUIPlugin.PLUGIN_ID + "." + "tools_modification_logs_view" );
129     }
130
131
132     /**
133      * Gets the main widget.
134      *
135      * @return the main widget
136      */

137     public LdifEditorWidget getMainWidget()
138     {
139         return mainWidget;
140     }
141
142
143     /**
144      * Gets the universal listener.
145      *
146      * @return the universal listener
147      */

148     public ModificationLogsViewUniversalListener getUniversalListener()
149     {
150         return universalListener;
151     }
152
153
154     /**
155      * Gets the action group.
156      *
157      * @return the action group
158      */

159     public ModificationLogsViewActionGroup getActionGroup()
160     {
161         return actionGroup;
162     }
163
164 }
165
Popular Tags