Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 182546 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/hyades/test/ui/internal/navigator/proxy/DefaultExecutionResultProxyNode.java (-64 / +57 lines)
Lines 11-35 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.hyades.test.ui.internal.navigator.proxy;
12
package org.eclipse.hyades.test.ui.internal.navigator.proxy;
13
13
14
import java.util.Iterator;
15
import java.util.LinkedList;
16
import java.util.List;
17
18
import org.eclipse.emf.common.util.EList;
19
import org.eclipse.emf.ecore.EObject;
14
import org.eclipse.emf.ecore.EObject;
20
import org.eclipse.hyades.models.common.testprofile.TPFExecutionEvent;
15
import org.eclipse.hyades.models.common.testprofile.TPFExecutionEvent;
21
import org.eclipse.hyades.models.common.testprofile.TPFExecutionHistory;
22
import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult;
16
import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult;
23
import org.eclipse.hyades.models.common.testprofile.TPFInvocationEvent;
24
import org.eclipse.hyades.models.common.testprofile.TPFTest;
17
import org.eclipse.hyades.models.common.testprofile.TPFTest;
25
import org.eclipse.hyades.test.ui.TestUIConstants;
18
import org.eclipse.hyades.test.ui.TestUIConstants;
26
import org.eclipse.hyades.test.ui.TestUIImages;
19
import org.eclipse.hyades.test.ui.TestUIImages;
27
import org.eclipse.hyades.test.ui.internal.model.EventUtil;
20
import org.eclipse.hyades.test.ui.internal.model.EventUtil;
28
import org.eclipse.hyades.test.ui.navigator.IExecutionResultProxyNode;
21
import org.eclipse.hyades.test.ui.navigator.IExecutionResultProxyNode;
29
import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode;
22
import org.eclipse.hyades.test.ui.navigator.IPersistableProxyNode;
30
import org.eclipse.hyades.test.ui.navigator.IPersistableTypedElementProxyFactory;
31
import org.eclipse.hyades.test.ui.navigator.IProxyNode;
23
import org.eclipse.hyades.test.ui.navigator.IProxyNode;
32
import org.eclipse.hyades.test.ui.navigator.ITypedElementProxyFactory;
33
import org.eclipse.hyades.test.ui.navigator.ProxyNeedToBeRebuiltException;
24
import org.eclipse.hyades.test.ui.navigator.ProxyNeedToBeRebuiltException;
34
import org.eclipse.hyades.test.ui.navigator.TypedElementProxyNode;
25
import org.eclipse.hyades.test.ui.navigator.TypedElementProxyNode;
35
import org.eclipse.swt.graphics.Image;
26
import org.eclipse.swt.graphics.Image;
Lines 57-71 Link Here
57
	public DefaultExecutionResultProxyNode(TPFExecutionResult er, Object parent) {
48
	public DefaultExecutionResultProxyNode(TPFExecutionResult er, Object parent) {
58
		super(er, parent);
49
		super(er, parent);
59
		
50
		
60
		LinkedList c = new LinkedList();
51
//		LinkedList c = new LinkedList();
61
		TPFExecutionHistory history = er.getExecutionHistory();
52
//		TPFExecutionHistory history = er.getExecutionHistory();
62
		if (history != null ) {
53
//		if (history != null ) {
63
			EList events = history.getExecutionEvents();
54
//			EList events = history.getExecutionEvents();
64
			for (Iterator it = events.iterator(); it.hasNext();) {
55
//			for (Iterator it = events.iterator(); it.hasNext();) {
65
				getEventChildren((TPFExecutionEvent) it.next(), c, er);
56
//				getEventChildren((TPFExecutionEvent) it.next(), c, er);
66
			}
57
//			}
67
		}
58
//		}
68
		children = (IProxyNode[]) c.toArray(new IProxyNode[c.size()]);
59
//		children = (IProxyNode[]) c.toArray(new IProxyNode[c.size()]);
60
		children = new IProxyNode[0];
69
		//- save the name of this element
61
		//- save the name of this element
70
		String name = er.getName();
62
		String name = er.getName();
71
		String testName = null; 
63
		String testName = null; 
Lines 106-149 Link Here
106
        } catch (NumberFormatException e) {
98
        } catch (NumberFormatException e) {
107
        	timestamp = 0L;
99
        	timestamp = 0L;
108
        }
100
        }
109
		IMemento [] childrenMemento = memento.getChildren(TestUIConstants.TAG_CHILD);
101
//		IMemento [] childrenMemento = memento.getChildren(TestUIConstants.TAG_CHILD);
110
        LinkedList execChildren = new LinkedList();
102
//        LinkedList execChildren = new LinkedList();
111
		for (int i = 0; i < childrenMemento.length; i++) {
103
//		for (int i = 0; i < childrenMemento.length; i++) {
112
			IMemento mementoChild = childrenMemento[i];
104
//			IMemento mementoChild = childrenMemento[i];
113
            //- inherit the TAG_URI_ROOT which is an extra data contained by the parent
105
//            //- inherit the TAG_URI_ROOT which is an extra data contained by the parent
114
            mementoChild.putString(TestUIConstants.TAG_URI_ROOT, memento.getString(TestUIConstants.TAG_URI_ROOT));
106
//            mementoChild.putString(TestUIConstants.TAG_URI_ROOT, memento.getString(TestUIConstants.TAG_URI_ROOT));
115
			String type = getType();
107
//			String type = getType();
116
			if(type == null) {
108
//			if(type == null) {
117
				throw new ProxyNeedToBeRebuiltException();
109
//				throw new ProxyNeedToBeRebuiltException();
118
			}
110
//			}
119
			ITypedElementProxyFactory factory = TypedElementFactoryManager.getInstance().getFactory(type);
111
//			ITypedElementProxyFactory factory = TypedElementFactoryManager.getInstance().getFactory(type);
120
			if(factory instanceof IPersistableTypedElementProxyFactory) {
112
//			if(factory instanceof IPersistableTypedElementProxyFactory) {
121
                IProxyNode proxy = ((IPersistableTypedElementProxyFactory)factory).recreate(mementoChild, this);
113
//                IProxyNode proxy = ((IPersistableTypedElementProxyFactory)factory).recreate(mementoChild, this);
122
                if(proxy != null) {
114
//                if(proxy != null) {
123
                    execChildren.add(proxy);
115
//                    execChildren.add(proxy);
124
                }
116
//                }
125
			}
117
//			}
126
		}
118
//		}
127
        children = (IProxyNode[]) execChildren.toArray(new IProxyNode[execChildren.size()]);
119
//        children = (IProxyNode[]) execChildren.toArray(new IProxyNode[execChildren.size()]);
128
	}
120
        children = new IProxyNode[0];
129
	
121
	}
130
	/**
122
	
131
	 * @param event
123
//	/**
132
	 * @param parent
124
//	 * @param event
133
	 */
125
//	 * @param parent
134
	private void getEventChildren(TPFExecutionEvent event, List c, TPFExecutionResult parent) {
126
//	 */
135
		if ( event instanceof TPFInvocationEvent) {
127
//	private void getEventChildren(TPFExecutionEvent event, List c, TPFExecutionResult parent) {
136
			TPFExecutionResult er = ((TPFInvocationEvent)event).getInvokedExecutionResult();
128
//		if ( event instanceof TPFInvocationEvent) {
137
            if(er != null) {
129
//			TPFExecutionResult er = ((TPFInvocationEvent)event).getInvokedExecutionResult();
138
                c.add(new DefaultExecutionResultProxyNode(er, parent));
130
//            if(er != null) {
139
            }
131
//                c.add(new DefaultExecutionResultProxyNode(er, parent));
140
		} else {
132
//            }
141
			Iterator iterator = event.getChildren().iterator();
133
//		} else {
142
			while (iterator.hasNext()) {
134
//			Iterator iterator = event.getChildren().iterator();
143
				getEventChildren((TPFExecutionEvent) iterator.next(), c, parent);
135
//			while (iterator.hasNext()) {
144
			}
136
//				getEventChildren((TPFExecutionEvent) iterator.next(), c, parent);
145
		}
137
//			}
146
	}
138
//		}
139
//	}
147
140
148
	public String getText() {
141
	public String getText() {
149
		if (timestamp != 0L) {
142
		if (timestamp != 0L) {
Lines 185-198 Link Here
185
        //- data to retrieve the correct object 
178
        //- data to retrieve the correct object 
186
        memento.putInteger(TAG_VERDICT, getVerdict());
179
        memento.putInteger(TAG_VERDICT, getVerdict());
187
        memento.putString(TAG_TIMESTAMP, Long.toString(timestamp));
180
        memento.putString(TAG_TIMESTAMP, Long.toString(timestamp));
188
        //- children (testcases)
181
//        //- children (testcases)
189
        for (int i = 0; i < children.length; i++) {
182
//        for (int i = 0; i < children.length; i++) {
190
            DefaultExecutionResultProxyNode child = (DefaultExecutionResultProxyNode)children[i];
183
//            DefaultExecutionResultProxyNode child = (DefaultExecutionResultProxyNode)children[i];
191
            IMemento childMemento = memento.createChild(TestUIConstants.TAG_CHILD);
184
//            IMemento childMemento = memento.createChild(TestUIConstants.TAG_CHILD);
192
            if(!child.saveState(childMemento)) {
185
//            if(!child.saveState(childMemento)) {
193
                return false;
186
//                return false;
194
            }
187
//            }
195
        }
188
//        }
196
        return super.saveState(memento);
189
        return super.saveState(memento);
197
    }
190
    }
198
    
191
    

Return to bug 182546