Community
Participate
Working Groups
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)
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.
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.
Consider merging org.eclipse.hyades.test.ui.util.TestUIUtil with org.eclipse.hyades.ui.util.LocationValidator or eliminate duplicate code.
(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.
(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.
(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).
Created attachment 150393 [details] Patch.
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.
Created attachment 150665 [details] Patch (Part 2).
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).
Verified in TPTP-4.6.2-201001041900 (SDK). Closing.