Source Code Cross Referenced for ViewStack.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » internal » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » ui workbench » org.eclipse.ui.internal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *     Cagatay Kavukcuoglu <cagatayk@acm.org>
011:         *     - Fix for bug 10025 - Resizing views should not use height ratios
012:         *******************************************************************************/package org.eclipse.ui.internal;
013:
014:        import org.eclipse.jface.action.IMenuManager;
015:        import org.eclipse.ui.internal.presentations.PresentablePart;
016:        import org.eclipse.ui.internal.presentations.PresentationFactoryUtil;
017:        import org.eclipse.ui.internal.presentations.SystemMenuDetach;
018:        import org.eclipse.ui.internal.presentations.SystemMenuFastView;
019:        import org.eclipse.ui.internal.presentations.SystemMenuSize;
020:        import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem;
021:        import org.eclipse.ui.presentations.AbstractPresentationFactory;
022:        import org.eclipse.ui.presentations.IPresentablePart;
023:        import org.eclipse.ui.presentations.IStackPresentationSite;
024:        import org.eclipse.ui.presentations.StackPresentation;
025:
026:        /**
027:         * Manages a set of ViewPanes that are docked into the workbench window. The container for a ViewStack
028:         * is always a PartSashContainer (or null), and its children are always either PartPlaceholders or ViewPanes.
029:         * This contains the real behavior and state for stacks of views, although the widgets for the tabs are contributed
030:         * using a StackPresentation.
031:         *
032:         * TODO: eliminate ViewStack and EditorStack. PartStack should be general enough to handle editors
033:         * and views without any specialization for editors and views. The differences should be in the
034:         * presentation and in the PartPanes themselves.
035:         *
036:         * TODO: eliminate PartPlaceholder. Placeholders should not be children of the ViewStack.
037:         *
038:         */
039:        public class ViewStack extends PartStack {
040:
041:            private boolean allowStateChanges;
042:
043:            private WorkbenchPage page;
044:
045:            private SystemMenuSize sizeItem = new SystemMenuSize(null);
046:
047:            private SystemMenuFastView fastViewAction;
048:
049:            private SystemMenuDetach detachViewAction;
050:
051:            public void addSystemActions(IMenuManager menuManager) {
052:                appendToGroupIfPossible(
053:                        menuManager,
054:                        "misc", new UpdatingActionContributionItem(fastViewAction)); //$NON-NLS-1$
055:                appendToGroupIfPossible(
056:                        menuManager,
057:                        "misc", new UpdatingActionContributionItem(detachViewAction)); //$NON-NLS-1$
058:                sizeItem = new SystemMenuSize(getSelection());
059:                appendToGroupIfPossible(menuManager, "size", sizeItem); //$NON-NLS-1$
060:            }
061:
062:            public ViewStack(WorkbenchPage page) {
063:                this (page, true);
064:            }
065:
066:            public ViewStack(WorkbenchPage page, boolean allowsStateChanges) {
067:                this (page, allowsStateChanges,
068:                        PresentationFactoryUtil.ROLE_VIEW, null);
069:            }
070:
071:            public ViewStack(WorkbenchPage page, boolean allowsStateChanges,
072:                    int appearance, AbstractPresentationFactory factory) {
073:                super (appearance, factory);
074:
075:                this .page = page;
076:                setID(this .toString());
077:                // Each folder has a unique ID so relative positioning is unambiguous.
078:
079:                this .allowStateChanges = allowsStateChanges;
080:                fastViewAction = new SystemMenuFastView(getPresentationSite());
081:                detachViewAction = new SystemMenuDetach(getPresentationSite());
082:            }
083:
084:            protected WorkbenchPage getPage() {
085:                return page;
086:            }
087:
088:            protected boolean canMoveFolder() {
089:                Perspective perspective = page.getActivePerspective();
090:
091:                if (perspective == null) {
092:                    // Shouldn't happen -- can't have a ViewStack without a
093:                    // perspective
094:                    return false;
095:                }
096:
097:                // We need to search if one of the presentations is not moveable
098:                // if that's the case the whole folder should not be moveable
099:                IStackPresentationSite presenationSite;
100:
101:                if ((presenationSite = getPresentationSite()) != null) {
102:                    IPresentablePart[] parts = presenationSite.getPartList();
103:                    for (int i = 0; i < parts.length; i++) {
104:                        if (!presenationSite.isPartMoveable(parts[i])) {
105:                            return false;
106:                        }
107:                    }
108:                }
109:
110:                return !perspective.isFixedLayout();
111:            }
112:
113:            protected void updateActions(PresentablePart current) {
114:                ViewPane pane = null;
115:
116:                if (current != null && current.getPane() instanceof  ViewPane) {
117:                    pane = (ViewPane) current.getPane();
118:                }
119:
120:                fastViewAction.setPane(current);
121:                detachViewAction.setPane(pane);
122:                sizeItem.setPane(pane);
123:            }
124:
125:            /**
126:             * Sets the minimized state for this stack. The part may call this method to
127:             * minimize or restore itself. The minimized state only affects the view
128:             * when unzoomed.
129:             *
130:             * This implementation is specific to the 3.3 presentation's
131:             * min/max story; otherwise it just forwards the call.
132:             */
133:            public void setMinimized(boolean minimized) {
134:                // 'Smart' minimize; move the stack to the trim
135:                Perspective persp = getPage().getActivePerspective();
136:                if (Perspective.useNewMinMax(persp)) {
137:                    FastViewManager fvm = persp.getFastViewManager();
138:                    if (minimized) {
139:                        fvm.moveToTrim(this , false);
140:                    } else {
141:                        // First, if we're maximized then revert
142:                        if (persp.getPresentation().getMaximizedStack() != null) {
143:                            PartStack maxStack = persp.getPresentation()
144:                                    .getMaximizedStack();
145:                            if (maxStack != null) {
146:                                maxStack
147:                                        .setState(IStackPresentationSite.STATE_RESTORED);
148:                            }
149:                        }
150:
151:                        fvm.restoreToPresentation(getID());
152:                    }
153:                }
154:
155:                super .setMinimized(minimized);
156:            }
157:
158:            /* (non-Javadoc)
159:             * @see org.eclipse.ui.internal.PartStack#isMoveable(org.eclipse.ui.presentations.IPresentablePart)
160:             */
161:            protected boolean isMoveable(IPresentablePart part) {
162:                ViewPane pane = (ViewPane) getPaneFor(part);
163:                Perspective perspective = page.getActivePerspective();
164:                if (perspective == null) {
165:                    // Shouldn't happen -- can't have a ViewStack without a
166:                    // perspective
167:                    return true;
168:                }
169:                return perspective.isMoveable(pane.getViewReference());
170:            }
171:
172:            /* (non-Javadoc)
173:             * @see org.eclipse.ui.internal.PartStack#supportsState(int)
174:             */
175:            protected boolean supportsState(int newState) {
176:                if (page.isFixedLayout()) {
177:                    return false;
178:                }
179:                return allowStateChanges;
180:            }
181:
182:            /* (non-Javadoc)
183:             * @see org.eclipse.ui.internal.PartStack#derefPart(org.eclipse.ui.internal.LayoutPart)
184:             */
185:            protected void derefPart(LayoutPart toDeref) {
186:                page.getActivePerspective().getPresentation()
187:                        .derefPart(toDeref);
188:            }
189:
190:            /* (non-Javadoc)
191:             * @see org.eclipse.ui.internal.PartStack#allowsDrop(org.eclipse.ui.internal.PartPane)
192:             */
193:            protected boolean allowsDrop(PartPane part) {
194:                return part instanceof  ViewPane;
195:            }
196:
197:            /**
198:             * Get the presentation for testing purposes.  This is for testing
199:             * purposes <b>ONLY</b>.
200:             *
201:             * @return the presentation in use for this view stack
202:             * @since 3.2
203:             */
204:            public StackPresentation getTestPresentation() {
205:                return getPresentation();
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.