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 56661 Details for
Bug 89834
[Presentations] Allow for unanticipated parameters for part appearance and behavior
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]
part Properties v01
properties-v01.txt (text/plain), 12.73 KB, created by
Paul Webster
on 2007-01-09 15:43:25 EST
(
hide
)
Description:
part Properties v01
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2007-01-09 15:43:25 EST
Size:
12.73 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/EditorReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java,v >retrieving revision 1.21 >diff -u -r1.21 EditorReference.java >--- Eclipse UI/org/eclipse/ui/internal/EditorReference.java 20 Dec 2006 15:16:47 -0000 1.21 >+++ Eclipse UI/org/eclipse/ui/internal/EditorReference.java 9 Jan 2007 20:29:10 -0000 >@@ -140,7 +140,14 @@ > String partName = memento > .getString(IWorkbenchConstants.TAG_PART_NAME); > >- // For compatibility set the part name to the title if not found >+ IMemento[] props = memento >+ .getChildren(IWorkbenchConstants.TAG_PROPERTY); >+ for (int i = 0; i < props.length; i++) { >+ propertyCache.put(props[i].getString(IWorkbenchConstants.TAG_KEY), >+ props[i].getString(IWorkbenchConstants.TAG_VALUE)); >+ } >+ >+ // For compatibility set the part name to the title if not found > if (partName == null) { > partName = title; > } >Index: Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java,v >retrieving revision 1.75 >diff -u -r1.75 IWorkbenchConstants.java >--- Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 10 Nov 2006 12:51:44 -0000 1.75 >+++ Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 9 Jan 2007 20:29:10 -0000 >@@ -120,6 +120,8 @@ > > public static final String TAG_PART_NAME = "partName"; //$NON-NLS-1$ > >+ public static final String TAG_PROPERTY = "property"; //$NON-NLS-1$ >+ > public static final String TAG_PART_TRIMSTATE = "inTrim"; //$NON-NLS-1$ > > public static final String TAG_RELATIVE = "relative"; //$NON-NLS-1$ >@@ -328,4 +330,8 @@ > //Colors > public static final String COLOR_HIGHLIGHT = "org.eclipse.ui.highlight"; //$NON-NLS-1$ > >+ public static final String TAG_KEY = "key"; //$NON-NLS-1$ >+ >+ public static final String TAG_VALUE = "value"; //$NON-NLS-1$ >+ > } >Index: Eclipse UI/org/eclipse/ui/internal/EditorManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorManager.java,v >retrieving revision 1.122 >diff -u -r1.122 EditorManager.java >--- Eclipse UI/org/eclipse/ui/internal/EditorManager.java 2 Jan 2007 16:50:29 -0000 1.122 >+++ Eclipse UI/org/eclipse/ui/internal/EditorManager.java 9 Jan 2007 20:29:09 -0000 >@@ -31,6 +31,7 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.MultiStatus; > import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.SafeRunner; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.SubProgressMonitor; > import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler; >@@ -77,6 +78,7 @@ > import org.eclipse.ui.IViewPart; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchPart3; > import org.eclipse.ui.IWorkbenchPartReference; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PartInitException; >@@ -1574,7 +1576,7 @@ > return; > } > >- Platform.run(new SafeRunnable() { >+ SafeRunner.run(new SafeRunnable() { > public void run() { > // Get the input. > IEditorInput input = editor.getEditorInput(); >@@ -1597,6 +1599,20 @@ > > editorMem.putString(IWorkbenchConstants.TAG_PART_NAME, > editorRef.getPartName()); >+ >+ if (editor instanceof IWorkbenchPart3) { >+ Map properties = ((IWorkbenchPart3) editor).getPartProperties(); >+ Iterator i = properties.entrySet().iterator(); >+ while (i.hasNext()) { >+ Map.Entry entry = (Map.Entry) i.next(); >+ IMemento p = editorMem >+ .createChild(IWorkbenchConstants.TAG_PROPERTY); >+ p.putString(IWorkbenchConstants.TAG_KEY, (String) entry >+ .getKey()); >+ p.putString(IWorkbenchConstants.TAG_VALUE, >+ (String) entry.getValue()); >+ } >+ } > > if (editorRef.isPinned()) { > editorMem.putString(IWorkbenchConstants.TAG_PINNED, "true"); //$NON-NLS-1$ >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java,v >retrieving revision 1.43 >diff -u -r1.43 WorkbenchPartReference.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java 20 Dec 2006 02:38:11 -0000 1.43 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java 9 Jan 2007 20:29:10 -0000 >@@ -11,6 +11,8 @@ > package org.eclipse.ui.internal; > > import java.util.BitSet; >+import java.util.HashMap; >+import java.util.Map; > > import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.IStatus; >@@ -29,6 +31,7 @@ > import org.eclipse.ui.ISharedImages; > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchPart2; >+import org.eclipse.ui.IWorkbenchPart3; > import org.eclipse.ui.IWorkbenchPartConstants; > import org.eclipse.ui.IWorkbenchPartReference; > import org.eclipse.ui.IWorkbenchPartSite; >@@ -141,6 +144,8 @@ > > private String contentDescription; > >+ protected Map propertyCache = new HashMap(); >+ > /** > * Used to remember which events have been queued. > */ >@@ -712,4 +717,17 @@ > return pinned; > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IWorkbenchPartReference#getPartProperty(java.lang.String) >+ */ >+ public String getPartProperty(String key) { >+ if (part != null) { >+ if (part instanceof IWorkbenchPart3) { >+ return ((IWorkbenchPart3) part).getPartProperty(key); >+ } >+ } else { >+ return (String)propertyCache.get(key); >+ } >+ return null; >+ } > } >Index: Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java,v >retrieving revision 1.6 >diff -u -r1.6 IWorkbenchPartConstants.java >--- Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java 15 Jun 2005 18:41:21 -0000 1.6 >+++ Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java 9 Jan 2007 20:29:08 -0000 >@@ -43,4 +43,7 @@ > */ > int PROP_CONTENT_DESCRIPTION = 0x105; > >+ int PROP_USER_LOW = 0x500; >+ >+ int PROP_USER_HI = 0x9FF; > } >Index: Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java,v >retrieving revision 1.13 >diff -u -r1.13 IWorkbenchPartReference.java >--- Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java 8 May 2006 20:55:31 -0000 1.13 >+++ Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java 9 Jan 2007 20:29:08 -0000 >@@ -93,4 +93,16 @@ > */ > public boolean isDirty(); > >+ /** >+ * Return an arbitrary property from the reference. If the part has been >+ * instantiated, it just delegates to the part. If not, then it looks in its >+ * own cache of properties. If the property is not available or the part has >+ * never been instantiated, it can return <code>null</code>. >+ * >+ * @param key >+ * The property to return. >+ * @return The String property, or <code>null</code>. >+ * @since 3.3 >+ */ >+ public String getPartProperty(String key); > } >Index: Eclipse UI/org/eclipse/ui/internal/presentations/PresentablePart.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/presentations/PresentablePart.java,v >retrieving revision 1.10 >diff -u -r1.10 PresentablePart.java >--- Eclipse UI/org/eclipse/ui/internal/presentations/PresentablePart.java 24 Oct 2005 19:06:49 -0000 1.10 >+++ Eclipse UI/org/eclipse/ui/internal/presentations/PresentablePart.java 9 Jan 2007 20:29:11 -0000 >@@ -351,4 +351,11 @@ > } > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getPartProperty(java.lang.String) >+ */ >+ public String getPartProperty(String key) { >+ return getPartReference().getPartProperty(key); >+ } >+ > } >Index: Eclipse UI/org/eclipse/ui/presentations/IPresentablePart.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/presentations/IPresentablePart.java,v >retrieving revision 1.19 >diff -u -r1.19 IPresentablePart.java >--- Eclipse UI/org/eclipse/ui/presentations/IPresentablePart.java 8 May 2006 20:55:49 -0000 1.19 >+++ Eclipse UI/org/eclipse/ui/presentations/IPresentablePart.java 9 Jan 2007 20:29:11 -0000 >@@ -226,4 +226,17 @@ > */ > public Control getControl(); > >+ /** >+ * Get a property other than title or name from a workbench part. These >+ * properties are arbitrary properties that the presentation might like >+ * access to. It is the part implementation's responsibility to synchronize >+ * the property change events which are <code>int</code> with the >+ * properties the presentation will request which are <code>String</code>. >+ * >+ * @param key >+ * The property key to retrieve. Must not be <code>null</code>. >+ * @return the property, or <code>null</code> if that property is not set. >+ * @since 3.3 >+ */ >+ public String getPartProperty(String key); > } >Index: Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java >diff -N Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui; >+ >+import java.util.Map; >+ >+/** >+ * A part can provide arbitrary properties. The properties will be persisted >+ * between sessions by the part reference, and will be available from the part >+ * reference as well as the part. >+ * <p> >+ * Setting a property must fire a part changed event. >+ * </p> >+ * <p> >+ * It is up to the part to define the arbitrary mapping between its property >+ * keys and the integer constants used in the property change events. Please use >+ * integers in the {@link IWorkbenchPartConstants#PROP_USER_LOW} to >+ * {@link IWorkbenchPartConstants#PROP_USER_HI}. >+ * </p> >+ * >+ * @since 3.3 >+ */ >+public interface IWorkbenchPart3 extends IWorkbenchPart2 { >+ /** >+ * Return the value for the property key, or <code>null</code>. >+ * >+ * @param key >+ * the arbitrary property >+ * @return the property value, or <code>null</code>. >+ */ >+ public String getPartProperty(String key); >+ >+ /** >+ * Set an arbitrary property on the part. It is the implementor's >+ * responsibility to fire the corresponding property change event. >+ * >+ * @param key >+ * the arbitrary property. Must not be <code>null</code>. >+ * @param value >+ * the property value. A <code>null</code> value will remove >+ * that property. >+ */ >+ public void setPartProperty(String key, String value); >+ >+ /** >+ * Return an unmodifiable map of the properties. >+ * >+ * @return A Map of the properties. Must not be <code>null</code>. >+ */ >+ public Map getPartProperties(); >+} >#P org.eclipse.ui.tests.performance >Index: src/org/eclipse/ui/tests/performance/presentations/TestPresentablePart.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/presentations/TestPresentablePart.java,v >retrieving revision 1.2 >diff -u -r1.2 TestPresentablePart.java >--- src/org/eclipse/ui/tests/performance/presentations/TestPresentablePart.java 8 May 2006 20:52:14 -0000 1.2 >+++ src/org/eclipse/ui/tests/performance/presentations/TestPresentablePart.java 9 Jan 2007 20:29:12 -0000 >@@ -176,4 +176,10 @@ > firePropertyChange(IPresentablePart.PROP_TOOLBAR); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getPartProperty(java.lang.String) >+ */ >+ public String getPartProperty(String key) { >+ return null; >+ } > }
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 89834
:
56661
|
56930
|
56982
|
56997