KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > ApplicationWorkbenchWindowAdvisor


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;
22
23
24 import org.eclipse.swt.graphics.Point;
25 import org.eclipse.ui.application.ActionBarAdvisor;
26 import org.eclipse.ui.application.IActionBarConfigurer;
27 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
28 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
29
30
31 /**
32  * The workbench window advisor object is created in response to a workbench window
33  * being created (one per window), and is used to configure the window.<br />
34  * <br />
35  * The following advisor methods are called at strategic points in the workbench window's
36  * lifecycle (as with the workbench advisor, all occur within the dynamic scope of the call
37  * to PlatformUI.createAndRunWorkbench):<br />
38  * <br />
39  * - preWindowOpen - called as the window is being opened; use to configure aspects of the
40  * window other than actions bars<br />
41  * - postWindowRestore - called after the window has been recreated from a previously saved
42  * state; use to adjust the restored window<br />
43  * - postWindowCreate - called after the window has been created, either from an initial
44  * state or from a restored state; used to adjust the window<br />
45  * - openIntro - called immediately before the window is opened in order to create the
46  * introduction component, if any.<br />
47  * - postWindowOpen - called after the window has been opened; use to hook window listeners,
48  * etc.<br />
49  * - preWindowShellClose - called when the window's shell is closed by the user; use to
50  * pre-screen window closings
51  *
52  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
53  */

54 public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
55 {
56
57     /**
58      * Default constructor
59      * @param configurer
60      * an object for configuring the workbench window
61      */

62     public ApplicationWorkbenchWindowAdvisor( IWorkbenchWindowConfigurer configurer )
63     {
64         super( configurer );
65     }
66
67
68     /**
69      * Creates a new action bar advisor to configure the action bars of the window via
70      * the given action bar configurer. The default implementation returns a new instance
71      * of ActionBarAdvisor.
72      */

73     public ActionBarAdvisor createActionBarAdvisor( IActionBarConfigurer configurer )
74     {
75         return new ApplicationActionBarAdvisor( configurer );
76     }
77
78
79     /**
80      * Performs arbitrary actions before the window is opened.<br />
81      * <br />
82      * This method is called before the window's controls have been created. Clients must
83      * not call this method directly (although super calls are okay). The default
84      * implementation does nothing. Subclasses may override. Typical clients will use the
85      * window configurer to tweak the workbench window in an application-specific way;
86      * however, filling the window's menu bar, tool bar, and status line must be done in
87      * ActionBarAdvisor.fillActionBars, which is called immediately after this method is
88      * called.
89      */

90     public void preWindowOpen()
91     {
92         IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
93         configurer.setInitialSize( new Point( 1000, 660 ) );
94         configurer.setShowCoolBar( true );
95         configurer.setShowStatusLine( false );
96         configurer.setShowPerspectiveBar( true );
97         configurer.setShowProgressIndicator( true );
98     }
99
100 }
101
Popular Tags