01: /*******************************************************************************
02: * Copyright (c) 2006, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.presentations.r33;
11:
12: import org.eclipse.jface.preference.IPreferenceStore;
13: import org.eclipse.swt.SWT;
14: import org.eclipse.swt.widgets.Composite;
15: import org.eclipse.ui.IWorkbenchPreferenceConstants;
16: import org.eclipse.ui.PlatformUI;
17: import org.eclipse.ui.internal.IPreferenceConstants;
18: import org.eclipse.ui.internal.WorkbenchPlugin;
19: import org.eclipse.ui.internal.presentations.util.PresentablePartFolder;
20: import org.eclipse.ui.internal.presentations.util.StandardViewSystemMenu;
21: import org.eclipse.ui.internal.presentations.util.TabbedStackPresentation;
22: import org.eclipse.ui.presentations.IStackPresentationSite;
23: import org.eclipse.ui.presentations.StackPresentation;
24: import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
25:
26: /**
27: * The is a stub implementation which allows clients to choose the new 3.3
28: * 'look'. Currently this includes the new min/max behaviour as well as an image
29: * based animation feedback mechanism.
30: *
31: * @since 3.3
32: *
33: */
34: public class WorkbenchPresentationFactory_33 extends
35: WorkbenchPresentationFactory {
36:
37: private static int viewTabPosition = WorkbenchPlugin.getDefault()
38: .getPreferenceStore().getInt(
39: IPreferenceConstants.VIEW_TAB_POSITION);
40:
41: /**
42: * Default to the superclass
43: */
44: public WorkbenchPresentationFactory_33() {
45: super ();
46: }
47:
48: /*
49: * (non-Javadoc)
50: *
51: * @see org.eclipse.ui.presentations.WorkbenchPresentationFactory#createViewPresentation(org.eclipse.swt.widgets.Composite,
52: * org.eclipse.ui.presentations.IStackPresentationSite)
53: */
54: public StackPresentation createViewPresentation(Composite parent,
55: IStackPresentationSite site) {
56:
57: DefaultTabFolder folder = new DefaultTabFolder(
58: parent,
59: viewTabPosition | SWT.BORDER,
60: site
61: .supportsState(IStackPresentationSite.STATE_MINIMIZED),
62: site
63: .supportsState(IStackPresentationSite.STATE_MAXIMIZED));
64:
65: final IPreferenceStore store = PlatformUI.getPreferenceStore();
66: final int minimumCharacters = store
67: .getInt(IWorkbenchPreferenceConstants.VIEW_MINIMUM_CHARACTERS);
68: if (minimumCharacters >= 0) {
69: folder.setMinimumCharacters(minimumCharacters);
70: }
71:
72: PresentablePartFolder partFolder = new PresentablePartFolder(
73: folder);
74:
75: folder.setUnselectedCloseVisible(false);
76: folder.setUnselectedImageVisible(true);
77:
78: TabbedStackPresentation result = new TabbedStackPresentation(
79: site, partFolder, new StandardViewSystemMenu(site));
80:
81: DefaultThemeListener themeListener = new DefaultThemeListener(
82: folder, result.getTheme());
83: result.getTheme().addListener(themeListener);
84:
85: new DefaultSimpleTabListener(
86: result.getApiPreferences(),
87: IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
88: folder);
89:
90: return result;
91: }
92:
93: }
|