Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 279090 - Provide public APIs for resolving the Test Navigator's file proxy manager, validating names, and opening editors.
Summary: Provide public APIs for resolving the Test Navigator's file proxy manager, va...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Paul Slauenwhite CLA
QA Contact: Kathy Chan CLA
URL:
Whiteboard: adopter
Keywords:
Depends on:
Blocks: 160861 290254 294782 294787 297505 299269
  Show dependency tree
 
Reported: 2009-06-04 08:04 EDT by Paul Slauenwhite CLA
Modified: 2016-05-05 10:58 EDT (History)
1 user (show)

See Also:


Attachments
Patch Part 1. (6.21 KB, patch)
2009-09-02 12:06 EDT, Paul Slauenwhite CLA
no flags Details | Diff
Patch. (126.24 KB, patch)
2009-10-23 14:12 EDT, Paul Slauenwhite CLA
no flags Details | Diff
Patch (Part 2). (17.73 KB, patch)
2009-10-27 14:38 EDT, Paul Slauenwhite CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Slauenwhite CLA 2009-06-04 08:04:58 EDT
Provide public APIs for resolving the Test Navigator's file proxy manager, validating names, and opening editors.

Resolving the Test Navigator's file proxy manager:

//Resolve the file proxy manager:
			IFileProxyManager fileProxyManager = null;
			TestNavigator testNavigator = TestNavigator.getTestNavigator(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
	
			if (testNavigator != null) {
				fileProxyManager = testNavigator.getCurrentFileProxyManager();
			}
			else {
				fileProxyManager = new FileProxyManager();
			}

This code should be available in a public API.  There are numerous places within the TPTP Test Project code that use this code (or something similar) and can be replaced by a call to the new public API.

Validating ports/names:

org.eclipse.hyades.test.ui.internal.util.TestUIUtilities.isValidOSFileName(String, IContainer)1
org.eclipse.hyades.test.ui.internal.util.TestUIUtilities.isValidOSFilePath(String)
org.eclipse.hyades.test.ui.internal.util.TestUIUtilities.isNameValid(String, IContainer)2

1: Change to validateOSFileName.
2: Change to isValidOSFileName.

Opening editors:

org.eclipse.hyades.test.ui.internal.util.TestUIUtilities.openEditor(EObject, String)
org.eclipse.hyades.test.ui.internal.util.TestUIUtilities.openEditor(IEditorInput, String)
org.eclipse.hyades.test.ui.internal.util.TestUIUtilities.openEditor(IFile, String)
org.eclipse.hyades.test.ui.internal.util.TestUIUtilities.openEditor(Resource, String)
Comment 1 Paul Slauenwhite CLA 2009-06-11 09:49:00 EDT
Consider moving all methods in org.eclipse.hyades.test.ui.internal.util.TestUIUtilities to org.eclipse.hyades.test.ui.util.TestUIUtil and mark them as provisional.

In addition, all of the methods in org.eclipse.hyades.test.ui.util.TestUIUtil require JUnit tests.
Comment 2 Paul Slauenwhite CLA 2009-09-02 12:06:50 EDT
Created attachment 146291 [details]
Patch Part 1.

Requires JUnit test cases for each new public API covering the pre/post conditions documented in the JavaDoc method comment.
Comment 3 Paul Slauenwhite CLA 2009-10-22 13:58:31 EDT
Consider merging org.eclipse.hyades.test.ui.util.TestUIUtil with org.eclipse.hyades.ui.util.LocationValidator or eliminate duplicate code.
Comment 4 Paul Slauenwhite CLA 2009-10-22 14:14:21 EDT
(In reply to comment #0)
> Provide public APIs for resolving the Test Navigator's file proxy manager,
> validating names, and opening editors.
> 
> Resolving the Test Navigator's file proxy manager:
> 
> //Resolve the file proxy manager:
>             IFileProxyManager fileProxyManager = null;
>             TestNavigator testNavigator =
> TestNavigator.getTestNavigator(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
> 
>             if (testNavigator != null) {
>                 fileProxyManager = testNavigator.getCurrentFileProxyManager();
>             }
>             else {
>                 fileProxyManager = new FileProxyManager();
>             }
> 
> This code should be available in a public API.  There are numerous places
> within the TPTP Test Project code that use this code (or something similar) and
> can be replaced by a call to the new public API.

A static API is already available.  See org.eclipse.hyades.test.ui.internal.navigator.TestNavigator.getFileProxyManager().  Refactored API and all code to leverage this API.
Comment 5 Paul Slauenwhite CLA 2009-10-22 15:14:21 EDT
(In reply to comment #1)
> Consider moving all methods in
> org.eclipse.hyades.test.ui.internal.util.TestUIUtilities to
> org.eclipse.hyades.test.ui.util.TestUIUtil and mark them as provisional.

Several methods in org.eclipse.hyades.test.ui.internal.util.TestUIUtilities should remain internal.
Comment 6 Paul Slauenwhite CLA 2009-10-23 14:04:25 EDT
(In reply to comment #3)
> Consider merging org.eclipse.hyades.test.ui.util.TestUIUtil with
> org.eclipse.hyades.ui.util.LocationValidator or eliminate duplicate code.

No the right approach since TestUIUtil contains Test Project-specific API (e.g. logical name validation).
Comment 7 Paul Slauenwhite CLA 2009-10-23 14:12:18 EDT
Created attachment 150393 [details]
Patch.
Comment 8 Paul Slauenwhite CLA 2009-10-23 14:15:16 EDT
The attached patch includes the new public API and JavaDoc documentation or validating resource and logical paths/names and opening editors using the Test Project preference.  In addition, other areas of the code were refactored for cleanliness and maintainability.

JUnits are outstanding.
Comment 9 Paul Slauenwhite CLA 2009-10-27 14:38:54 EDT
Created attachment 150665 [details]
Patch (Part 2).
Comment 10 Paul Slauenwhite CLA 2009-10-27 14:39:38 EDT
Created extensive JUnit tests for the non-deprecated API in org.eclipse.hyades.test.ui.util.TestUIUtil in /org.eclipse.hyades.test.ui.navigator.tests/junit_plugin/Test.UI.TestUIUtilTest.testsuite.  

Patch (part 2) includes changes to resolves issues found when writing/executing the JUnit tests.

The attached patch (part 2) and the test suite checked in to CVS (HEAD).
Comment 11 Paul Slauenwhite CLA 2010-01-07 10:51:58 EST
Verified in TPTP-4.6.2-201001041900 (SDK).

Closing.