KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > r33 > WorkbenchPresentationFactory_33


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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
12 package org.eclipse.ui.internal.presentations.r33;
13
14 import org.eclipse.jface.preference.IPreferenceStore;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.ui.IWorkbenchPreferenceConstants;
18 import org.eclipse.ui.PlatformUI;
19 import org.eclipse.ui.internal.IPreferenceConstants;
20 import org.eclipse.ui.internal.WorkbenchPlugin;
21 import org.eclipse.ui.internal.presentations.util.PresentablePartFolder;
22 import org.eclipse.ui.internal.presentations.util.StandardViewSystemMenu;
23 import org.eclipse.ui.internal.presentations.util.TabbedStackPresentation;
24 import org.eclipse.ui.presentations.IStackPresentationSite;
25 import org.eclipse.ui.presentations.StackPresentation;
26 import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
27
28 /**
29  * The is a stub implementation which allows clients to choose the new 3.3
30  * 'look'. Currently this includes the new min/max behaviour as well as an image
31  * based animation feedback mechanism.
32  *
33  * @since 3.3
34  *
35  */

36 public class WorkbenchPresentationFactory_33 extends
37         WorkbenchPresentationFactory {
38
39     private static int viewTabPosition = WorkbenchPlugin.getDefault()
40             .getPreferenceStore()
41             .getInt(IPreferenceConstants.VIEW_TAB_POSITION);
42
43     /**
44      * Default to the superclass
45      */

46     public WorkbenchPresentationFactory_33() {
47         super();
48     }
49
50     /*
51      * (non-Javadoc)
52      *
53      * @see org.eclipse.ui.presentations.WorkbenchPresentationFactory#createViewPresentation(org.eclipse.swt.widgets.Composite,
54      * org.eclipse.ui.presentations.IStackPresentationSite)
55      */

56     public StackPresentation createViewPresentation(Composite parent,
57             IStackPresentationSite site) {
58
59         DefaultTabFolder folder = new DefaultTabFolder(parent, viewTabPosition
60                 | SWT.BORDER, site
61                 .supportsState(IStackPresentationSite.STATE_MINIMIZED), site
62                 .supportsState(IStackPresentationSite.STATE_MAXIMIZED));
63
64         final IPreferenceStore store = PlatformUI.getPreferenceStore();
65         final int minimumCharacters = store
66                 .getInt(IWorkbenchPreferenceConstants.VIEW_MINIMUM_CHARACTERS);
67         if (minimumCharacters >= 0) {
68             folder.setMinimumCharacters(minimumCharacters);
69         }
70
71         PresentablePartFolder partFolder = new PresentablePartFolder(folder);
72
73         folder.setUnselectedCloseVisible(false);
74         folder.setUnselectedImageVisible(true);
75
76         TabbedStackPresentation result = new TabbedStackPresentation(site,
77                 partFolder, new StandardViewSystemMenu(site));
78
79         DefaultThemeListener themeListener = new DefaultThemeListener(folder,
80                 result.getTheme());
81         result.getTheme().addListener(themeListener);
82
83         new DefaultSimpleTabListener(result.getApiPreferences(),
84                 IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
85                 folder);
86
87         return result;
88     }
89
90 }
91
Popular Tags