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 129228
Collapse All | Expand All

(-)src/org/eclipse/hyades/test/tools/ui/common/internal/editor/TestCasesForm.java (-4 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 39-49 Link Here
39
import org.eclipse.jface.viewers.ISelectionChangedListener;
39
import org.eclipse.jface.viewers.ISelectionChangedListener;
40
import org.eclipse.jface.viewers.IStructuredSelection;
40
import org.eclipse.jface.viewers.IStructuredSelection;
41
import org.eclipse.jface.viewers.SelectionChangedEvent;
41
import org.eclipse.jface.viewers.SelectionChangedEvent;
42
import org.eclipse.jface.viewers.StructuredSelection;
42
import org.eclipse.swt.custom.StyledText;
43
import org.eclipse.swt.custom.StyledText;
43
import org.eclipse.swt.layout.GridData;
44
import org.eclipse.swt.layout.GridData;
44
import org.eclipse.swt.layout.GridLayout;
45
import org.eclipse.swt.layout.GridLayout;
45
import org.eclipse.swt.widgets.Composite;
46
import org.eclipse.swt.widgets.Composite;
46
import org.eclipse.swt.widgets.Control;
47
import org.eclipse.swt.widgets.Control;
48
import org.eclipse.swt.widgets.Tree;
47
49
48
/**
50
/**
49
 * Form for the <code>Test Cases</code> tab.
51
 * Form for the <code>Test Cases</code> tab.
Lines 52-60 Link Here
52
 * 
54
 * 
53
 * @author  Marcelo Paternostro
55
 * @author  Marcelo Paternostro
54
 * @author  Paul E. Slauenwhite
56
 * @author  Paul E. Slauenwhite
55
 * @version March 14, 2007
57
 * @version April 16, 2008
56
 * @since   February 1, 2005
58
 * @since   February 1, 2005
57
 * @since   1.0.2
58
 */
59
 */
59
public class TestCasesForm
60
public class TestCasesForm
60
extends EditorForm implements ISelectionChangedListener, IITestSuiteProvider
61
extends EditorForm implements ISelectionChangedListener, IITestSuiteProvider
Lines 259-266 Link Here
259
	public void load()
260
	public void load()
260
	{
261
	{
261
		testCasesSection.getTreeViewer().removeSelectionChangedListener(this);
262
		testCasesSection.getTreeViewer().removeSelectionChangedListener(this);
262
		testCasesSection.setInput(getTestSuite());
263
		testCasesSection.setInput(getTestSuite());		
263
		testCasesSection.getTreeViewer().addSelectionChangedListener(this);
264
		testCasesSection.getTreeViewer().addSelectionChangedListener(this);
265
		
266
		//By default, select the first item in the tree:
267
		Tree tree = testCasesSection.getTreeViewer().getTree();
268
		
269
		if(tree.getItemCount() > 0){
270
			selectReveal(new StructuredSelection(tree.getItem(0).getData()));
271
		}
264
	}
272
	}
265
	
273
	
266
	/**
274
	/**
(-)src/org/eclipse/hyades/test/tools/ui/common/internal/editor/TestSuiteEditorExtension.java (-4 / +42 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-26 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.hyades.test.tools.ui.common.internal.editor;
12
package org.eclipse.hyades.test.tools.ui.common.internal.editor;
13
13
14
import org.eclipse.hyades.models.common.facades.behavioral.IAction;
15
import org.eclipse.hyades.models.common.facades.behavioral.IBlock;
16
import org.eclipse.hyades.models.common.facades.behavioral.IImplementor;
17
import org.eclipse.hyades.models.common.facades.behavioral.ITestCase;
14
import org.eclipse.hyades.models.common.facades.behavioral.ITestSuite;
18
import org.eclipse.hyades.models.common.facades.behavioral.ITestSuite;
15
import org.eclipse.hyades.test.tools.ui.common.internal.util.IITestSuiteProvider;
19
import org.eclipse.hyades.test.tools.ui.common.internal.util.IITestSuiteProvider;
16
import org.eclipse.hyades.test.ui.editor.extension.BaseEditorExtension;
20
import org.eclipse.hyades.test.ui.editor.extension.BaseEditorExtension;
17
import org.eclipse.jface.viewers.IStructuredSelection;
21
import org.eclipse.jface.viewers.IStructuredSelection;
18
import org.eclipse.jface.viewers.StructuredSelection;
22
import org.eclipse.jface.viewers.StructuredSelection;
19
23
20
21
/**
24
/**
22
 * @author marcelop
25
 * TestSuiteEditorExtension.java
23
 * @since 1.0.2
26
 * <p/>
27
 * 
28
 * 
29
 * @author  Marcelo Paternostro
30
 * @author  Paul E. Slauenwhite
31
 * @version April 16, 2008
32
 * @since   February 1, 2005
24
 */
33
 */
25
abstract public class TestSuiteEditorExtension 
34
abstract public class TestSuiteEditorExtension 
26
extends BaseEditorExtension implements IITestSuiteProvider
35
extends BaseEditorExtension implements IITestSuiteProvider
Lines 139-142 Link Here
139
		
148
		
140
		return false;
149
		return false;
141
	}
150
	}
151
	
152
	/* (non-Javadoc)
153
	 * @see org.eclipse.hyades.ui.editor.EditorExtension#setSelection(org.eclipse.jface.viewers.IStructuredSelection)
154
	 */
155
	public void setSelection(IStructuredSelection structuredSelection)
156
	{
157
158
		Object object = structuredSelection.getFirstElement();
159
160
		if((object != null) && (object != getTestSuite())){
161
162
			if(object instanceof ITestCase){
163
164
				if(PAGE_TEST_CASES < getHyadesEditorPart().getPageCount()){
165
166
					getHyadesEditorPart().setActivePage(PAGE_TEST_CASES);
167
					getTestCasesForm().selectReveal(structuredSelection);
168
				}
169
			}
170
			else if((object instanceof IImplementor) || (object instanceof IBlock) || (object instanceof IAction)){
171
172
				if(PAGE_BEHAVIOR < getHyadesEditorPart().getPageCount()){
173
174
					getHyadesEditorPart().setActivePage(PAGE_BEHAVIOR);
175
					getBehaviorForm().selectReveal(structuredSelection);
176
				}
177
			}
178
		}
179
	}
142
}
180
}
(-)src/org/eclipse/hyades/test/ui/internal/editor/extension/ArtifactEditorExtension.java (-17 / +39 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-20 Link Here
15
15
16
import org.eclipse.core.runtime.IConfigurationElement;
16
import org.eclipse.core.runtime.IConfigurationElement;
17
import org.eclipse.hyades.models.common.configuration.CFGArtifact;
17
import org.eclipse.hyades.models.common.configuration.CFGArtifact;
18
import org.eclipse.hyades.models.common.facades.behavioral.ITestSuite;
18
import org.eclipse.hyades.test.ui.editor.form.util.WidgetFactory;
19
import org.eclipse.hyades.test.ui.editor.form.util.WidgetFactory;
19
import org.eclipse.hyades.test.ui.internal.editor.form.ArtifactForm;
20
import org.eclipse.hyades.test.ui.internal.editor.form.ArtifactForm;
20
import org.eclipse.hyades.test.ui.internal.editor.form.ConfigurableObjectOverviewForm;
21
import org.eclipse.hyades.test.ui.internal.editor.form.ConfigurableObjectOverviewForm;
Lines 22-34 Link Here
22
import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle;
23
import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle;
23
import org.eclipse.jface.viewers.IStructuredSelection;
24
import org.eclipse.jface.viewers.IStructuredSelection;
24
25
25
26
/**
26
/**
27
 * Hyades configurable object editor extension that is suitable for all 
27
 * Hyades configurable object editor extension that is suitable for all 
28
 * {@link org.eclipse.hyades.models.common.configuration.CFGArtifact} objects.
28
 * {@link org.eclipse.hyades.models.common.configuration.CFGArtifact} objects.
29
 * <p/>
30
 * 
29
 * 
31
 * 
30
 * @author bjiang
32
 * @author  Bianca Xue Jiang
31
 * @since	3.0
33
 * @author  Paul E. Slauenwhite
34
 * @version April 16, 2008
35
 * @since   February 1, 2005
32
 */
36
 */
33
public class ArtifactEditorExtension extends ConfigurableObjectEditorExtension 
37
public class ArtifactEditorExtension extends ConfigurableObjectEditorExtension 
34
{
38
{
Lines 38-56 Link Here
38
	private static final int PAGE_TEST_ASSETS = 1;	
42
	private static final int PAGE_TEST_ASSETS = 1;	
39
	private TestAssetsForm testAssetsForm;
43
	private TestAssetsForm testAssetsForm;
40
	
44
	
41
	/**
42
	 * @see org.eclipse.hyades.ui.util.IDisposable#dispose()
43
	 */
44
	public void dispose()
45
	{
46
		if(testAssetsForm != null)
47
		{
48
		    testAssetsForm.dispose();
49
		    testAssetsForm = null;
50
		}	
51
		super.dispose();
52
	}
53
	
54
	protected IConfigurationElement[] collectPropertyGroupExtensions() 
45
	protected IConfigurationElement[] collectPropertyGroupExtensions() 
55
	{
46
	{
56
		IConfigurationElement[] extensions = super.collectPropertyGroupExtensions();		
47
		IConfigurationElement[] extensions = super.collectPropertyGroupExtensions();		
Lines 75-80 Link Here
75
		}
66
		}
76
		return registeredExtensions;
67
		return registeredExtensions;
77
	}
68
	}
69
	
70
	/**
71
	 * @see org.eclipse.hyades.ui.util.IDisposable#dispose()
72
	 */
73
	public void dispose()
74
	{
75
		if(testAssetsForm != null)
76
		{
77
		    testAssetsForm.dispose();
78
		    testAssetsForm = null;
79
		}	
80
		super.dispose();
81
	}
78
82
79
	/**
83
	/**
80
	 * @see org.eclipse.hyades.ui.editor.IEditorExtension#createPages()
84
	 * @see org.eclipse.hyades.ui.editor.IEditorExtension#createPages()
Lines 136-139 Link Here
136
		else
140
		else
137
			return super.getSelection();
141
			return super.getSelection();
138
	}	
142
	}	
143
	
144
	/* (non-Javadoc)
145
	 * @see org.eclipse.hyades.ui.editor.EditorExtension#setSelection(org.eclipse.jface.viewers.IStructuredSelection)
146
	 */
147
	public void setSelection(IStructuredSelection structuredSelection){
148
149
		if(structuredSelection.getFirstElement() instanceof ITestSuite){
150
151
			if(PAGE_TEST_ASSETS < getHyadesEditorPart().getPageCount()){
152
153
				getHyadesEditorPart().setActivePage(PAGE_TEST_ASSETS);
154
				testAssetsForm.selectReveal(structuredSelection);
155
			}
156
		}
157
		else{
158
			super.setSelection(structuredSelection);
159
		}
160
	}
139
}
161
}
(-)src/org/eclipse/hyades/test/ui/internal/editor/extension/ConfigurableObjectEditorExtension.java (-3 / +44 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 20-25 Link Here
20
import org.eclipse.core.runtime.Platform;
20
import org.eclipse.core.runtime.Platform;
21
import org.eclipse.emf.common.util.EList;
21
import org.eclipse.emf.common.util.EList;
22
import org.eclipse.emf.ecore.EObject;
22
import org.eclipse.emf.ecore.EObject;
23
import org.eclipse.hyades.models.common.configuration.CFGComparableProperty;
23
import org.eclipse.hyades.models.common.configuration.CFGConfigurableObject;
24
import org.eclipse.hyades.models.common.configuration.CFGConfigurableObject;
24
import org.eclipse.hyades.models.common.configuration.CFGPropertyGroup;
25
import org.eclipse.hyades.models.common.configuration.CFGPropertyGroup;
25
import org.eclipse.hyades.models.common.configuration.Common_ConfigurationFactory;
26
import org.eclipse.hyades.models.common.configuration.Common_ConfigurationFactory;
Lines 36-44 Link Here
36
37
37
/**
38
/**
38
 * This is the base class for Hyades configuration editor extension.
39
 * This is the base class for Hyades configuration editor extension.
40
 * <p/>
39
 * 
41
 * 
40
 * @author bjiang
42
 * 
41
 * @since  1.3
43
 * @author  Bianca Xue Jiang
44
 * @author  Paul E. Slauenwhite
45
 * @version April 16, 2008
46
 * @since   February 1, 2005
42
 */
47
 */
43
public class ConfigurableObjectEditorExtension extends BaseEditorExtension implements IExtensibleEditorExtension
48
public class ConfigurableObjectEditorExtension extends BaseEditorExtension implements IExtensibleEditorExtension
44
{	
49
{	
Lines 224-229 Link Here
224
		return StructuredSelection.EMPTY;
229
		return StructuredSelection.EMPTY;
225
	}
230
	}
226
	
231
	
232
	/* (non-Javadoc)
233
	 * @see org.eclipse.hyades.ui.editor.EditorExtension#setSelection(org.eclipse.jface.viewers.IStructuredSelection)
234
	 */
235
	public void setSelection(IStructuredSelection structuredSelection){
236
237
		Object object = structuredSelection.getFirstElement();
238
239
		if(object instanceof CFGComparableProperty){
240
			
241
			EObject selectionPropertyEContainer = ((CFGComparableProperty)(object)).eContainer();
242
			
243
			if(selectionPropertyEContainer instanceof CFGPropertyGroup){
244
			
245
				String selectionPropertyGroupId = ((CFGPropertyGroup)(selectionPropertyEContainer)).getPropertyGroupID();
246
				Iterator pageIndexes = extensionPagesMap.keySet().iterator();
247
				
248
				while(pageIndexes.hasNext()){
249
					
250
					int pageIndex = ((Integer)(pageIndexes.next())).intValue();
251
					IPropertyGroupForm propertyGroupForm = ((IPropertyGroupForm)(extensionPagesMap.get(new Integer(pageIndex))));
252
					
253
					if(propertyGroupForm.getPropertyGroup().getPropertyGroupID().equals(selectionPropertyGroupId)){
254
						
255
						if(pageIndex < getHyadesEditorPart().getPageCount()){
256
			
257
							getHyadesEditorPart().setActivePage(pageIndex);
258
							propertyGroupForm.selectReveal(structuredSelection);
259
						}
260
						
261
						break;
262
					}
263
				}
264
			}
265
		}		
266
	}
267
	
227
	/**
268
	/**
228
	 * @see org.eclipse.hyades.ui.editor.IEditorExtension#pageActivated(int)
269
	 * @see org.eclipse.hyades.ui.editor.IEditorExtension#pageActivated(int)
229
	 */
270
	 */

Return to bug 129228