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 51672 Details for
Bug 160221
[Performance] TestNavigator: Large execution results display is excessively slow
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]
Fix
patch_160221.txt (text/plain), 85.01 KB, created by
Julien Canches
on 2006-10-10 08:00:53 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Julien Canches
Created:
2006-10-10 08:00:53 EDT
Size:
85.01 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.test.ui >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ExecutionFileProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ExecutionFileProxyNode.java,v >retrieving revision 1.2 >diff -u -r1.2 ExecutionFileProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ExecutionFileProxyNode.java 25 Feb 2005 22:17:55 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ExecutionFileProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,8 +15,6 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; > >@@ -24,35 +22,22 @@ > * @author jgout > * @since 3.2 > */ >-public class ExecutionFileProxyNode extends EMFResourceProxyNode implements IPersistableProxyNode { >+public class ExecutionFileProxyNode extends EMFResourceProxyNode { > > public ExecutionFileProxyNode(IFile file, Resource resource) { > super(file, resource); > } > >- public ExecutionFileProxyNode(IFile file, String name, IMemento[] childrenState) { >- super(file, name, childrenState); >+ public ExecutionFileProxyNode(IFile file, IMemento memento) { >+ super(file, memento); > } > > public Image getImage() { > return TestUIImages.INSTANCE.getImage(TestUIImages.IMG_EXECUTION); > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.EXECUTION_FILE_NODE); >- //- data from EMFResourceProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- IProxyNode [] children = getChildren(); >- for (int i = 0; i < children.length; i++) { >- if(!saveChildState(memento, children[i])) { >- return false; >- } >- } >- return true; >- } >+ protected String getNodeKind() { >+ return TestUIConstants.EXECUTION_FILE_NODE; >+ } >+ > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultExecutionResultProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultExecutionResultProxyNode.java,v >retrieving revision 1.7 >diff -u -r1.7 DefaultExecutionResultProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultExecutionResultProxyNode.java 8 Apr 2005 07:29:42 -0000 1.7 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultExecutionResultProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -22,8 +22,6 @@ > import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult; > import org.eclipse.hyades.models.common.testprofile.TPFInvocationEvent; > import org.eclipse.hyades.models.common.testprofile.TPFTest; >-import org.eclipse.hyades.models.common.testprofile.TPFTestSuite; >-import org.eclipse.hyades.test.core.util.EMFUtil; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.internal.model.EventUtil; >@@ -39,12 +37,18 @@ > > /** > * @author jgout >+ * @author jcanches > * @since 3.2 > */ > public class DefaultExecutionResultProxyNode extends TypedElementProxyNode implements IExecutionResultProxyNode, IPersistableProxyNode { > >+ private final static String TAG_VERDICT = "verdict"; //$NON-NLS-1$ >+ private final static String TAG_TIMESTAMP = "timestamp"; //$NON-NLS-1$ >+ > private IProxyNode[] children; > private int verdict; >+ private long timestamp; >+ private String cachedName; > > /** > * @param er >@@ -53,7 +57,6 @@ > public DefaultExecutionResultProxyNode(TPFExecutionResult er, Object parent) { > super(er, parent); > >- String name; > LinkedList c = new LinkedList(); > TPFExecutionHistory history = er.getExecutionHistory(); > if (history != null ) { >@@ -64,43 +67,52 @@ > } > children = (IProxyNode[]) c.toArray(new IProxyNode[c.size()]); > //- save the name of this element >- if(er.getName() != null) { >- name = er.getName(); >+ String name = er.getName(); >+ String testName = null; >+ TPFTest test = er.getTest(); >+ if(test != null) { >+ testName = test.getName(); >+ } >+ if (name != null) { >+ if (testName != null && !testName.equals(name)) { >+ name += " [" + testName + "]"; //$NON-NLS-1$//$NON-NLS-2$ >+ } > } else { >- name = "unamed"; //$NON-NLS-1$ >- } >- TPFTest test = er.getTest(); >- if((er.getTest() != null) && (((er.getTest()).getName()) != null)) { >- if (test instanceof TPFTestSuite) { >- if (er.getExecutionHistory().getExecutionEvents()!=null && er.getExecutionHistory().getExecutionEvents().size()>0) { >- long timeStamp = ((TPFExecutionEvent)er.getExecutionHistory().getExecutionEvents().get(0)).getTimestamp(); >- String dateStamp = EventUtil.getTime(timeStamp); >- name += " ["+dateStamp+"]"; //$NON-NLS-1$//$NON-NLS-2$ >- } >- } else { >- name += " [" + (er.getTest()).getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ >- } >+ if (testName != null) { >+ name = testName; >+ } > } > setName(name); >+ if (!(parent instanceof IExecutionResultProxyNode)) { >+ if (er.getExecutionHistory().getExecutionEvents() != null && er.getExecutionHistory().getExecutionEvents().size()>0) { >+ timestamp = ((TPFExecutionEvent)er.getExecutionHistory().getExecutionEvents().get(0)).getTimestamp(); >+ } >+ } > verdict = er.getVerdict().getValue(); > } >- >+ > public DefaultExecutionResultProxyNode(IMemento memento, Object parent) { > super(memento, parent); >- Integer v = memento.getInteger(TestUIConstants.TAG_VERDICT); >- if(v == null) { >+ Integer v = memento.getInteger(TAG_VERDICT); >+ String l = memento.getString(TAG_TIMESTAMP); >+ if(v == null || l == null) { > //- old memento, we need to rebuild the proxy from execution file > throw new ProxyNeedToBeRebuiltException(); > } else { > verdict = v.intValue(); > } >+ try { >+ timestamp = Long.parseLong(l); >+ } catch (NumberFormatException e) { >+ timestamp = 0L; >+ } > IMemento [] childrenMemento = memento.getChildren(TestUIConstants.TAG_CHILD); > LinkedList execChildren = new LinkedList(); > for (int i = 0; i < childrenMemento.length; i++) { > IMemento mementoChild = childrenMemento[i]; > //- inherit the TAG_URI_ROOT which is an extra data contained by the parent > mementoChild.putString(TestUIConstants.TAG_URI_ROOT, memento.getString(TestUIConstants.TAG_URI_ROOT)); >- String type = mementoChild.getString(TestUIConstants.TAG_TYPE); >+ String type = getType(); > if(type == null) { > throw new ProxyNeedToBeRebuiltException(); > } >@@ -133,6 +145,17 @@ > } > } > >+ public String getText() { >+ if (timestamp != 0L) { >+ if (cachedName == null) { >+ String dateStamp = EventUtil.getTime(timestamp); >+ cachedName = super.getText() + " ["+dateStamp+"]"; //$NON-NLS-1$//$NON-NLS-2$ >+ } >+ return cachedName; >+ } >+ return super.getText(); >+ } >+ > public Image getImage() { > return TestUIImages.INSTANCE.getImage(TestUIImages.IMG_EXECUTION); > } >@@ -142,7 +165,7 @@ > } > > public TPFExecutionResult getExecutionResult() { >- EObject exec = EMFUtil.getResourceSet().getEObject(getOriginatorURI(), true); >+ EObject exec = super.getEObject(); > if (exec instanceof TPFExecutionResult) { > return (TPFExecutionResult) exec; > } else { >@@ -154,20 +177,14 @@ > return verdict; > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >+ protected String getNodeKind() { >+ return TestUIConstants.EXECUTION_RESULT_NODE; > } >- >+ > public boolean saveState(IMemento memento) { > //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.EXECUTION_RESULT_NODE); >- memento.putInteger(TestUIConstants.TAG_VERDICT, getVerdict()); >- //- data from TypedElementProxyNode >- memento.putString(TestUIConstants.TAG_TYPE, getType()); >- //- data from CMNNamedElementProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- //- data from EObjectProxyNode >- memento.putString(TestUIConstants.TAG_URI_FRAGMENT, getOriginatorURI().fragment()); >+ memento.putInteger(TAG_VERDICT, getVerdict()); >+ memento.putString(TAG_TIMESTAMP, Long.toString(timestamp)); > //- children (testcases) > for (int i = 0; i < children.length; i++) { > DefaultExecutionResultProxyNode child = (DefaultExecutionResultProxyNode)children[i]; >@@ -176,7 +193,7 @@ > return false; > } > } >- return true; >+ return super.saveState(memento); > } > > >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/EMFResourceProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/EMFResourceProxyNode.java,v >retrieving revision 1.6 >diff -u -r1.6 EMFResourceProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/EMFResourceProxyNode.java 18 Mar 2005 16:43:34 -0000 1.6 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/EMFResourceProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -29,8 +29,10 @@ > * @author jgout > * @since 3.2 > */ >-public class EMFResourceProxyNode extends FileProxyNode { >+public abstract class EMFResourceProxyNode extends FileProxyNode implements IPersistableProxyNode { > >+ private static final String TAG_NAME = "name"; //$NON-NLS-1$ >+ > private List children; > private String name; > >@@ -55,11 +57,12 @@ > name = name.substring(0, name.length()-(file.getFileExtension().length()+1)); > } > >- public EMFResourceProxyNode(IFile file, String name, IMemento [] childrenState) { >+ public EMFResourceProxyNode(IFile file, IMemento rootMemento) { > super(file); >- this.name = name; >+ this.name = rootMemento.getString(TAG_NAME); > children = new LinkedList(); > IProxyNode child = null; >+ IMemento[] childrenState = rootMemento.getChildren(TestUIConstants.TAG_CHILD); > for (int i = 0; i < childrenState.length; i++) { > IMemento memento = childrenState[i]; > child = HyadesProxyNodeFactory.getInstance().recreate(memento, this); >@@ -96,4 +99,23 @@ > return super.getAdapter(adapter); > } > } >+ >+ public String getFactoryID() { >+ return EMFResourceProxyFactory.ID; >+ } >+ >+ public boolean saveState(IMemento memento) { >+ memento.putString(TestUIConstants.TAG_NODE_KIND, getNodeKind()); >+ memento.putString(TAG_NAME, getText()); >+ IProxyNode [] children = getChildren(); >+ for (int i = 0; i < children.length; i++) { >+ if(!saveChildState(memento, children[i])) { >+ return false; >+ } >+ } >+ return true; >+ } >+ >+ protected abstract String getNodeKind(); >+ > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TypedElementFactoryManager.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TypedElementFactoryManager.java,v >retrieving revision 1.5 >diff -u -r1.5 TypedElementFactoryManager.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TypedElementFactoryManager.java 25 Mar 2005 18:23:32 -0000 1.5 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TypedElementFactoryManager.java 10 Oct 2006 12:03:22 -0000 >@@ -114,20 +114,21 @@ > if (value instanceof IConfigurationElement) { > //- if the factory has not yet been loaded > IConfigurationElement element = (IConfigurationElement) value; >+ ITypedElementProxyFactory factory = null; > try { >- ITypedElementProxyFactory factory = null; > if("factory".equals(element.getName())) { //$NON-NLS-1$ > factory = (ITypedElementProxyFactory)element.createExecutableExtension("class"); //$NON-NLS-1$ > } else { > //- old extension point > factory = (ITypedElementProxyFactory)element.createExecutableExtension("factory"); //$NON-NLS-1$ > } >- return factory; > } catch (CoreException e) { > UiPlugin.logError(e); > //- problem building the instance of factory using reflection >- return new DefaultTypedElementProxyFactory(); >- } >+ factory = new DefaultTypedElementProxyFactory(); >+ } >+ factories.put(factoryID, factory); >+ return factory; > } else { > //- the factory has been loaded yet > if (value instanceof ITypedElementProxyFactory) { >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultTestCaseProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultTestCaseProxyNode.java,v >retrieving revision 1.4 >diff -u -r1.4 DefaultTestCaseProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultTestCaseProxyNode.java 18 Mar 2005 16:43:34 -0000 1.4 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultTestCaseProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -21,7 +21,7 @@ > import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.hyades.test.ui.navigator.ITestCaseProxyNode; > import org.eclipse.hyades.test.ui.navigator.TypedElementProxyNode; >-import org.eclipse.hyades.ui.HyadesUIPlugin; >+import org.eclipse.hyades.ui.extension.IAssociationConstants; > import org.eclipse.hyades.ui.extension.IAssociationDescriptor; > import org.eclipse.hyades.ui.extension.IAssociationMapping; > import org.eclipse.hyades.ui.internal.extension.AssociationMappingRegistry; >@@ -42,14 +42,14 @@ > public DefaultTestCaseProxyNode(TPFTestCase tc, Object parent) { > super(tc, parent); > AssociationMappingRegistry registry = (AssociationMappingRegistry)TestUIExtension.getTestCaseMappingRegistry(); >- IAssociationMapping associationMapping = registry.getAssociationMapping(HyadesUIPlugin.EP_TYPE_DESCRIPTIONS); >+ IAssociationMapping associationMapping = registry.getAssociationMapping(IAssociationConstants.EP_TYPE_DESCRIPTIONS); > descriptor = associationMapping.getDefaultAssociationDescriptor(tc.getType()); > } > > public DefaultTestCaseProxyNode(IMemento memento, Object parent) { > super(memento, parent); > AssociationMappingRegistry registry = (AssociationMappingRegistry)TestUIExtension.getTestCaseMappingRegistry(); >- IAssociationMapping associationMapping = registry.getAssociationMapping(HyadesUIPlugin.EP_TYPE_DESCRIPTIONS); >+ IAssociationMapping associationMapping = registry.getAssociationMapping(IAssociationConstants.EP_TYPE_DESCRIPTIONS); > descriptor = associationMapping.getDefaultAssociationDescriptor(getType()); > } > >@@ -76,19 +76,7 @@ > } > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.TESTCASE_NODE); >- //- data from TypedElementProxyNode >- memento.putString(TestUIConstants.TAG_TYPE, getType()); >- //- data from CMNNamedElementProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- //- data from EObjectProxyNode >- memento.putString(TestUIConstants.TAG_URI_FRAGMENT, getOriginatorURI().fragment()); >- return true; >+ protected String getNodeKind() { >+ return TestUIConstants.TESTCASE_NODE; > } > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/FileProxyMarkerPersister.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/FileProxyMarkerPersister.java,v >retrieving revision 1.1 >diff -u -r1.1 FileProxyMarkerPersister.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/FileProxyMarkerPersister.java 28 Sep 2006 15:14:48 -0000 1.1 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/FileProxyMarkerPersister.java 10 Oct 2006 12:03:22 -0000 >@@ -45,6 +45,7 @@ > > public class FileProxyMarkerPersister implements IFileProxyPersister { > >+ private static final String TAG_FACTORY_ID = "factoryID"; //$NON-NLS-1$ > private static final String TAG_PROXY_STATE = "proxyState"; //$NON-NLS-1$ > private static final String TAG_LAST_SAVE_STAMP = "lastSaveStamp"; //$NON-NLS-1$ > private static final String MARKER_PROXYSTATE = "org.eclipse.hyades.test.ui.proxyStateMarker"; //$NON-NLS-1$ >@@ -65,7 +66,7 @@ > //- if this file has changed since last save do not read the saved state > if(currentModStamp != lastSaveStamp) return null; > //- marker exists so retrieve factory id and proxy state >- String factoryID = markers[0].getAttribute(TestUIConstants.TAG_FACTORY_ID, null); >+ String factoryID = markers[0].getAttribute(TAG_FACTORY_ID, null); > if (FileProxyNodeCache.NullProxy.FACTORY_ID.equals(factoryID)) return FileProxyNodeCache.nullProxy; > String proxyState = markers[0].getAttribute(TAG_PROXY_STATE, null); > if (proxyState == null) { >@@ -232,7 +233,7 @@ > //- create a file marker to store the proxy state > IMarker marker = _file.createMarker(MARKER_PROXYSTATE); > marker.setAttribute(TAG_LAST_SAVE_STAMP, Long.toString(lastSaveStamp)); >- marker.setAttribute(TestUIConstants.TAG_FACTORY_ID, factoryId); >+ marker.setAttribute(TAG_FACTORY_ID, factoryId); > if (state != null) { > marker.setAttribute(TAG_PROXY_STATE, state); > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DatapoolFileProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DatapoolFileProxyNode.java,v >retrieving revision 1.2 >diff -u -r1.2 DatapoolFileProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DatapoolFileProxyNode.java 25 Feb 2005 22:17:55 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DatapoolFileProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,8 +15,6 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; > >@@ -24,35 +22,21 @@ > * @author jgout > * @since 3.2 > */ >-public class DatapoolFileProxyNode extends EMFResourceProxyNode implements IPersistableProxyNode { >+public class DatapoolFileProxyNode extends EMFResourceProxyNode { > > public DatapoolFileProxyNode(IFile file, Resource resource) { > super(file, resource); > } > >- public DatapoolFileProxyNode(IFile file, String name, IMemento [] children) { >- super(file, name, children); >+ public DatapoolFileProxyNode(IFile file, IMemento memento) { >+ super(file, memento); > } > > public Image getImage() { > return TestUIImages.INSTANCE.getImage(TestUIImages.IMG_DATAPOOL); > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.DATAPOOL_FILE_NODE); >- //- data from EMFResourceProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- IProxyNode [] children = getChildren(); >- for (int i = 0; i < children.length; i++) { >- if(!saveChildState(memento, children[i])) { >- return false; >- } >- } >- return true; >+ protected String getNodeKind() { >+ return TestUIConstants.DATAPOOL_FILE_NODE; > } > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ArtifactProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ArtifactProxyNode.java,v >retrieving revision 1.3 >diff -u -r1.3 ArtifactProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ArtifactProxyNode.java 18 Mar 2005 16:43:34 -0000 1.3 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ArtifactProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,7 +15,6 @@ > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.navigator.CMNNamedElementProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; > import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; >@@ -24,9 +23,8 @@ > * @author jgout > * @since 3.2 > */ >-public class ArtifactProxyNode extends CMNNamedElementProxyNode implements IPersistableProxyNode { >+public class ArtifactProxyNode extends CMNNamedElementProxyNode { > >- > /** > * @param memento > * @param parent >@@ -52,18 +50,8 @@ > return new IProxyNode[0]; > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.ARTIFACT_NODE); >- //- data from CMNNamedElementProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- //- data from EObjectProxyNode >- memento.putString(TestUIConstants.TAG_URI_FRAGMENT, getOriginatorURI().fragment()); >- return true; >+ protected String getNodeKind() { >+ return TestUIConstants.ARTIFACT_NODE; > } > > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultTestComponentlProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultTestComponentlProxyNode.java,v >retrieving revision 1.3 >diff -u -r1.3 DefaultTestComponentlProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultTestComponentlProxyNode.java 25 Feb 2005 22:17:55 -0000 1.3 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultTestComponentlProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.emf.ecore.EObject; > import org.eclipse.hyades.models.common.testprofile.TPFTestComponent; > import org.eclipse.hyades.test.core.util.EMFUtil; >+import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.hyades.test.ui.navigator.ITestComponentProxyNode; >@@ -55,4 +56,9 @@ > return null; > } > } >+ >+ protected String getNodeKind() { >+ return TestUIConstants.TESTCOMPONENT_NODE; >+ } >+ > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TestSuiteFileProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TestSuiteFileProxyNode.java,v >retrieving revision 1.2 >diff -u -r1.2 TestSuiteFileProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TestSuiteFileProxyNode.java 25 Feb 2005 22:17:55 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TestSuiteFileProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,8 +15,6 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; > >@@ -24,35 +22,22 @@ > * @author jgout > * @since 3.2 > */ >-public class TestSuiteFileProxyNode extends EMFResourceProxyNode implements IPersistableProxyNode { >+public class TestSuiteFileProxyNode extends EMFResourceProxyNode { > > public TestSuiteFileProxyNode(IFile file, Resource res) { > super(file, res); > } > >- public TestSuiteFileProxyNode(IFile file, String name, IMemento[] childrenState) { >- super(file, name, childrenState); >+ public TestSuiteFileProxyNode(IFile file, IMemento memento) { >+ super(file, memento); > } > > public Image getImage() { > return TestUIImages.INSTANCE.getImage(TestUIImages.IMG_TEST_SUITE); > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.TESTSUITE_FILE_NODE); >- //- data from EMFResourceProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- IProxyNode [] children = getChildren(); >- for (int i = 0; i < children.length; i++) { >- if(!saveChildState(memento, children[i])) { >- return false; >- } >- } >- return true; >- } >+ protected String getNodeKind() { >+ return TestUIConstants.TESTSUITE_FILE_NODE; >+ } >+ > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DeploymentFileProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DeploymentFileProxyNode.java,v >retrieving revision 1.2 >diff -u -r1.2 DeploymentFileProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DeploymentFileProxyNode.java 25 Feb 2005 22:17:55 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DeploymentFileProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,8 +15,6 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; > >@@ -24,35 +22,21 @@ > * @author jgout > * @since 3.2 > */ >-public class DeploymentFileProxyNode extends EMFResourceProxyNode implements IPersistableProxyNode { >+public class DeploymentFileProxyNode extends EMFResourceProxyNode { > > public DeploymentFileProxyNode(IFile file, Resource resource) { > super(file, resource); > } > >- public DeploymentFileProxyNode(IFile file, String name, IMemento[] childrenState) { >- super(file, name, childrenState); >+ public DeploymentFileProxyNode(IFile file, IMemento memento) { >+ super(file, memento); > } > > public Image getImage() { > return TestUIImages.INSTANCE.getImage(TestUIImages.IMG_DEPLOYMENT); > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.DEPLOY_FILE_NODE); >- //- data from EMFResourceProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- IProxyNode [] children = getChildren(); >- for (int i = 0; i < children.length; i++) { >- if(!saveChildState(memento, children[i])) { >- return false; >- } >- } >- return true; >+ protected String getNodeKind() { >+ return TestUIConstants.DEPLOY_FILE_NODE; > } > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/LocationFileProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/LocationFileProxyNode.java,v >retrieving revision 1.2 >diff -u -r1.2 LocationFileProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/LocationFileProxyNode.java 25 Feb 2005 22:17:55 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/LocationFileProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,8 +15,6 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; > >@@ -24,34 +22,21 @@ > * @author jgout > * @since 3.2 > */ >-public class LocationFileProxyNode extends EMFResourceProxyNode implements IPersistableProxyNode { >+public class LocationFileProxyNode extends EMFResourceProxyNode { > > public LocationFileProxyNode(IFile file, Resource resource) { > super(file, resource); > } > >- public LocationFileProxyNode(IFile file, String name, IMemento[] childrenState) { >- super(file, name, childrenState); >+ public LocationFileProxyNode(IFile file, IMemento memento) { >+ super(file, memento); > } > public Image getImage() { > return TestUIImages.INSTANCE.getImage(TestUIImages.IMG_LOCATION); > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.LOCATION_FILE_NODE); >- //- data from EMFResourceProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- IProxyNode [] children = getChildren(); >- for (int i = 0; i < children.length; i++) { >- if(!saveChildState(memento, children[i])) { >- return false; >- } >- } >- return true; >- } >+ protected String getNodeKind() { >+ return TestUIConstants.LOCATION_FILE_NODE; >+ } >+ > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/FileProxyMetadataPersister.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/FileProxyMetadataPersister.java,v >retrieving revision 1.1 >diff -u -r1.1 FileProxyMetadataPersister.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/FileProxyMetadataPersister.java 28 Sep 2006 15:14:48 -0000 1.1 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/FileProxyMetadataPersister.java 10 Oct 2006 12:03:22 -0000 >@@ -4,7 +4,7 @@ > * 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 >- * $Id: FileProxyMetadataPersister.java,v 1.1 2006/09/28 15:14:48 jcanches Exp $ >+ * $Id: $ > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -12,6 +12,8 @@ > > package org.eclipse.hyades.test.ui.internal.navigator.proxy; > >+import java.io.BufferedInputStream; >+import java.io.BufferedOutputStream; > import java.io.File; > import java.io.FileInputStream; > import java.io.FileNotFoundException; >@@ -44,7 +46,8 @@ > > public class FileProxyMetadataPersister implements IFileProxyPersister { > >- private static final String TAG_PROXY_STATE = "proxyState"; //$NON-NLS-1$ >+ private static final String TAG_FACTORY_ID = "factoryID"; //$NON-NLS-1$ >+ private static final String TAG_PROXY_STATE = "proxyState"; //$NON-NLS-1$ > private static final String TAG_LAST_SAVE_STAMP = "lastSaveStamp"; //$NON-NLS-1$ > > private IPath storageArea; >@@ -65,7 +68,7 @@ > protected Writer createWriter(IFile file) throws IOException { > IPath path = getStoragePath(file); > File storageFile = createFile(path); >- GZIPOutputStream stream = new GZIPOutputStream(new FileOutputStream(storageFile)); >+ GZIPOutputStream stream = new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(storageFile))); > return new OutputStreamWriter(stream); > } > >@@ -74,7 +77,7 @@ > File storageFile = new File(path.toOSString()); > if (storageFile.canRead()) { > try { >- return new InputStreamReader(new GZIPInputStream(new FileInputStream(storageFile))); >+ return new InputStreamReader(new GZIPInputStream(new BufferedInputStream(new FileInputStream(storageFile)))); > } catch (FileNotFoundException e) { > UiPlugin.logError(e); > } catch (IOException e) { >@@ -101,7 +104,7 @@ > long lastSaveStamp = stamp != null ? Long.parseLong(stamp) : 0; > //- if this file has changed since last save do not read the saved state > if(currentModStamp != lastSaveStamp) return null; >- String factoryId = memento.getString(TestUIConstants.TAG_FACTORY_ID); >+ String factoryId = memento.getString(TAG_FACTORY_ID); > if (FileProxyNodeCache.NullProxy.FACTORY_ID.equals(factoryId)) return FileProxyNodeCache.nullProxy; > IMemento proxyState = memento.getChild(TAG_PROXY_STATE); > if (proxyState == null) return null; >@@ -169,7 +172,7 @@ > try { > XMLMemento memento = XMLMemento.createWriteRoot("proxyStateMemento"); //$NON-NLS-1$ > memento.putString(TAG_LAST_SAVE_STAMP, Long.toString(file.getModificationStamp())); >- memento.putString(TestUIConstants.TAG_FACTORY_ID, proxy.getFactoryID()); >+ memento.putString(TAG_FACTORY_ID, proxy.getFactoryID()); > IMemento state = memento.createChild(TAG_PROXY_STATE); > proxy.saveState(state); > memento.save(writer); >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/EMFResourceProxyFactory.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/EMFResourceProxyFactory.java,v >retrieving revision 1.11 >diff -u -r1.11 EMFResourceProxyFactory.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/EMFResourceProxyFactory.java 21 Aug 2006 17:02:15 -0000 1.11 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/EMFResourceProxyFactory.java 10 Oct 2006 12:03:22 -0000 >@@ -37,6 +37,11 @@ > */ > public class EMFResourceProxyFactory implements IFileProxyFactory, IPersistableFileProxyFactory { > >+ /** >+ * Factory id. >+ */ >+ public final static String ID = "EMFResourceProxyFactory"; //$NON-NLS-1$ >+ > /** This method is called to build a node that contains multiple EMF objects as children. > * The object created depends of the extension of the file (.datapool -> DatapoolFileProxyNode) > * using as name the name of the file since if there are multiple objects inside, we can't >@@ -130,19 +135,19 @@ > mementoChild.putString(TestUIConstants.TAG_URI_ROOT, memento.getString(TestUIConstants.TAG_URI_ROOT)); > } > if(nodeKind.equals(TestUIConstants.ARTIFACT_FILE_NODE)) { >- return new ArtifactFileProxyNode(file, memento.getString(TestUIConstants.TAG_NAME), mementoChildren); >+ return new ArtifactFileProxyNode(file, memento); > } else if(nodeKind.equals(TestUIConstants.DATAPOOL_FILE_NODE)) { >- return new DatapoolFileProxyNode(file, memento.getString(TestUIConstants.TAG_NAME), mementoChildren); >+ return new DatapoolFileProxyNode(file, memento); > } else if(nodeKind.equals(TestUIConstants.DEPLOY_FILE_NODE)) { >- return new DeploymentFileProxyNode(file, memento.getString(TestUIConstants.TAG_NAME), mementoChildren); >+ return new DeploymentFileProxyNode(file, memento); > } else if(nodeKind.equals(TestUIConstants.EXECUTION_FILE_NODE)) { >- return new ExecutionFileProxyNode(file, memento.getString(TestUIConstants.TAG_NAME), mementoChildren); >+ return new ExecutionFileProxyNode(file, memento); > } else if(nodeKind.equals(TestUIConstants.LOCATION_FILE_NODE)) { >- return new LocationFileProxyNode(file, memento.getString(TestUIConstants.TAG_NAME), mementoChildren); >+ return new LocationFileProxyNode(file, memento); > } else if(nodeKind.equals(TestUIConstants.TESTCOMPONENT_FILE_NODE)) { >- return new TestComponentFileProxyNode(file, memento.getString(TestUIConstants.TAG_NAME), mementoChildren); >+ return new TestComponentFileProxyNode(file, memento); > } else if(nodeKind.equals(TestUIConstants.TESTSUITE_FILE_NODE)) { >- return new TestSuiteFileProxyNode(file, memento.getString(TestUIConstants.TAG_NAME), mementoChildren); >+ return new TestSuiteFileProxyNode(file, memento); > } > } else { > return proxy; >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TestComponentFileProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TestComponentFileProxyNode.java,v >retrieving revision 1.2 >diff -u -r1.2 TestComponentFileProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TestComponentFileProxyNode.java 25 Feb 2005 22:17:55 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/TestComponentFileProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,8 +15,6 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; > >@@ -24,34 +22,22 @@ > * @author jgout > * @since 3.2 > */ >-public class TestComponentFileProxyNode extends EMFResourceProxyNode implements IPersistableProxyNode { >+public class TestComponentFileProxyNode extends EMFResourceProxyNode { > > public TestComponentFileProxyNode(IFile file, Resource resource) { > super(file, resource); > } > >- public TestComponentFileProxyNode(IFile file, String name, IMemento[] childrenState) { >- super(file, name, childrenState); >+ public TestComponentFileProxyNode(IFile file, IMemento memento) { >+ super(file, memento); > } > > public Image getImage() { > return TestUIImages.INSTANCE.getImage(TestUIImages.IMG_TEST_COMPONENT); > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.TESTCOMPONENT_FILE_NODE); >- //- data from EMFResourceProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- IProxyNode [] children = getChildren(); >- for (int i = 0; i < children.length; i++) { >- if(!saveChildState(memento, children[i])) >- return false; >- } >- return true; >- } >+ protected String getNodeKind() { >+ return TestUIConstants.TESTCOMPONENT_FILE_NODE; >+ } >+ > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ArtifactFileProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ArtifactFileProxyNode.java,v >retrieving revision 1.2 >diff -u -r1.2 ArtifactFileProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ArtifactFileProxyNode.java 25 Feb 2005 22:17:55 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/ArtifactFileProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,8 +15,6 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; > >@@ -24,35 +22,21 @@ > * @author jgout > * @since 3.2 > */ >-public class ArtifactFileProxyNode extends EMFResourceProxyNode implements IPersistableProxyNode { >+public class ArtifactFileProxyNode extends EMFResourceProxyNode { > > public ArtifactFileProxyNode(IFile file, Resource res) { > super(file, res); > } > >- public ArtifactFileProxyNode(IFile file, String name, IMemento [] children) { >- super(file, name, children); >+ public ArtifactFileProxyNode(IFile file, IMemento memento) { >+ super(file, memento); > } > > public Image getImage() { > return TestUIImages.INSTANCE.getImage(TestUIImages.IMG_ARTIFACT); > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.ARTIFACT_FILE_NODE); >- //- data from EMFResourceProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- IProxyNode [] children = getChildren(); >- for (int i = 0; i < children.length; i++) { >- if(!saveChildState(memento, children[i])) { >- return false; >- } >- } >- return true; >+ public String getNodeKind() { >+ return TestUIConstants.ARTIFACT_FILE_NODE; > } > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DatapoolProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DatapoolProxyNode.java,v >retrieving revision 1.3 >diff -u -r1.3 DatapoolProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DatapoolProxyNode.java 18 Mar 2005 16:43:34 -0000 1.3 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DatapoolProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,7 +15,6 @@ > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.navigator.CMNNamedElementProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; > import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; >@@ -24,7 +23,7 @@ > * @author jgout > * @since 3.2 > */ >-public class DatapoolProxyNode extends CMNNamedElementProxyNode implements IPersistableProxyNode { >+public class DatapoolProxyNode extends CMNNamedElementProxyNode { > /** > * @param dp > * @param parent >@@ -50,17 +49,7 @@ > return new IProxyNode[0]; > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.DATAPOOL_NODE); >- //- data from CMNNamedElementProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- //- data from EObjectProxyNode >- memento.putString(TestUIConstants.TAG_URI_FRAGMENT, getOriginatorURI().fragment()); >- return true; >+ protected String getNodeKind() { >+ return TestUIConstants.DATAPOOL_NODE; > } > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DeploymentProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DeploymentProxyNode.java,v >retrieving revision 1.3 >diff -u -r1.3 DeploymentProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DeploymentProxyNode.java 18 Mar 2005 16:43:34 -0000 1.3 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DeploymentProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,7 +15,6 @@ > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.navigator.CMNNamedElementProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; > import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; >@@ -24,7 +23,7 @@ > * @author jgout > * @since 3.2 > */ >-public class DeploymentProxyNode extends CMNNamedElementProxyNode implements IPersistableProxyNode { >+public class DeploymentProxyNode extends CMNNamedElementProxyNode { > /** > * @param deploy > * @param parent >@@ -50,17 +49,7 @@ > return new IProxyNode[0]; > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.DEPLOY_NODE); >- //- data from CMNNamedElementProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- //- data from EObjectProxyNode >- memento.putString(TestUIConstants.TAG_URI_FRAGMENT, getOriginatorURI().fragment()); >- return true; >- } >+ protected String getNodeKind() { >+ return TestUIConstants.DEPLOY_NODE; >+ } > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/proxy/LocationProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/proxy/LocationProxyNode.java,v >retrieving revision 1.3 >diff -u -r1.3 LocationProxyNode.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/proxy/LocationProxyNode.java 18 Mar 2005 16:43:34 -0000 1.3 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/proxy/LocationProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -15,7 +15,6 @@ > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.navigator.CMNNamedElementProxyNode; >-import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode; > import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.IMemento; >@@ -24,7 +23,7 @@ > * @author jgout > * @since 3.2 > */ >-public class LocationProxyNode extends CMNNamedElementProxyNode implements IPersistableProxyNode { >+public class LocationProxyNode extends CMNNamedElementProxyNode { > /** > * @param loc > * @param parent >@@ -50,17 +49,8 @@ > return new IProxyNode[0]; > } > >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >- } >- >- public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.LOCATION_NODE); >- //- data from CMNNamedElementProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- //- data from EObjectProxyNode >- memento.putString(TestUIConstants.TAG_URI_FRAGMENT, getOriginatorURI().fragment()); >- return true; >- } >+ protected String getNodeKind() { >+ return TestUIConstants.LOCATION_NODE; >+ } >+ > } >Index: src/org/eclipse/hyades/test/ui/navigator/CMNNamedElementProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/navigator/CMNNamedElementProxyNode.java,v >retrieving revision 1.9 >diff -u -r1.9 CMNNamedElementProxyNode.java >--- src/org/eclipse/hyades/test/ui/navigator/CMNNamedElementProxyNode.java 7 Jul 2006 14:55:00 -0000 1.9 >+++ src/org/eclipse/hyades/test/ui/navigator/CMNNamedElementProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -14,17 +14,14 @@ > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.Platform; >-import org.eclipse.emf.common.util.URI; > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.models.common.common.CMNNamedElement; > import org.eclipse.hyades.test.core.util.EMFUtil; >-import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.UiPlugin; > import org.eclipse.hyades.test.ui.navigator.actions.IProxyNodeRenamer; > import org.eclipse.hyades.test.ui.navigator.actions.RenamerUIInlineEditor; > import org.eclipse.hyades.test.ui.navigator.actions.RenamerUIStatus; >-import org.eclipse.hyades.ui.editor.IHyadesEditorPart; > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IEditorReference; >@@ -38,12 +35,13 @@ > * Proxy node for <code>CMNNamedElement</code> element. > * @author jgout > */ >-/** >- * @author jgout >- * @since >- */ > public abstract class CMNNamedElementProxyNode extends EObjectProxyNode implements IProxyNodeRenamer { >+ >+ private final static String TAG_NAME = "name"; //$NON-NLS-1$ >+ private final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$ >+ > private String name; >+ private String description; > > /** > * Constructor used to load an already built proxy. >@@ -52,10 +50,11 @@ > */ > public CMNNamedElementProxyNode(IMemento memento, Object parent) { > super(memento, parent); >- this.name = memento.getString(TestUIConstants.TAG_NAME); >+ this.name = memento.getString(TAG_NAME); > if(this.name == null) { > throw new IllegalArgumentException("Malformed saved proxy state: unable to retrieve name field"); //$NON-NLS-1$ > } >+ this.description = memento.getString(TAG_DESCRIPTION); > } > > /** >@@ -66,7 +65,9 @@ > public CMNNamedElementProxyNode(EObject eObject, Object parent) { > super(eObject, parent); > if(eObject instanceof CMNNamedElement) { >- this.name = ((CMNNamedElement)eObject).getName(); >+ CMNNamedElement namedElement = (CMNNamedElement)eObject; >+ this.name = namedElement.getName(); >+ this.description = namedElement.getDescription(); > } else { > throw new IllegalArgumentException("CMNNamedElementProxyNode can only be built upon CMNNamedElement"); //$NON-NLS-1$ > } >@@ -90,6 +91,18 @@ > this.name = name; > } > >+ public String getName() { >+ return this.description; >+ } >+ >+ /** >+ * Returns the description of the named element. >+ * @return >+ */ >+ public String getDescription() { >+ return this.description; >+ } >+ > /** > * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) > */ >@@ -171,4 +184,10 @@ > public RenamerUIStatus performUserInteraction(String oldName) { > return new RenamerUIInlineEditor(); > } >+ >+ public boolean saveState(IMemento memento) { >+ memento.putString(TAG_NAME, getName()); >+ return super.saveState(memento); >+ } >+ > } >Index: src/org/eclipse/hyades/test/ui/navigator/DefaultTestSuiteProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/navigator/DefaultTestSuiteProxyNode.java,v >retrieving revision 1.2 >diff -u -r1.2 DefaultTestSuiteProxyNode.java >--- src/org/eclipse/hyades/test/ui/navigator/DefaultTestSuiteProxyNode.java 11 Apr 2006 11:27:11 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/navigator/DefaultTestSuiteProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -22,7 +22,7 @@ > import org.eclipse.hyades.test.ui.TestUIExtension; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.internal.navigator.proxy.TypedElementFactoryManager; >-import org.eclipse.hyades.ui.HyadesUIPlugin; >+import org.eclipse.hyades.ui.extension.IAssociationConstants; > import org.eclipse.hyades.ui.extension.IAssociationDescriptor; > import org.eclipse.hyades.ui.extension.IAssociationMapping; > import org.eclipse.hyades.ui.internal.extension.AssociationMappingRegistry; >@@ -53,7 +53,7 @@ > public DefaultTestSuiteProxyNode(TPFTestSuite ts, Object parent) { > super(ts, parent); > AssociationMappingRegistry registry = (AssociationMappingRegistry)TestUIExtension.getTestSuiteMappingRegistry(); >- IAssociationMapping associationMapping = registry.getAssociationMapping(HyadesUIPlugin.EP_TYPE_DESCRIPTIONS); >+ IAssociationMapping associationMapping = registry.getAssociationMapping(IAssociationConstants.EP_TYPE_DESCRIPTIONS); > descriptor = associationMapping.getDefaultAssociationDescriptor(ts.getType()); > LinkedList tcProxies = new LinkedList(); > EList testcases = ts.getTestCases(); >@@ -76,7 +76,7 @@ > super(memento, parent); > //- set the descriptor according to the saved type. This is used in getImage() > AssociationMappingRegistry registry = (AssociationMappingRegistry)TestUIExtension.getTestSuiteMappingRegistry(); >- IAssociationMapping associationMapping = registry.getAssociationMapping(HyadesUIPlugin.EP_TYPE_DESCRIPTIONS); >+ IAssociationMapping associationMapping = registry.getAssociationMapping(IAssociationConstants.EP_TYPE_DESCRIPTIONS); > descriptor = associationMapping.getDefaultAssociationDescriptor(getType()); > > IMemento [] tcStates = memento.getChildren(TestUIConstants.TAG_CHILD); >@@ -86,7 +86,7 @@ > IMemento mementoChild = tcStates[i]; > //- inherit the TAG_URI_ROOT which is an extra data contained by the parent > mementoChild.putString(TestUIConstants.TAG_URI_ROOT, memento.getString(TestUIConstants.TAG_URI_ROOT)); >- String type = mementoChild.getString(TestUIConstants.TAG_TYPE); >+ String type = getType(); > if(type == null) { > throw new IllegalArgumentException("Malformed saved proxy state: unable to retrieve type field"); //$NON-NLS-1$ > } >@@ -136,12 +136,8 @@ > } > } > >- /** >- * Returns the ID of the factory that is used to recreate this proxy node. >- * @return the ID of the factory that is used to recreate this proxy node. >- */ >- public String getFactoryID() { >- return "EMFResourceProxyFactory"; //$NON-NLS-1$ >+ protected String getNodeKind() { >+ return TestUIConstants.TESTSUITE_NODE; > } > > /** >@@ -151,14 +147,6 @@ > * @return the returned value is no longer significant. > */ > public boolean saveState(IMemento memento) { >- //- data to retrieve the correct object >- memento.putString(TestUIConstants.TAG_NODE_KIND, TestUIConstants.TESTSUITE_NODE); >- //- data from TypedElementProxyNode >- memento.putString(TestUIConstants.TAG_TYPE, getType()); >- //- data from CMNNamedElementProxyNode >- memento.putString(TestUIConstants.TAG_NAME, getText()); >- //- data from EObjectProxyNode >- memento.putString(TestUIConstants.TAG_URI_FRAGMENT, getOriginatorURI().fragment()); > //- children (testcases) > for (int i = 0; i < testCases.length; i++) { > CMNNamedElementProxyNode tcProxy = testCases[i]; >Index: src/org/eclipse/hyades/test/ui/navigator/EObjectProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/navigator/EObjectProxyNode.java,v >retrieving revision 1.8 >diff -u -r1.8 EObjectProxyNode.java >--- src/org/eclipse/hyades/test/ui/navigator/EObjectProxyNode.java 19 May 2006 17:16:12 -0000 1.8 >+++ src/org/eclipse/hyades/test/ui/navigator/EObjectProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.emf.ecore.util.EcoreUtil; > import org.eclipse.hyades.test.core.util.EMFUtil; > import org.eclipse.hyades.test.ui.TestUIConstants; >+import org.eclipse.hyades.test.ui.internal.navigator.proxy.EMFResourceProxyFactory; > import org.eclipse.ui.IMemento; > > /** EMF object proxy element for the test navigator. >@@ -28,7 +29,10 @@ > * EMF objects wrapped by subclasses will be stored in the test navigator resource set > * @author jgout > */ >-public abstract class EObjectProxyNode implements IProxyNode { >+public abstract class EObjectProxyNode implements IProxyNode, IPersistableProxyNode { >+ >+ private static final String TAG_URI_FRAGMENT = "uriFragment"; //$NON-NLS-1$ >+ > private URI originatorURI; > private Object parent; > >@@ -46,7 +50,7 @@ > //- get the fragment part from the whole uri > uriFragmentName = oldURI.fragment(); > } else { >- uriFragmentName = memento.getString(TestUIConstants.TAG_URI_FRAGMENT); >+ uriFragmentName = memento.getString(TAG_URI_FRAGMENT); > } > //- this data is not persisted but added by the proxy node loader (FileProxyManager#buildProxy) > String uriRootName = memento.getString(TestUIConstants.TAG_URI_ROOT); >@@ -141,4 +145,16 @@ > return Platform.getAdapterManager().getAdapter(this, adapter); > } > >+ public String getFactoryID() { >+ return EMFResourceProxyFactory.ID; >+ } >+ >+ public boolean saveState(IMemento memento) { >+ memento.putString(TestUIConstants.TAG_NODE_KIND, getNodeKind()); >+ memento.putString(TAG_URI_FRAGMENT, getOriginatorURI().fragment()); >+ return true; >+ } >+ >+ protected abstract String getNodeKind(); >+ > } >Index: src/org/eclipse/hyades/test/ui/navigator/TypedElementProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/navigator/TypedElementProxyNode.java,v >retrieving revision 1.3 >diff -u -r1.3 TypedElementProxyNode.java >--- src/org/eclipse/hyades/test/ui/navigator/TypedElementProxyNode.java 9 Jun 2005 09:34:10 -0000 1.3 >+++ src/org/eclipse/hyades/test/ui/navigator/TypedElementProxyNode.java 10 Oct 2006 12:03:22 -0000 >@@ -14,7 +14,6 @@ > import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult; > import org.eclipse.hyades.models.common.testprofile.TPFTest; > import org.eclipse.hyades.models.common.testprofile.TPFTestComponent; >-import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.ui.IMemento; > > /** General proxy for typed element. >@@ -22,6 +21,9 @@ > * @author jgout > */ > public abstract class TypedElementProxyNode extends CMNNamedElementProxyNode implements ITypedElementProxyNode { >+ >+ private static final String TAG_TYPE = "type"; //$NON-NLS-1$ >+ > private String type; > > /** >@@ -61,7 +63,7 @@ > */ > public TypedElementProxyNode(IMemento memento, Object parent) { > super(memento, parent); >- this.type = memento.getString(TestUIConstants.TAG_TYPE); >+ this.type = memento.getString(TAG_TYPE); > if (this.type == null) { > throw new IllegalArgumentException("Malformed saved proxy state: unable to retrieve type field"); //$NON-NLS-1$ > } >@@ -74,4 +76,9 @@ > return type; > } > >+ public boolean saveState(IMemento memento) { >+ memento.putString(TAG_TYPE, getType()); >+ return super.saveState(memento); >+ } >+ > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/messages.properties >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/messages.properties,v >retrieving revision 1.8 >diff -u -r1.8 messages.properties >--- src/org/eclipse/hyades/test/ui/internal/navigator/messages.properties 10 Aug 2006 15:19:23 -0000 1.8 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/messages.properties 10 Oct 2006 12:03:22 -0000 >@@ -13,8 +13,10 @@ > # NLS_MESSAGEFORMAT_VAR > # NLS_ENCODING=UTF-8 > >+# Followings are used as labels of tree items in test navigator > TEST_NAVIGATOR_UNNAMED_ELEMENT=unnamed > PROXY_LOADING_ERROR=loading error >+ > OpenWithActionGroup_ActionLabel=Open Wit&h > FileFolderInContainerPaste_NameTwoArg=Copy ({0}) of {1} > FileFolderInContainerPaste_NameOneArg=Copy of {0} >@@ -24,3 +26,5 @@ > FileFolderInContainerPaste_MessageLabel=Enter a new name for ''{0}'' > TestNavigatorActionGroup_ToggleAction_Text=Link with Editor > RenameAction_ActionName=Rena&me >+# The following is used as a range, e.g. "[1 - 100]", or "[901 - 1000]". >+CHILD_GROUP=[{0} - {1}] >\ No newline at end of file >Index: src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigator.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigator.java,v >retrieving revision 1.26 >diff -u -r1.26 TestNavigator.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigator.java 1 Sep 2006 14:03:54 -0000 1.26 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigator.java 10 Oct 2006 12:03:22 -0000 >@@ -12,6 +12,7 @@ > package org.eclipse.hyades.test.ui.internal.navigator; > > import java.util.ArrayList; >+import java.util.Collections; > import java.util.HashMap; > import java.util.Iterator; > import java.util.List; >@@ -28,12 +29,12 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.emf.ecore.util.EcoreUtil; > import org.eclipse.hyades.models.common.common.CMNNamedElement; >-import org.eclipse.hyades.models.common.testprofile.TPFTest; > import org.eclipse.hyades.test.core.util.EMFUtil; > import org.eclipse.hyades.test.ui.TestUIExtension; > import org.eclipse.hyades.test.ui.UiPlugin; > import org.eclipse.hyades.test.ui.internal.editor.BaseEditorPart; > import org.eclipse.hyades.test.ui.internal.model.ResourceUtil.ResourceAdaptable; >+import org.eclipse.hyades.test.ui.internal.navigator.TestNavigatorProvider.IProxyGroup; > import org.eclipse.hyades.test.ui.internal.navigator.action.TestNavigatorActionGroup; > import org.eclipse.hyades.test.ui.internal.navigator.action.ToggleViewAction; > import org.eclipse.hyades.test.ui.internal.navigator.proxy.FileFactoryManager; >@@ -51,6 +52,7 @@ > import org.eclipse.hyades.test.ui.navigator.IProxyNodeListener; > import org.eclipse.hyades.test.ui.navigator.ITestNavigator; > import org.eclipse.hyades.test.ui.navigator.ITypeProviderContext; >+import org.eclipse.hyades.test.ui.navigator.ITypedElementProxyNode; > import org.eclipse.hyades.ui.extension.IAssociationConstants; > import org.eclipse.hyades.ui.extension.IAssociationDescriptor; > import org.eclipse.hyades.ui.extension.IAssociationMapping; >@@ -462,25 +464,43 @@ > } catch (NumberFormatException e) { > } > NavigatorViewerSorter viewerSorter = new NavigatorViewerSorter(this, criteria) { >- protected String getValue(Viewer viewer, Object e) { >- String value = super.getValue(viewer, e); >- if (e instanceof EObject) { >- EObject eObject = (EObject) e; >- if (eObject.eContainer() != null) >- return ""; //$NON-NLS-1$ >+ >+ protected int compareCategories(Object e1, Object e2) { >+ if (e1 instanceof IProxyGroup) { >+ if (e2 instanceof IProxyGroup) { >+ return ((IProxyGroup)e1).getOrder() - ((IProxyGroup)e2).getOrder(); >+ } >+ return -1; >+ } >+ if (e2 instanceof IProxyGroup) { >+ return 1; >+ } >+ return super.compareCategories(e1, e2); >+ } >+ >+ public int category(Object element) { >+ if (element instanceof IResource) return super.category(element); >+ if (element instanceof IAdaptable) { >+ IResource res = (IResource)((IAdaptable)element).getAdapter(IResource.class); >+ if (res != null) { >+ return super.category(res); >+ } >+ } >+ return super.category(element); >+ } > >+ protected String getValue(Viewer viewer, Object e) { >+ String value = super.getValue(viewer, e); >+ if (e instanceof ITypedElementProxyNode) { >+ ITypedElementProxyNode proxy = (ITypedElementProxyNode) e; > if (getCriteria() == NavigatorViewerSorter.TYPE) { >- if (eObject instanceof TPFTest) { >- String type = ((TPFTest) eObject).getType(); >- if (type != null) >- value = type + value; >- else >- value = "zZz" + type; //$NON-NLS-1$ >- } >- value = eObject.eClass().getName() + value; >+ String type = proxy.getType(); >+ if (type != null) >+ value = type + value; >+ else >+ value = "zZz" + type; //$NON-NLS-1$ > } > } >- > return value; > } > }; >@@ -524,21 +544,8 @@ > if (input instanceof IFileEditorInput) { > IFileEditorInput fileInput = (IFileEditorInput) input; > IFile file = fileInput.getFile(); >- >- Resource resource = EMFUtil.getResource(null, file); >- if ((resource != null) && (!resource.getContents().isEmpty())) { >- IStructuredSelection structuredSelection = getStructuredSelection(); >- if (structuredSelection.size() == 1) { >- Object currentSelection = structuredSelection.getFirstElement(); >- if (currentSelection instanceof EObject) { >- if (((EObject) currentSelection).eResource() == resource) >- return true; >- } >- } >- >- selectReveal(new StructuredSelection(resource.getContents().get(0))); >- return true; >- } >+ selectReveal(new StructuredSelection(file)); >+ return true; > } > > return false; >@@ -970,7 +977,11 @@ > * @return > */ > public static Iterator getAllInstancesIterator() { >- return testNavigatorByWorkbenchWindow.values().iterator(); >+ if (testNavigatorByWorkbenchWindow == null) { >+ return Collections.EMPTY_LIST.iterator(); >+ } else { >+ return testNavigatorByWorkbenchWindow.values().iterator(); >+ } > } > > /* (non-Javadoc) >Index: src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigatorProvider.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigatorProvider.java,v >retrieving revision 1.4 >diff -u -r1.4 TestNavigatorProvider.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigatorProvider.java 30 Jan 2006 09:19:56 -0000 1.4 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigatorProvider.java 10 Oct 2006 12:03:22 -0000 >@@ -19,12 +19,16 @@ > import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.jface.viewers.ITreeContentProvider; > import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.swt.graphics.Image; > > /** > * @author jgout > */ > public abstract class TestNavigatorProvider extends TestNavigatorLabelProvider implements ITreeContentProvider { > >+ private final static int MAX_PROXY_NODE_CHILDREN = 100; >+ > public Object getParent(Object element) { > if (element instanceof IProxyNode) { > Object parent = ((IProxyNode) element).getParent(); >@@ -42,17 +46,37 @@ > IProxyNode proxy = (IProxyNode) parentElement; > return proxy.getChildren().length > 0; > } >+ if (parentElement instanceof IProxyGroup) { >+ return true; >+ } > return false; > } > > public Object[] getChildren(Object parentElement) { > if (parentElement instanceof IProxyNode) { > IProxyNode proxy = (IProxyNode) parentElement; >- return proxy.getChildren(); >+ return foldProxyNodes(proxy); >+ } >+ if (parentElement instanceof IProxyGroup) { >+ return ((IProxyGroup)parentElement).getChildren(); > } > return new Object[0]; > } > >+ public String getText(Object element) { >+ if (element instanceof IProxyGroup) { >+ return ((IProxyGroup)element).getText(); >+ } >+ return super.getText(element); >+ } >+ >+ public Image getImage(Object element) { >+ if (element instanceof IProxyGroup) { >+ return ((IProxyGroup)element).getImage(); >+ } >+ return super.getImage(element); >+ } >+ > > public Object[] getElements(Object inputElement) { > if (inputElement instanceof IWorkspaceRoot) { >@@ -70,5 +94,84 @@ > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { > } >+ >+ public static interface IProxyGroup { >+ IProxyNode[] getChildren(); >+ String getText(); >+ Image getImage(); >+ int getOrder(); >+ } >+ >+ private static class ProxyGroup implements IProxyGroup { >+ private IProxyNode parent; >+ private int sequence; >+ public ProxyGroup(IProxyNode node, int sequence) { >+ this.parent = node; >+ this.sequence = sequence; >+ } >+ public IProxyNode[] getChildren() { >+ int start = sequence * MAX_PROXY_NODE_CHILDREN; >+ IProxyNode[] completeChildren = parent.getChildren(); >+ IProxyNode[] children = new IProxyNode[MAX_PROXY_NODE_CHILDREN]; >+ System.arraycopy(completeChildren, start, children, 0, MAX_PROXY_NODE_CHILDREN); >+ return children; >+ } >+ public String getText() { >+ int start = sequence * MAX_PROXY_NODE_CHILDREN + 1; >+ int end = (sequence + 1) * MAX_PROXY_NODE_CHILDREN; >+ return NLS.bind(TestNavigatorMessages.CHILD_GROUP, new String[] { Integer.toString(start), Integer.toString(end) }); >+ } >+ public Image getImage() { >+ return parent.getImage(); >+ } >+ public int getOrder() { >+ return sequence; >+ } >+ } >+ >+ private static class RemainingProxyGroup implements IProxyGroup { >+ private IProxyNode parent; >+ public RemainingProxyGroup(IProxyNode parent) { >+ this.parent = parent; >+ } >+ public IProxyNode[] getChildren() { >+ IProxyNode[] completeChildren = parent.getChildren(); >+ int completeLength = completeChildren.length; >+ int length = completeLength % MAX_PROXY_NODE_CHILDREN; >+ IProxyNode[] children = new IProxyNode[length]; >+ System.arraycopy(completeChildren, completeLength - length, children, 0, length); >+ return children; >+ } >+ public String getText() { >+ IProxyNode[] completeChildren = parent.getChildren(); >+ int end = completeChildren.length; >+ int length = end % MAX_PROXY_NODE_CHILDREN; >+ int start = end - length + 1; >+ return NLS.bind(TestNavigatorMessages.CHILD_GROUP, new String[] { Integer.toString(start), Integer.toString(end) }); >+ } >+ public Image getImage() { >+ return parent.getImage(); >+ } >+ public int getOrder() { >+ return Integer.MAX_VALUE; >+ } >+ } >+ >+ protected Object[] foldProxyNodes(IProxyNode parent) { >+ IProxyNode[] children = parent.getChildren(); >+ int length = children.length; >+ if (length <= MAX_PROXY_NODE_CHILDREN) return children; >+ int size = length / MAX_PROXY_NODE_CHILDREN; >+ int remaining = length % MAX_PROXY_NODE_CHILDREN; >+ int totalSize = size + (remaining > 0 ? 1 : 0); >+ Object[] groups = new IProxyGroup[totalSize]; >+ for (int i = 0; i < size; i++) { >+ groups[i] = new ProxyGroup(parent, i); >+ } >+ if (remaining > 0) { >+ groups[size] = new RemainingProxyGroup(parent); >+ } >+ return groups; >+ } > > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/TestDecoratingLabelProvider.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/TestDecoratingLabelProvider.java,v >retrieving revision 1.5 >diff -u -r1.5 TestDecoratingLabelProvider.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/TestDecoratingLabelProvider.java 12 Dec 2005 09:54:41 -0000 1.5 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/TestDecoratingLabelProvider.java 10 Oct 2006 12:03:22 -0000 >@@ -13,11 +13,10 @@ > package org.eclipse.hyades.test.ui.internal.navigator; > > import java.util.ArrayList; >-import java.util.Iterator; >-import java.util.LinkedList; > > import org.eclipse.core.resources.IFile; >-import org.eclipse.hyades.test.ui.navigator.ITestNavigator; >+import org.eclipse.hyades.test.ui.internal.navigator.proxy.FileProxyNodeCache; >+import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.jface.viewers.DecoratingLabelProvider; > import org.eclipse.jface.viewers.IBaseLabelProvider; > import org.eclipse.jface.viewers.ILabelDecorator; >@@ -30,46 +29,27 @@ > */ > public class TestDecoratingLabelProvider extends DecoratingLabelProvider implements ILabelProviderListener{ > >- private LinkedList listeners; >- private final ITestNavigator testNavigator; >+ private final TestNavigator testNavigator; >+ > /** > * @param provider > * @param decorator > * @param testNavigator > */ >- public TestDecoratingLabelProvider(ILabelProvider provider, ILabelDecorator decorator, ITestNavigator testNavigator) { >+ public TestDecoratingLabelProvider(ILabelProvider provider, ILabelDecorator decorator, TestNavigator testNavigator) { > super(provider, decorator); > this.testNavigator = testNavigator; >- listeners = new LinkedList(); >- } >- >- public void addListener(ILabelProviderListener listener) { >- ILabelDecorator decorator = getLabelDecorator(); > if(decorator != null) { > decorator.addListener(this); > } >- //- avoid multiple listener registration >- if(!listeners.contains(listener)) { >- ILabelProvider labelProvider = getLabelProvider(); >- if(labelProvider != null) { >- labelProvider.addListener(listener); >- } >- listeners.add(listener); >- } > } > >- public void removeListener(ILabelProviderListener listener) { >+ public void dispose() { > ILabelDecorator decorator = getLabelDecorator(); > if(decorator != null) { > decorator.removeListener(this); > } >- if(listeners.contains(listener)) { >- ILabelProvider labelProvider = getLabelProvider(); >- if(labelProvider != null) { >- labelProvider.removeListener(listener); >- } >- listeners.remove(listener); >- } >+ super.dispose(); > } > > /* (non-Javadoc) >@@ -86,25 +66,19 @@ > //- need to check is there is not a proxy define for this file > IFile file = (IFile) elem; > if (file.exists()) { >- Object convertedObject = TestNavigator.getFileProxyManager().getProxy((IFile) elem, null); >- if (convertedObject != null) { >- others.add(convertedObject); >- } else { >- others.add(elem); >- } >- } else { >- others.add(elem); >+ IProxyNode converted = FileProxyNodeCache.getInstance().getCachedProxy(file); >+ if (converted != null) { >+ if (TestNavigator.getFileProxyManager().getParent(converted) != null) { >+ others.add(converted); >+ } >+ } > } >- } else { >- others.add(elem); > } > } >- event = new LabelProviderChangedEvent((IBaseLabelProvider) event.getSource(), others.toArray()); >+ if (others.size() > 0) { >+ event = new LabelProviderChangedEvent((IBaseLabelProvider) event.getSource(), others.toArray()); >+ fireLabelProviderChanged(event); >+ } > } >- //- delegate to all registered listeners with the new event content >- for (Iterator it = listeners.iterator(); it.hasNext();) { >- ILabelProviderListener l = (ILabelProviderListener) it.next(); >- l.labelProviderChanged(event); >- } > } > } >Index: src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigatorMessages.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigatorMessages.java,v >retrieving revision 1.7 >diff -u -r1.7 TestNavigatorMessages.java >--- src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigatorMessages.java 10 Aug 2006 15:19:23 -0000 1.7 >+++ src/org/eclipse/hyades/test/ui/internal/navigator/TestNavigatorMessages.java 10 Oct 2006 12:03:22 -0000 >@@ -35,4 +35,5 @@ > public static String FileFolderInContainerPaste_MessageLabel; > public static String TestNavigatorActionGroup_ToggleAction_Text; > public static String RenameAction_ActionName; >+ public static String CHILD_GROUP; > } >Index: src/org/eclipse/hyades/test/ui/internal/model/CMNNamedElementUtil.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/model/CMNNamedElementUtil.java,v >retrieving revision 1.4 >diff -u -r1.4 CMNNamedElementUtil.java >--- src/org/eclipse/hyades/test/ui/internal/model/CMNNamedElementUtil.java 9 Mar 2005 16:46:03 -0000 1.4 >+++ src/org/eclipse/hyades/test/ui/internal/model/CMNNamedElementUtil.java 10 Oct 2006 12:03:22 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.hyades.models.common.common.CMNNamedElement; > import org.eclipse.hyades.models.common.common.CommonPackage; > import org.eclipse.hyades.test.core.util.EMFUtil; >+import org.eclipse.hyades.test.ui.navigator.CMNNamedElementProxyNode; > import org.eclipse.hyades.ui.util.IDisposable; > import org.eclipse.hyades.ui.util.INamedElement; > import org.eclipse.ui.IElementFactory; >@@ -181,6 +182,50 @@ > } > } > >+ public static class UIProxyNamedElement implements INamedElement, IDisposable { >+ >+ private CMNNamedElementProxyNode proxy; >+ private CMNNamedElement loadedObject; >+ >+ public UIProxyNamedElement(CMNNamedElementProxyNode proxy) { >+ this.proxy = proxy; >+ } >+ >+ private CMNNamedElement loadNamedElement() { >+ if (loadedObject == null) { >+ loadedObject = (CMNNamedElement) proxy.getEObject(); >+ } >+ return loadedObject; >+ } >+ >+ public String getDescription() { >+ return proxy.getDescription(); >+ } >+ >+ public String getName() { >+ return proxy.getText(); >+ } >+ >+ public void setDescription(String description) { >+ throw new UnsupportedOperationException(); >+ } >+ >+ public void setName(String name) { >+ throw new UnsupportedOperationException(); >+ } >+ >+ public Object getAdapter(Class adapter) { >+ if(INamedElement.class == adapter) >+ return this; >+ return proxy.getAdapter(adapter); >+ } >+ >+ public void dispose() { >+ loadedObject = null; >+ } >+ >+ } >+ > public static interface NameChangeObserver > { > public void update(CMNNamedElement namedElement, String oldName); >Index: src/org/eclipse/hyades/test/ui/adapter/CMNNamedElementPropertySource.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/adapter/CMNNamedElementPropertySource.java,v >retrieving revision 1.3 >diff -u -r1.3 CMNNamedElementPropertySource.java >--- src/org/eclipse/hyades/test/ui/adapter/CMNNamedElementPropertySource.java 18 May 2005 08:18:11 -0000 1.3 >+++ src/org/eclipse/hyades/test/ui/adapter/CMNNamedElementPropertySource.java 10 Oct 2006 12:03:22 -0000 >@@ -13,14 +13,19 @@ > > import org.eclipse.hyades.models.common.common.CMNNamedElement; > import org.eclipse.hyades.test.ui.internal.model.CMNNamedElementUtil.UINamedElement; >+import org.eclipse.hyades.test.ui.internal.model.CMNNamedElementUtil.UIProxyNamedElement; >+import org.eclipse.hyades.test.ui.navigator.CMNNamedElementProxyNode; > import org.eclipse.hyades.ui.adapter.NamedElementPropertySource; > > > public class CMNNamedElementPropertySource > extends NamedElementPropertySource > { >- public CMNNamedElementPropertySource(CMNNamedElement namedElement) >- { >+ public CMNNamedElementPropertySource(CMNNamedElement namedElement) { > super(new UINamedElement(namedElement)); > } >+ >+ public CMNNamedElementPropertySource(CMNNamedElementProxyNode proxy) { >+ super(new UIProxyNamedElement(proxy)); >+ } > } >\ No newline at end of file >Index: src/org/eclipse/hyades/test/ui/TestUIConstants.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/TestUIConstants.java,v >retrieving revision 1.7 >diff -u -r1.7 TestUIConstants.java >--- src/org/eclipse/hyades/test/ui/TestUIConstants.java 13 Oct 2005 09:32:56 -0000 1.7 >+++ src/org/eclipse/hyades/test/ui/TestUIConstants.java 10 Oct 2006 12:03:22 -0000 >@@ -11,23 +11,42 @@ > *******************************************************************************/ > package org.eclipse.hyades.test.ui; > >-/** Constants storage interface >+/** >+ * Constants storage interface > * @author jgout > */ > public interface TestUIConstants { > >+ /** >+ * @deprecated use TAG_FRAGMENT instead. We no longer should persiste the full URI because it contains file path >+ */ > public static final String TAG_FACTORY_ID = "factoryID"; //$NON-NLS-1$ > public static final String TAG_NODE_KIND = "nodeKind"; //$NON-NLS-1$ >+ /** >+ * @deprecated use TAG_FRAGMENT instead. We no longer should persiste the full URI because it contains file path >+ */ > public static final String TAG_NAME = "name"; //$NON-NLS-1$ > public static final String TAG_TYPE = "type"; //$NON-NLS-1$ > /** > * @deprecated use TAG_FRAGMENT instead. We no longer should persiste the full URI because it contains file path > */ > public static final String TAG_URI = "uri"; //$NON-NLS-1$ >+ /** >+ * @deprecated This constant was mistakenly published. >+ */ > public static final String TAG_URI_FRAGMENT = "uriFragment"; //$NON-NLS-1$ > public static final String TAG_URI_ROOT = "uriRoot"; //$NON-NLS-1$ >+ /** >+ * @deprecated This constant was mistakenly published. >+ */ > public static final String TAG_IDENTIFIER = "identifier"; //$NON-NLS-1$ >+ /** >+ * @deprecated This constant was mistakenly published. >+ */ > public static final String TAG_UNDERLYING_RESOURCE = "underlyingResource"; //$NON-NLS-1$ >+ /** >+ * @deprecated This constant was mistakenly published. >+ */ > public static final String TAG_VERDICT = "verdict"; //$NON-NLS-1$ > > //- hyades default value of tag TAG_NODE_KIND >#P org.eclipse.hyades.test.tools.ui >Index: src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestSuiteProxyNode.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.tools.ui/src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestSuiteProxyNode.java,v >retrieving revision 1.4 >diff -u -r1.4 JUnitTestSuiteProxyNode.java >--- src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestSuiteProxyNode.java 1 Sep 2006 14:14:37 -0000 1.4 >+++ src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestSuiteProxyNode.java 10 Oct 2006 12:03:25 -0000 >@@ -39,10 +39,4 @@ > return "org.eclipse.hyades.test.tools.ui.JUnitTestSuiteFactory"; //$NON-NLS-1$ > } > >- /* (non-Javadoc) >- * @see org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode#saveState(org.eclipse.ui.IMemento) >- */ >- public boolean saveState(IMemento memento) { >- return super.saveState(memento); >- } > } >Index: src/org/eclipse/hyades/test/tools/ui/java/internal/TestJavaPropertySource.java >=================================================================== >RCS file: /home/tptp/test/org.eclipse.hyades.test.tools.ui/src/org/eclipse/hyades/test/tools/ui/java/internal/TestJavaPropertySource.java,v >retrieving revision 1.2 >diff -u -r1.2 TestJavaPropertySource.java >--- src/org/eclipse/hyades/test/tools/ui/java/internal/TestJavaPropertySource.java 25 Feb 2005 22:17:54 -0000 1.2 >+++ src/org/eclipse/hyades/test/tools/ui/java/internal/TestJavaPropertySource.java 10 Oct 2006 12:03:25 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.hyades.models.common.common.CMNNamedElement; > import org.eclipse.hyades.test.ui.adapter.CMNNamedElementPropertySource; > import org.eclipse.hyades.test.ui.adapter.INamedElementPropertySource; >+import org.eclipse.hyades.test.ui.navigator.CMNNamedElementProxyNode; > import org.eclipse.hyades.test.ui.navigator.IExecutionResultProxyNode; > import org.eclipse.hyades.test.ui.navigator.ITestCaseProxyNode; > import org.eclipse.hyades.test.ui.navigator.ITestComponentProxyNode; >@@ -26,16 +27,24 @@ > public class TestJavaPropertySource implements INamedElementPropertySource { > > public IPropertySource getPropertySource(Object adaptableObject) { >+ if (adaptableObject instanceof CMNNamedElementProxyNode) { >+ return new CMNNamedElementPropertySource((CMNNamedElementProxyNode)adaptableObject); >+ } > if(adaptableObject instanceof ITestSuiteProxyNode) { > return new CMNNamedElementPropertySource(((ITestSuiteProxyNode)adaptableObject).getTestSuite()); >- } else if(adaptableObject instanceof ITestCaseProxyNode) { >+ } >+ if(adaptableObject instanceof ITestCaseProxyNode) { > return new CMNNamedElementPropertySource(((ITestCaseProxyNode)adaptableObject).getTestCase()); >- } else if(adaptableObject instanceof ITestComponentProxyNode) { >+ } >+ if(adaptableObject instanceof ITestComponentProxyNode) { > return new CMNNamedElementPropertySource(((ITestComponentProxyNode)adaptableObject).getTestComponent()); >- } else if(adaptableObject instanceof IExecutionResultProxyNode) { >+ } >+ if(adaptableObject instanceof IExecutionResultProxyNode) { > return new CMNNamedElementPropertySource(((IExecutionResultProxyNode)adaptableObject).getExecutionResult()); >- } else { >+ } >+ if (adaptableObject instanceof CMNNamedElement){ > return new CMNNamedElementPropertySource((CMNNamedElement)adaptableObject); > } >+ 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 160221
: 51672