KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > R21ViewStackPresentation


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 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 package org.eclipse.ui.internal.presentations;
12
13 import org.eclipse.jface.preference.IPreferenceStore;
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.ui.internal.IPreferenceConstants;
17 import org.eclipse.ui.internal.WorkbenchPlugin;
18 import org.eclipse.ui.internal.presentations.r21.R21PresentationMessages;
19 import org.eclipse.ui.internal.presentations.r21.widgets.CTabFolderEvent;
20 import org.eclipse.ui.internal.presentations.r21.widgets.R21PaneFolder;
21 import org.eclipse.ui.internal.presentations.r21.widgets.R21PaneFolderButtonListener;
22 import org.eclipse.ui.presentations.IStackPresentationSite;
23
24 /**
25  * Controls the appearance of views stacked into the workbench.
26  *
27  * @since 3.0
28  */

29 public class R21ViewStackPresentation extends R21BasicStackPresentation {
30
31     private static IPreferenceStore preferenceStore = WorkbenchPlugin.getDefault()
32             .getPreferenceStore();
33
34     // don't reset this dynamically, so just keep the information static.
35
// see bug:
36
// 75422 [Presentations] Switching presentation to R21 switches immediately, but only partially
37
private static int tabPos = preferenceStore.getInt(IPreferenceConstants.VIEW_TAB_POSITION);
38   
39     private R21PaneFolderButtonListener showListListener = new R21PaneFolderButtonListener() {
40
41         public void showList(CTabFolderEvent event) {
42             event.doit = false;
43             showListDefaultLocation();
44         }
45     };
46
47     /**
48      * Create a new view stack presentation.
49      *
50      * @param parent
51      * @param newSite
52      */

53     public R21ViewStackPresentation(Composite parent,
54             IStackPresentationSite newSite) {
55
56         super(new R21PaneFolder(parent, SWT.BORDER), newSite);
57         R21PaneFolder tabFolder = getPaneFolder();
58
59         tabFolder.addButtonListener(showListListener);
60
61         tabFolder.setTabPosition(tabPos);
62         updateGradient();
63     }
64
65     /* (non-Javadoc)
66      * @see org.eclipse.ui.internal.skins.Presentation#setActive(boolean)
67      */

68     public void setActive(boolean isActive) {
69         super.setActive(isActive);
70
71         updateGradient();
72     }
73
74     /* (non-Javadoc)
75      * @see org.eclipse.ui.internal.presentations.DefaultPartPresentation#getPartMenu()
76      */

77     protected String JavaDoc getPaneName() {
78         return R21PresentationMessages.getString("ViewPane.moveView"); //$NON-NLS-1$
79
}
80 }
81
Popular Tags