Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 12019 Details for
Bug 62218
[Presentations] [R21PRES] The R21 presentation needs to serialize its tab order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to fix this
patch.txt (text/plain), 8.80 KB, created by
Gunnar Wagenknecht
on 2004-06-14 08:50:51 EDT
(
hide
)
Description:
Patch to fix this
Filename:
MIME Type:
Creator:
Gunnar Wagenknecht
Created:
2004-06-14 08:50:51 EDT
Size:
8.80 KB
patch
obsolete
>Index: src/org/eclipse/ui/internal/presentations/R21BasicStackPresentation.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21BasicStackPresentation.java,v >retrieving revision 1.2 >diff -u -r1.2 R21BasicStackPresentation.java >--- src/org/eclipse/ui/internal/presentations/R21BasicStackPresentation.java 9 Jun 2004 18:30:25 -0000 1.2 >+++ src/org/eclipse/ui/internal/presentations/R21BasicStackPresentation.java 14 Jun 2004 12:47:26 -0000 >@@ -11,11 +11,14 @@ > package org.eclipse.ui.internal.presentations; > > import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; > > import org.eclipse.jface.action.GroupMarker; > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.jface.action.MenuManager; > import org.eclipse.jface.action.Separator; >+import org.eclipse.jface.util.Assert; > import org.eclipse.jface.util.Geometry; > import org.eclipse.jface.window.Window; > import org.eclipse.swt.SWT; >@@ -40,7 +43,9 @@ > import org.eclipse.swt.widgets.Shell; > import org.eclipse.swt.widgets.ToolBar; > import org.eclipse.swt.widgets.ToolItem; >+import org.eclipse.ui.IMemento; > import org.eclipse.ui.IPropertyListener; >+import org.eclipse.ui.internal.IWorkbenchConstants; > import org.eclipse.ui.internal.IWorkbenchGraphicConstants; > import org.eclipse.ui.internal.WorkbenchImages; > import org.eclipse.ui.internal.WorkbenchWindow; >@@ -52,6 +57,7 @@ > import org.eclipse.ui.internal.util.Util; > import org.eclipse.ui.presentations.IPartMenu; > import org.eclipse.ui.presentations.IPresentablePart; >+import org.eclipse.ui.presentations.IPresentationSerializer; > import org.eclipse.ui.presentations.IStackPresentationSite; > import org.eclipse.ui.presentations.PresentationUtil; > import org.eclipse.ui.presentations.StackDropResult; >@@ -986,4 +992,60 @@ > setActive(newState == AS_ACTIVE_FOCUS); > } > >+ /** >+ * Restores a presentation from a previously stored state >+ * >+ * @param serializer (not null) >+ * @param savedState (not null) >+ */ >+ public void restoreState(IPresentationSerializer serializer, IMemento savedState) { >+ IMemento[] parts = savedState.getChildren(IWorkbenchConstants.TAG_PART); >+ >+ for (int idx = 0; idx < parts.length; idx++) { >+ String id = parts[idx].getString(IWorkbenchConstants.TAG_ID); >+ >+ if (id != null) { >+ IPresentablePart part = serializer.getPart(id); >+ >+ if (part != null) { >+ addPart(part, getPaneFolder().getItemCount()); >+ } >+ } >+ } >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.StackPresentation#saveState(org.eclipse.ui.presentations.IPresentationSerializer, org.eclipse.ui.IMemento) >+ */ >+ public void saveState(IPresentationSerializer context, IMemento memento) { >+ super.saveState(context, memento); >+ >+ List parts = getPresentableParts(); >+ >+ Iterator iter = parts.iterator(); >+ while (iter.hasNext()) { >+ IPresentablePart next = (IPresentablePart)iter.next(); >+ >+ IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_PART); >+ childMem.putString(IWorkbenchConstants.TAG_ID, context.getId(next)); >+ } >+ } >+ >+ /** >+ * Returns the List of IPresentablePart currently in this presentation >+ */ >+ List getPresentableParts() { >+ Assert.isTrue(!isDisposed()); >+ >+ CTabItem[] items = getPaneFolder().getItems(); >+ List result = new ArrayList(items.length); >+ >+ for (int idx = 0; idx < getPaneFolder().getItemCount(); idx++) { >+ result.add(getPartForTab(items[idx])); >+ } >+ >+ return result; >+ } >+ > } >Index: src/org/eclipse/ui/internal/presentations/R21EditorStackPresentation.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21EditorStackPresentation.java,v >retrieving revision 1.1 >diff -u -r1.1 R21EditorStackPresentation.java >--- src/org/eclipse/ui/internal/presentations/R21EditorStackPresentation.java 7 Jun 2004 13:57:44 -0000 1.1 >+++ src/org/eclipse/ui/internal/presentations/R21EditorStackPresentation.java 14 Jun 2004 12:47:27 -0000 >@@ -11,12 +11,15 @@ > package org.eclipse.ui.internal.presentations; > > import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; > > import org.eclipse.jface.action.GroupMarker; > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.jface.action.MenuManager; > import org.eclipse.jface.action.Separator; > import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.util.Assert; > import org.eclipse.jface.util.Geometry; > import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; >@@ -38,8 +41,10 @@ > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Listener; > import org.eclipse.swt.widgets.Menu; >+import org.eclipse.ui.IMemento; > import org.eclipse.ui.IPropertyListener; > import org.eclipse.ui.internal.IPreferenceConstants; >+import org.eclipse.ui.internal.IWorkbenchConstants; > import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.internal.WorkbenchWindow; > import org.eclipse.ui.internal.dnd.DragUtil; >@@ -51,6 +56,7 @@ > import org.eclipse.ui.internal.presentations.r21.widgets.CTabItem; > import org.eclipse.ui.presentations.IPartMenu; > import org.eclipse.ui.presentations.IPresentablePart; >+import org.eclipse.ui.presentations.IPresentationSerializer; > import org.eclipse.ui.presentations.IStackPresentationSite; > import org.eclipse.ui.presentations.PresentationUtil; > import org.eclipse.ui.presentations.StackDropResult; >@@ -649,14 +655,27 @@ > // Select a location for newly inserted parts > idx = tabFolder.getItemCount(); > } >- >- if (getTab(newPart) != null) { >- return; >- } > >- createPartTab(newPart, idx); >+ addPart(newPart, idx); > } > >+ /** >+ * Adds the given presentable part to this presentation at the given index. >+ * Does nothing if a tab already exists for the given part. >+ * >+ * @param newPart >+ * @param index >+ */ >+ public void addPart(IPresentablePart newPart, int index) { >+ // If we already have a tab for this part, do nothing >+ if (getTab(newPart) != null) { >+ return; >+ } >+ createPartTab(newPart, index); >+ >+ //setControlSize(); >+ } >+ > /* > * (non-Javadoc) > * >@@ -869,4 +888,61 @@ > activeState = newState; > updateGradient(); > } >+ >+ /** >+ * Restores a presentation from a previously stored state >+ * >+ * @param serializer (not null) >+ * @param savedState (not null) >+ */ >+ public void restoreState(IPresentationSerializer serializer, IMemento savedState) { >+ IMemento[] parts = savedState.getChildren(IWorkbenchConstants.TAG_PART); >+ >+ for (int idx = 0; idx < parts.length; idx++) { >+ String id = parts[idx].getString(IWorkbenchConstants.TAG_ID); >+ >+ if (id != null) { >+ IPresentablePart part = serializer.getPart(id); >+ >+ if (part != null) { >+ addPart(part, tabFolder.getItemCount()); >+ } >+ } >+ } >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.StackPresentation#saveState(org.eclipse.ui.presentations.IPresentationSerializer, org.eclipse.ui.IMemento) >+ */ >+ public void saveState(IPresentationSerializer context, IMemento memento) { >+ super.saveState(context, memento); >+ >+ List parts = getPresentableParts(); >+ >+ Iterator iter = parts.iterator(); >+ while (iter.hasNext()) { >+ IPresentablePart next = (IPresentablePart)iter.next(); >+ >+ IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_PART); >+ childMem.putString(IWorkbenchConstants.TAG_ID, context.getId(next)); >+ } >+ } >+ >+ /** >+ * Returns the List of IPresentablePart currently in this presentation >+ */ >+ List getPresentableParts() { >+ Assert.isTrue(!isDisposed()); >+ >+ CTabItem[] items = tabFolder.getItems(); >+ List result = new ArrayList(items.length); >+ >+ for (int idx = 0; idx < tabFolder.getItemCount(); idx++) { >+ result.add(getPartForTab(items[idx])); >+ } >+ >+ return result; >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 62218
:
12019
|
32183