Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2010-07-24 17:38:31 +0000
committerrbrooks2010-07-24 17:38:31 +0000
commit4081f04850d3eff9eb1bd7241763707bfbb43a45 (patch)
tree258620df94d4b24077ff103a6c4dea9cb78493fb /plugins/org.eclipse.osee.ote.ui.test.manager
parent4ed8bddc791fda93940f238c5135556a07041dc0 (diff)
downloadorg.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.gz
org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.xz
org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.zip
applied Eclipse source cleanup
Diffstat (limited to 'plugins/org.eclipse.osee.ote.ui.test.manager')
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/ITestManagerFactory.java2
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerEditorAction.java4
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java12
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/TMBugAction.java3
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchDecorator.java69
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchProjectNature.java402
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/AddTestBatchProjectNature.java11
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/RemoveTestBatchProjectNature.java13
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/ProjectSetupItem.java5
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchData.java8
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchRegistry.java3
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupItem.java20
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupViewItems.java5
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/ResourceFinder.java4
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/SelectionUtil.java3
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ConfigFileHandler.java14
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ISaveConfig.java2
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/LoadConfigurationOperation.java8
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/SaveWidget.java6
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/LoadScriptPage.java230
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/SaveScriptPage.java22
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java353
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptQueue.java9
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/StatusBoardRecieveEvent.java2
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java572
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerStatusListener.java3
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java6
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java1059
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorContributor.java62
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInput.java22
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInputFactory.java1
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerInput.java19
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java31
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/ScriptRunJob.java224
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java228
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/FileModel.java39
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/OutputModelJob.java26
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/ScriptModel.java293
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/operations/AddIFileToTestManager.java10
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/HostPage.java145
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/OverviewPage.java8
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/ScriptPage.java835
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/StatusWindowWidget.java192
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/contributions/ScriptExecutionContribution.java10
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java107
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTask.java32
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTaskList.java27
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTable.java2
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableContentProvider.java8
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableFactory.java32
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/panels/LoggingPanel.java4
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/TestManagerPreferencePage.java7
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageDataViewer.java214
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageEventHandler.java160
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferenceNode.java2
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferencePage.java19
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java20
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialog.java5
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialogHelper.java11
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialog.java12
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialogHelper.java9
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/TestManagerSelectDialog.java3
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/WidgetFactory.java3
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizard.java48
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizardPage.java29
65 files changed, 2935 insertions, 2814 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/ITestManagerFactory.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/ITestManagerFactory.java
index 9ee819db7b..56d0e28445 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/ITestManagerFactory.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/ITestManagerFactory.java
@@ -27,7 +27,7 @@ public interface ITestManagerFactory {
public String getEditorId();
public String getEditorLastOpenedKey();
-
+
public ScriptPage getScriptPageNewInstance(Composite parent, int style, TestManagerEditor parentTestManager);
public String getTestManagerExtension();
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerEditorAction.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerEditorAction.java
index adaa83982e..ce3a21a795 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerEditorAction.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerEditorAction.java
@@ -26,7 +26,7 @@ import org.eclipse.ui.PlatformUI;
public class AddToTestManagerEditorAction implements IEditorActionDelegate {
-
+ @Override
public void run(IAction action) {
// Get IFile of current editor
IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
@@ -45,9 +45,11 @@ public class AddToTestManagerEditorAction implements IEditorActionDelegate {
AddIFileToTestManager.getOperation().addIFileToScriptsPage(iFile.getLocation().toOSString());
}
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
}
+ @Override
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java
index 653752754d..2b02b45961 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java
@@ -32,10 +32,14 @@ public class AddToTestManagerPopupAction implements IWorkbenchWindowActionDelega
Object obj = i.next();
if (obj instanceof IResource) {
IResource resource = (IResource) obj;
- if (resource != null) selection = resource.getLocation().toOSString();
+ if (resource != null) {
+ selection = resource.getLocation().toOSString();
+ }
} else if (obj instanceof ICompilationUnit) {
ICompilationUnit resource = (ICompilationUnit) obj;
- if (resource != null) selection = resource.getResource().getLocation().toOSString();
+ if (resource != null) {
+ selection = resource.getResource().getLocation().toOSString();
+ }
}
}
return selection;
@@ -44,15 +48,18 @@ public class AddToTestManagerPopupAction implements IWorkbenchWindowActionDelega
IWorkbenchWindow activeWindow = null;
// IWorkbenchWindowActionDelegate method
+ @Override
public void dispose() {
// nothing to do
}
// IWorkbenchWindowActionDelegate method
+ @Override
public void init(IWorkbenchWindow window) {
activeWindow = window;
}
+ @Override
public void run(IAction proxyAction) {
String file = getSelection();
if (file == null || file.equals("")) {
@@ -63,6 +70,7 @@ public class AddToTestManagerPopupAction implements IWorkbenchWindowActionDelega
}
// IActionDelegate method
+ @Override
public void selectionChanged(IAction proxyAction, ISelection selection) {
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/TMBugAction.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/TMBugAction.java
index f2726d74ac..07d1d2889a 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/TMBugAction.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/TMBugAction.java
@@ -17,13 +17,16 @@ import org.eclipse.ui.IEditorPart;
public class TMBugAction implements IEditorActionDelegate {
+ @Override
public void run(IAction action) {
}
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
}
+ @Override
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchDecorator.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchDecorator.java
index 3a7e72c692..8f95ef2d28 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchDecorator.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchDecorator.java
@@ -31,41 +31,42 @@ import org.eclipse.ui.IDecoratorManager;
* @author Roberto E. Escobar
*/
public class TestBatchDecorator extends LabelProvider implements ILightweightLabelDecorator {
- private static final String DECORATOR_ID = "org.eclipse.osee.ote.ui.test.manager.decorator";
- private static final ImageDescriptor IMAGE = ImageManager.getImageDescriptor(OteTestManagerImage.TEST);
+ private static final String DECORATOR_ID = "org.eclipse.osee.ote.ui.test.manager.decorator";
+ private static final ImageDescriptor IMAGE = ImageManager.getImageDescriptor(OteTestManagerImage.TEST);
- public void decorate(Object element, IDecoration decoration) {
- try {
- IProject project = null;
- if (element instanceof IJavaProject) {
- project = ((IJavaProject) element).getProject();
- } else {
- project = (IProject) element;
- }
- if (project.isOpen() && project.hasNature(TestBatchProjectNature.NATURE_ID)) {
- decoration.addOverlay(IMAGE);
- }
- } catch (Exception ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, SelectionUtil.getStatusMessages(ex));
- }
- }
+ @Override
+ public void decorate(Object element, IDecoration decoration) {
+ try {
+ IProject project = null;
+ if (element instanceof IJavaProject) {
+ project = ((IJavaProject) element).getProject();
+ } else {
+ project = (IProject) element;
+ }
+ if (project.isOpen() && project.hasNature(TestBatchProjectNature.NATURE_ID)) {
+ decoration.addOverlay(IMAGE);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, SelectionUtil.getStatusMessages(ex));
+ }
+ }
- private void startDecoratorUpdate(IProject project) {
- final LabelProviderChangedEvent evnt = new LabelProviderChangedEvent(this, project);
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- fireLabelProviderChanged(evnt);
- }
- });
- }
+ private void startDecoratorUpdate(IProject project) {
+ final LabelProviderChangedEvent evnt = new LabelProviderChangedEvent(this, project);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ fireLabelProviderChanged(evnt);
+ }
+ });
+ }
- public static void performLabelDecoratorUpdate(IProject project) {
- IDecoratorManager decoratorManager = TestManagerPlugin.getInstance().getWorkbench().getDecoratorManager();
- IBaseLabelProvider provider = decoratorManager.getBaseLabelProvider(DECORATOR_ID);
- if (provider != null) {
- TestBatchDecorator decorator = (TestBatchDecorator) provider;
- decorator.startDecoratorUpdate(project);
- }
- }
+ public static void performLabelDecoratorUpdate(IProject project) {
+ IDecoratorManager decoratorManager = TestManagerPlugin.getInstance().getWorkbench().getDecoratorManager();
+ IBaseLabelProvider provider = decoratorManager.getBaseLabelProvider(DECORATOR_ID);
+ if (provider != null) {
+ TestBatchDecorator decorator = (TestBatchDecorator) provider;
+ decorator.startDecoratorUpdate(project);
+ }
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchProjectNature.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchProjectNature.java
index c3c0dec398..a8934aad0f 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchProjectNature.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchProjectNature.java
@@ -36,205 +36,205 @@ import org.eclipse.osee.ote.ui.test.manager.internal.TestManagerPlugin;
* @author Roberto E. Escobar
*/
public class TestBatchProjectNature implements IProjectNature {
- public static final String NATURE_ID = "org.eclipse.osee.ote.ui.test.manager.TestBatchProjectNature";
- private IProject project;
- private final ResourceFinder resourceFinder;
- private final IResourceChangeListener resourceChangeListener;
- private final IResourceChangeListener projectClosedListener;
- private final IResourceChangeListener projectDeletedListener;
- private final FindResourceWorker worker;
-
- public TestBatchProjectNature() {
- this.resourceFinder = new ResourceFinder();
- this.resourceChangeListener = new TestBatchResourceChangeListener();
- this.projectClosedListener = new TestBatchProjectClosedListener();
- this.projectDeletedListener = new TestBatchProjectDeletedListener();
- this.worker = new FindResourceWorker(this);
- }
-
- @Override
- public void configure() throws CoreException {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
- workspace.addResourceChangeListener(projectClosedListener, IResourceChangeEvent.PRE_CLOSE);
- workspace.addResourceChangeListener(projectDeletedListener, IResourceChangeEvent.PRE_DELETE);
- ResourcesPlugin.getWorkspace().getRoot().getWorkspace().run(worker, new NullProgressMonitor());
- }
-
- @Override
- public void deconfigure() throws CoreException {
- TestBatchRegistry registry = TestBatchSetupViewItems.getInstance().getRegistry();
- for (String key : resourceFinder.getIds()) {
- registry.deregisterTestBatch(key);
- }
- TestBatchDecorator.performLabelDecoratorUpdate(project);
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.removeResourceChangeListener(resourceChangeListener);
- workspace.removeResourceChangeListener(projectClosedListener);
- workspace.removeResourceChangeListener(projectDeletedListener);
- }
-
- @Override
- public IProject getProject() {
- return this.project;
- }
-
- @Override
- public void setProject(IProject project) {
- this.project = project;
- }
-
- public ResourceFinder getResourceFinder() {
- return resourceFinder;
- }
-
- public FindResourceWorker getWorker() {
- return worker;
- }
-
- public static void initializeProjectSet() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (IProject project : projects) {
- try {
- if (project != null && project.isOpen() == true) {
- IProjectNature nature = project.getNature(TestBatchProjectNature.NATURE_ID);
- if (nature != null) {
- nature.configure();
- }
- }
- } catch (CoreException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Error initializing project nature", ex);
- }
- }
- }
- });
- }
-
- private final class TestBatchProjectDeletedListener implements IResourceChangeListener {
-
- @Override
- public void resourceChanged(IResourceChangeEvent event) {
- try {
- IResource resource = event.getResource();
- if (resource != null) {
- IProject project = resource.getProject();
- if (project != null) {
- final IProjectNature nature = project.getNature(NATURE_ID);
- if (nature != null) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- TestBatchProjectNature batchProjectNature = (TestBatchProjectNature) nature;
- TestBatchRegistry registry = TestBatchSetupViewItems.getInstance().getRegistry();
- for (String key : batchProjectNature.getResourceFinder().getIds()) {
- registry.deregisterTestBatch(key);
- }
- }
- });
- }
- }
- }
- } catch (CoreException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Error during resource change event", ex);
- }
- }
-
- }
-
- private final class TestBatchProjectClosedListener implements IResourceChangeListener {
- @Override
- public void resourceChanged(IResourceChangeEvent event) {
- try {
- IResource resource = event.getResource();
- if (resource != null) {
- IProject project = resource.getProject();
- if (project != null) {
- final IProjectNature nature = project.getNature(NATURE_ID);
- if (nature != null) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- TestBatchProjectNature tbpNature = (TestBatchProjectNature) nature;
- TestBatchRegistry registry = TestBatchSetupViewItems.getInstance().getRegistry();
- for (String key : tbpNature.getResourceFinder().getIds()) {
- registry.deregisterTestBatch(key);
- }
- }
- });
- }
- }
- }
- } catch (CoreException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Error during resource change event", ex);
- }
- }
- }
-
- private final class TestBatchResourceChangeListener implements IResourceChangeListener {
- @Override
- public void resourceChanged(IResourceChangeEvent event) {
- try {
- IResourceDelta delta = event.getDelta();
- IResourceDelta[] children = delta.getAffectedChildren();
- for (IResourceDelta childDelta : children) {
- IResource resource = childDelta.getResource();
- if (resource != null) {
- IProject project = resource.getProject();
- if (project != null) {
- if (project.isOpen() != false && project.isNatureEnabled(NATURE_ID)) {
- final IProjectNature nature = project.getNature(NATURE_ID);
- if (nature != null) {
- handleProjectFilesChanging((TestBatchProjectNature) nature);
- }
- }
- }
- }
- }
- } catch (CoreException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Error during resource change event", ex);
- }
- }
-
- private void handleProjectFilesChanging(final TestBatchProjectNature nature) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- nature.getWorker().run(new NullProgressMonitor());
- } catch (CoreException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
- }
- }
- });
- }
- };
-
- private final class FindResourceWorker implements IWorkspaceRunnable {
-
- private final TestBatchProjectNature nature;
-
- public FindResourceWorker(TestBatchProjectNature nature) {
- this.nature = nature;
- }
-
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- ResourceFinder finder = nature.getResourceFinder();
- finder.findBatchAndProjectFiles(nature.getProject());
- TestBatchRegistry registry = TestBatchSetupViewItems.getInstance().getRegistry();
- for (String key : finder.getIds()) {
- Pair<IFile, IFile> fileSet = finder.getFileSet(key);
- registry.registerTestBatch(key, fileSet.getFirst().getLocationURI(), fileSet.getSecond().getLocationURI());
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- TestBatchDecorator.performLabelDecoratorUpdate(nature.getProject());
- }
- });
- }
- }
+ public static final String NATURE_ID = "org.eclipse.osee.ote.ui.test.manager.TestBatchProjectNature";
+ private IProject project;
+ private final ResourceFinder resourceFinder;
+ private final IResourceChangeListener resourceChangeListener;
+ private final IResourceChangeListener projectClosedListener;
+ private final IResourceChangeListener projectDeletedListener;
+ private final FindResourceWorker worker;
+
+ public TestBatchProjectNature() {
+ this.resourceFinder = new ResourceFinder();
+ this.resourceChangeListener = new TestBatchResourceChangeListener();
+ this.projectClosedListener = new TestBatchProjectClosedListener();
+ this.projectDeletedListener = new TestBatchProjectDeletedListener();
+ this.worker = new FindResourceWorker(this);
+ }
+
+ @Override
+ public void configure() throws CoreException {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ workspace.addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
+ workspace.addResourceChangeListener(projectClosedListener, IResourceChangeEvent.PRE_CLOSE);
+ workspace.addResourceChangeListener(projectDeletedListener, IResourceChangeEvent.PRE_DELETE);
+ ResourcesPlugin.getWorkspace().getRoot().getWorkspace().run(worker, new NullProgressMonitor());
+ }
+
+ @Override
+ public void deconfigure() throws CoreException {
+ TestBatchRegistry registry = TestBatchSetupViewItems.getInstance().getRegistry();
+ for (String key : resourceFinder.getIds()) {
+ registry.deregisterTestBatch(key);
+ }
+ TestBatchDecorator.performLabelDecoratorUpdate(project);
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ workspace.removeResourceChangeListener(resourceChangeListener);
+ workspace.removeResourceChangeListener(projectClosedListener);
+ workspace.removeResourceChangeListener(projectDeletedListener);
+ }
+
+ @Override
+ public IProject getProject() {
+ return this.project;
+ }
+
+ @Override
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ public ResourceFinder getResourceFinder() {
+ return resourceFinder;
+ }
+
+ public FindResourceWorker getWorker() {
+ return worker;
+ }
+
+ public static void initializeProjectSet() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (IProject project : projects) {
+ try {
+ if (project != null && project.isOpen() == true) {
+ IProjectNature nature = project.getNature(TestBatchProjectNature.NATURE_ID);
+ if (nature != null) {
+ nature.configure();
+ }
+ }
+ } catch (CoreException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Error initializing project nature", ex);
+ }
+ }
+ }
+ });
+ }
+
+ private final class TestBatchProjectDeletedListener implements IResourceChangeListener {
+
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ try {
+ IResource resource = event.getResource();
+ if (resource != null) {
+ IProject project = resource.getProject();
+ if (project != null) {
+ final IProjectNature nature = project.getNature(NATURE_ID);
+ if (nature != null) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ TestBatchProjectNature batchProjectNature = (TestBatchProjectNature) nature;
+ TestBatchRegistry registry = TestBatchSetupViewItems.getInstance().getRegistry();
+ for (String key : batchProjectNature.getResourceFinder().getIds()) {
+ registry.deregisterTestBatch(key);
+ }
+ }
+ });
+ }
+ }
+ }
+ } catch (CoreException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Error during resource change event", ex);
+ }
+ }
+
+ }
+
+ private final class TestBatchProjectClosedListener implements IResourceChangeListener {
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ try {
+ IResource resource = event.getResource();
+ if (resource != null) {
+ IProject project = resource.getProject();
+ if (project != null) {
+ final IProjectNature nature = project.getNature(NATURE_ID);
+ if (nature != null) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ TestBatchProjectNature tbpNature = (TestBatchProjectNature) nature;
+ TestBatchRegistry registry = TestBatchSetupViewItems.getInstance().getRegistry();
+ for (String key : tbpNature.getResourceFinder().getIds()) {
+ registry.deregisterTestBatch(key);
+ }
+ }
+ });
+ }
+ }
+ }
+ } catch (CoreException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Error during resource change event", ex);
+ }
+ }
+ }
+
+ private final class TestBatchResourceChangeListener implements IResourceChangeListener {
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ try {
+ IResourceDelta delta = event.getDelta();
+ IResourceDelta[] children = delta.getAffectedChildren();
+ for (IResourceDelta childDelta : children) {
+ IResource resource = childDelta.getResource();
+ if (resource != null) {
+ IProject project = resource.getProject();
+ if (project != null) {
+ if (project.isOpen() != false && project.isNatureEnabled(NATURE_ID)) {
+ final IProjectNature nature = project.getNature(NATURE_ID);
+ if (nature != null) {
+ handleProjectFilesChanging((TestBatchProjectNature) nature);
+ }
+ }
+ }
+ }
+ }
+ } catch (CoreException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Error during resource change event", ex);
+ }
+ }
+
+ private void handleProjectFilesChanging(final TestBatchProjectNature nature) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ nature.getWorker().run(new NullProgressMonitor());
+ } catch (CoreException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+ }
+ };
+
+ private final class FindResourceWorker implements IWorkspaceRunnable {
+
+ private final TestBatchProjectNature nature;
+
+ public FindResourceWorker(TestBatchProjectNature nature) {
+ this.nature = nature;
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ResourceFinder finder = nature.getResourceFinder();
+ finder.findBatchAndProjectFiles(nature.getProject());
+ TestBatchRegistry registry = TestBatchSetupViewItems.getInstance().getRegistry();
+ for (String key : finder.getIds()) {
+ Pair<IFile, IFile> fileSet = finder.getFileSet(key);
+ registry.registerTestBatch(key, fileSet.getFirst().getLocationURI(), fileSet.getSecond().getLocationURI());
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ TestBatchDecorator.performLabelDecoratorUpdate(nature.getProject());
+ }
+ });
+ }
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/AddTestBatchProjectNature.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/AddTestBatchProjectNature.java
index c4f9bb255b..55aa3f425e 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/AddTestBatchProjectNature.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/AddTestBatchProjectNature.java
@@ -42,10 +42,12 @@ public class AddTestBatchProjectNature implements IObjectActionDelegate {
private IJavaProject currentJavaProject;
private IProject currentProject;
+ @Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
// Do Nothing
}
+ @Override
public void run(IAction action) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
Cursor waitCursor = new Cursor(window.getShell().getDisplay(), SWT.CURSOR_WAIT);
@@ -66,7 +68,7 @@ public class AddTestBatchProjectNature implements IObjectActionDelegate {
description.setNatureIds(newNatures);
currentProject.setDescription(description, null);
- currentJavaProject = (IJavaProject) JavaCore.create((IProject) currentProject);
+ currentJavaProject = JavaCore.create(currentProject);
} else {
//add the test batch nature, the java nature is already present
IProjectDescription description = currentJavaProject.getProject().getDescription();
@@ -83,17 +85,18 @@ public class AddTestBatchProjectNature implements IObjectActionDelegate {
((ApplicationWindow) window).setStatus(NATURE_ADDED);
} catch (Exception ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, String.format("Error adding test batch nature on [%s]",
- currentJavaProject.getProject().getName()), ex);
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE,
+ String.format("Error adding test batch nature on [%s]", currentJavaProject.getProject().getName()), ex);
Shell shell = new Shell();
MessageDialog.openInformation(shell, TestManagerPlugin.PLUGIN_ID,
- "Error adding test batch nature:\n" + SelectionUtil.getStatusMessages(ex));
+ "Error adding test batch nature:\n" + SelectionUtil.getStatusMessages(ex));
} finally {
window.getShell().setCursor(null);
waitCursor.dispose();
}
}
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
currentJavaProject = SelectionUtil.findSelectedJavaProject(selection);
if (currentJavaProject == null) {
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/RemoveTestBatchProjectNature.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/RemoveTestBatchProjectNature.java
index ee5074d6b6..2ca58e7e17 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/RemoveTestBatchProjectNature.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/actions/RemoveTestBatchProjectNature.java
@@ -41,6 +41,7 @@ public class RemoveTestBatchProjectNature implements IObjectActionDelegate {
private IJavaProject currentJavaProject;
private IProject currentProject;
+ @Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
// Do Nothing
}
@@ -49,17 +50,18 @@ public class RemoveTestBatchProjectNature implements IObjectActionDelegate {
List<String> list = new ArrayList<String>();
for (int i = 0; i < natures.length; i++) {
- if (!(natures[i].equalsIgnoreCase(TestBatchProjectNature.NATURE_ID))) {
+ if (!natures[i].equalsIgnoreCase(TestBatchProjectNature.NATURE_ID)) {
list.add(natures[i]);
}
}
String[] newNatures = new String[list.size()];
for (int i = 0; i < list.size(); i++) {
- newNatures[i] = (String) list.get(i);
+ newNatures[i] = list.get(i);
}
return newNatures;
}
+ @Override
public void run(IAction action) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
try {
@@ -96,14 +98,15 @@ public class RemoveTestBatchProjectNature implements IObjectActionDelegate {
currentJavaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
((ApplicationWindow) window).setStatus(NATURE_REMOVED);
} catch (Exception ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, String.format("Error removing test batch nature on [%s]",
- currentJavaProject.getProject().getName()), ex);
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE,
+ String.format("Error removing test batch nature on [%s]", currentJavaProject.getProject().getName()), ex);
Shell shell = new Shell();
MessageDialog.openInformation(shell, TestManagerPlugin.PLUGIN_ID,
- "Error removing test batch nature:\n" + SelectionUtil.getStatusMessages(ex));
+ "Error removing test batch nature:\n" + SelectionUtil.getStatusMessages(ex));
}
}
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
currentJavaProject = SelectionUtil.findSelectedJavaProject(selection);
if (currentJavaProject == null) {
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/ProjectSetupItem.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/ProjectSetupItem.java
index 2c9baf987c..7874951779 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/ProjectSetupItem.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/ProjectSetupItem.java
@@ -25,8 +25,8 @@ import org.eclipse.osee.ote.ui.test.manager.internal.TestManagerPlugin;
* @author Roberto E. Escobar
*/
final class ProjectSetupItem extends XNavigateItem implements Runnable {
- private URI projectSetFile;
- private String jobName;
+ private final URI projectSetFile;
+ private final String jobName;
public ProjectSetupItem(XNavigateItem parent, String name, KeyedImage oseeImage, URI projectSetFile) {
super(parent, name, oseeImage);
@@ -34,6 +34,7 @@ final class ProjectSetupItem extends XNavigateItem implements Runnable {
this.projectSetFile = projectSetFile;
}
+ @Override
public void run() {
try {
URL url = projectSetFile.toURL();
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchData.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchData.java
index d156a701cd..5d55cfed61 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchData.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchData.java
@@ -18,10 +18,10 @@ import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
*/
public class TestBatchData {
- private String name;
- private XNavigateItem itemFolder;
- private URI testBatchFile;
- private URI projectSetFile;
+ private final String name;
+ private final XNavigateItem itemFolder;
+ private final URI testBatchFile;
+ private final URI projectSetFile;
protected TestBatchData(XNavigateItem itemFolder, String name, URI projectSetFile, URI testBatchFile) {
this.name = name;
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchRegistry.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchRegistry.java
index 1866340247..0718402803 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchRegistry.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchRegistry.java
@@ -93,7 +93,8 @@ public class TestBatchRegistry {
// Chain Items
XNavigateItem parentFolder = new XNavigateItem(parent, id, PluginUiImage.FOLDER);
new ProjectSetupItem(parentFolder, id + " Checkout", OteTestManagerImage.PROJECT_SET_IMAGE, projectSetFile);
- new TestBatchSetupItem(parentFolder, id + " Test Manager Batch Config", OteTestManagerImage.TEST_BATCH_IMAGE, testBatchFile);
+ new TestBatchSetupItem(parentFolder, id + " Test Manager Batch Config", OteTestManagerImage.TEST_BATCH_IMAGE,
+ testBatchFile);
// Store into dataObject
return new TestBatchData(parentFolder, id, projectSetFile, testBatchFile);
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupItem.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupItem.java
index 9e50cdb05f..be77a8444d 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupItem.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupItem.java
@@ -29,8 +29,8 @@ import org.eclipse.ui.progress.UIJob;
* @author Roberto E. Escobar
*/
final class TestBatchSetupItem extends XNavigateItem implements Runnable {
- private URI testBatchFile;
- private String jobName;
+ private final URI testBatchFile;
+ private final String jobName;
public TestBatchSetupItem(XNavigateItem parent, String name, KeyedImage oseeImage, URI testBatchFile) {
super(parent, name, oseeImage);
@@ -38,6 +38,7 @@ final class TestBatchSetupItem extends XNavigateItem implements Runnable {
this.testBatchFile = testBatchFile;
}
+ @Override
public void run() {
Job job = new UIJob(jobName) {
@Override
@@ -45,10 +46,10 @@ final class TestBatchSetupItem extends XNavigateItem implements Runnable {
IStatus status = Status.CANCEL_STATUS;
if (PluginUtil.areTestManagersAvailable() != true) {
Exception exception =
- new IllegalStateException("Test Manager was not opened before this operation was selected.");
+ new IllegalStateException("Test Manager was not opened before this operation was selected.");
status =
- new Status(Status.ERROR, TestManagerPlugin.PLUGIN_ID, Status.ERROR,
- "A Test Manager must be opened for this operation to work.", exception);
+ new Status(IStatus.ERROR, TestManagerPlugin.PLUGIN_ID, IStatus.ERROR,
+ "A Test Manager must be opened for this operation to work.", exception);
} else {
TestManagerEditor[] itemsToOpen = PluginUtil.getTestManagers();
if (itemsToOpen.length > 1) {
@@ -62,15 +63,14 @@ final class TestBatchSetupItem extends XNavigateItem implements Runnable {
} else {
Exception exception = new IllegalStateException("Test Manager setup failed.");
status =
- new Status(Status.ERROR, TestManagerPlugin.PLUGIN_ID,
- "Test Manager configuration failed for some unknown reason. Please try again.",
- exception);
+ new Status(IStatus.ERROR, TestManagerPlugin.PLUGIN_ID,
+ "Test Manager configuration failed for some unknown reason. Please try again.", exception);
}
} else {
Exception exception = new IllegalStateException("No Test Manager was selected.");
status =
- new Status(Status.ERROR, TestManagerPlugin.PLUGIN_ID,
- "A Test Manager must be selected for this operation to work.", exception);
+ new Status(IStatus.ERROR, TestManagerPlugin.PLUGIN_ID,
+ "A Test Manager must be selected for this operation to work.", exception);
}
}
return status;
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupViewItems.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupViewItems.java
index e8e110a1e5..a5088aa64b 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupViewItems.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/navigate/TestBatchSetupViewItems.java
@@ -24,8 +24,8 @@ public class TestBatchSetupViewItems implements IXNavigateContainer {
private static final String PARENT_FOLDER_NAME = "Test Batch Setup";
private static TestBatchSetupViewItems instance = null;
- private TestBatchRegistry registry;
- private XNavigateItem parentFolder;
+ private final TestBatchRegistry registry;
+ private final XNavigateItem parentFolder;
public TestBatchSetupViewItems() {
this.parentFolder = new XNavigateItem(null, PARENT_FOLDER_NAME, PluginUiImage.FOLDER);
@@ -42,6 +42,7 @@ public class TestBatchSetupViewItems implements IXNavigateContainer {
return instance;
}
+ @Override
public List<XNavigateItem> getNavigateItems() {
List<XNavigateItem> items = new ArrayList<XNavigateItem>();
items.add(parentFolder);
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/ResourceFinder.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/ResourceFinder.java
index c256d8b5b4..4318241f8f 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/ResourceFinder.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/ResourceFinder.java
@@ -30,7 +30,7 @@ public class ResourceFinder {
private static final String PROJECT_SET_EXTENSION = "psf";
private static final String TEST_BATCH_SET_EXTENSION = "xml";
- private HashCollection<String, IFile> resourceMap;
+ private final HashCollection<String, IFile> resourceMap;
public ResourceFinder() {
this.resourceMap = new HashCollection<String, IFile>();
@@ -96,7 +96,7 @@ public class ResourceFinder {
if (file != null && file.isAccessible() != false) {
String extension = file.getFileExtension();
result =
- extension.equalsIgnoreCase(PROJECT_SET_EXTENSION) || extension.equalsIgnoreCase(TEST_BATCH_SET_EXTENSION);
+ extension.equalsIgnoreCase(PROJECT_SET_EXTENSION) || extension.equalsIgnoreCase(TEST_BATCH_SET_EXTENSION);
}
return result;
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/SelectionUtil.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/SelectionUtil.java
index dac540bbb4..f791191a18 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/SelectionUtil.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/util/SelectionUtil.java
@@ -55,8 +55,9 @@ public class SelectionUtil {
CoreException ce = (CoreException) e;
IStatus status = ce.getStatus();
IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++)
+ for (int i = 0; i < children.length; i++) {
msg += "\n" + children[i].getMessage();
+ }
System.err.println(msg);
ce.printStackTrace(System.err);
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ConfigFileHandler.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ConfigFileHandler.java
index 43cf75aad3..29f34ff10e 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ConfigFileHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ConfigFileHandler.java
@@ -18,10 +18,10 @@ import org.w3c.dom.Element;
public class ConfigFileHandler {
/**
- * Writes the XML in sourceDoc to the test manager config file specified. If the destination file
- * already exists, and contains the XML specified for the sourceDoc's root node, it will be
- * replaced, otherwise it will be appended to the file. If the file does not exist, a new file
- * will be created only containing the sourceDoc underneath a root TestManagerConfig node.
+ * Writes the XML in sourceDoc to the test manager config file specified. If the destination file already exists, and
+ * contains the XML specified for the sourceDoc's root node, it will be replaced, otherwise it will be appended to
+ * the file. If the file does not exist, a new file will be created only containing the sourceDoc underneath a root
+ * TestManagerConfig node.
*
* @param sourceDoc
* @param fileString
@@ -32,8 +32,7 @@ public class ConfigFileHandler {
File file = new File(fileString);
if (file.exists()) {
doc = writeSectionToFile(sourceDoc, file);
- }
- else {
+ } else {
doc = Jaxp.newDocument();
Element root = doc.createElement("TestManagerConfig");
root.appendChild(doc.importNode(sourceDoc.getDocumentElement(), true));
@@ -51,8 +50,7 @@ public class ConfigFileHandler {
if (configNode != null) {
root.removeChild(configNode);
root.appendChild(doc.importNode(nodeToAdd, true));
- }
- else {
+ } else {
root.appendChild(doc.importNode(nodeToAdd, true));
}
return doc;
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ISaveConfig.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ISaveConfig.java
index d0420e8df8..08fb29c124 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ISaveConfig.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/ISaveConfig.java
@@ -17,6 +17,8 @@ import org.w3c.dom.Element;
public abstract interface ISaveConfig {
public abstract Element toXml(Document doc);
+
public abstract void saveConfig(File fileName) throws Exception;
+
public abstract void printXmlTree();
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/LoadConfigurationOperation.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/LoadConfigurationOperation.java
index 8b50277356..16c19cf682 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/LoadConfigurationOperation.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/LoadConfigurationOperation.java
@@ -11,8 +11,8 @@
package org.eclipse.osee.ote.ui.test.manager.configuration;
import java.io.File;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActivator;
import org.eclipse.osee.ote.ui.test.manager.core.TestManagerEditor;
-import org.eclipse.osee.ote.ui.test.manager.internal.TestManagerPlugin;
import org.eclipse.osee.ote.ui.test.manager.pages.ScriptPage;
import org.eclipse.osee.ote.ui.test.manager.pages.StatusWindowWidget;
import org.eclipse.osee.ote.ui.test.manager.util.Dialogs;
@@ -51,13 +51,13 @@ public class LoadConfigurationOperation {
String configFile = testManager.loadValue(testManager.configFileName);
ILoadConfig loadConfig =
- ConfigFactory.getInstance().getLoadConfigHandler(testManager.getPageManager().getScriptPage());
+ ConfigFactory.getInstance().getLoadConfigHandler(testManager.getPageManager().getScriptPage());
try {
loadConfig.loadConfiguration(new File(configFile));
result = true;
} catch (Exception ex) {
- Dialogs.popupError("Error Loading File", String.format("Error loading file: [%s]\n%s", configFile,
- TestManagerPlugin.getStackMessages(ex)));
+ Dialogs.popupError("Error Loading File",
+ String.format("Error loading file: [%s]\n%s", configFile, OseeUiActivator.getStackMessages(ex)));
}
return result;
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/SaveWidget.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/SaveWidget.java
index 2c26ea8dfc..8fa066b031 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/SaveWidget.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/SaveWidget.java
@@ -54,10 +54,12 @@ public class SaveWidget {
saveAsMenuItem.setText("SaveAs...");
saveAsMenuItem.setImage(ImageManager.getImage(OteTestManagerImage.SAVEAS_EDIT));
saveAsMenuItem.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
String[] filterExtensions = {"*.xml"};
FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
@@ -130,8 +132,8 @@ public class SaveWidget {
saveConfig.saveConfig(new File(configFile));
} catch (Exception ex) {
- Dialogs.popupError("Error Saving File", String.format("Error saving file: [%s]\n%s", configFile,
- TestManagerPlugin.getStackMessages(ex)));
+ Dialogs.popupError("Error Saving File",
+ String.format("Error saving file: [%s]\n%s", configFile, OseeUiActivator.getStackMessages(ex)));
}
}
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/LoadScriptPage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/LoadScriptPage.java
index cb7c0ebd97..272954fe84 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/LoadScriptPage.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/LoadScriptPage.java
@@ -38,119 +38,121 @@ import org.xml.sax.SAXException;
public class LoadScriptPage implements ILoadConfig, ScriptPageConstants {
- private final ScriptPage scriptPage;
- private final ScriptTableViewer scriptTableViewer;
- private final Vector<ScriptTask> scriptTasks;
-
- public LoadScriptPage(ScriptPage tmPage) {
- this.scriptPage = tmPage;
- this.scriptTableViewer = scriptPage.getScriptTableViewer();
- scriptTasks = new Vector<ScriptTask>();
- }
-
- public void loadConfiguration(final File toProcess) throws Exception {
-
- Job job = new Job(String.format("Loading Script Run List [%s]", toProcess.getName())) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- Document doc;
- try {
- doc = Jaxp.readXmlDocument(toProcess);
- parseConfig(doc);
-
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- scriptTableViewer.loadTasksFromList(scriptTasks);
- scriptTableViewer.refresh();
- debug(toProcess.getAbsolutePath());
- }
- });
- } catch (ParserConfigurationException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
- } catch (SAXException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
- } catch (IOException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
- }
-
- return Status.OK_STATUS;
- }
-
- };
- job.schedule();
- }
-
- private void debug(String val) {
- OseeLog.log(TestManagerPlugin.class, Level.INFO, "Loaded From: " + val);
- }
-
- private void parseConfig(Document doc) {
- NodeList nl = doc.getElementsByTagName(ScriptPageConstants.SCRIPTPAGE_CONFIG);
-
- for (int i = 0; i < nl.getLength(); i++) {
- Element element = (Element) nl.item(i);
- parseMiscellaneousInfo(element);
- parseScriptEntries(element);
- }
- }
-
- private void parseMiscellaneousInfo(Element element) {
- // Iterator iterator = node.getDescendants(new RegExElementFilter(
- // Pattern.compile(ScriptPageConstants.SERVICES_ENTRY)));
- // while (iterator.hasNext()) {
- // Element child = (Element) iterator.next();
- // TODO load miscellaneous information to page
- // }
- }
-
- private class LoadScriptHelper implements Runnable {
- private boolean stopLoading = false;
- private final String path;
-
- public LoadScriptHelper(String path) {
- this.path = path;
- }
-
- public void run() {
- if (!MessageDialog.openQuestion(
- Displays.getActiveShell(),
- "Script not found",
- "The script " + path + " was not found in this workspace. Do you want to continue loading from the script list file. ")) {
- stopLoading = true;
- }
- }
-
- public boolean stop() {
- return stopLoading;
- }
- }
-
- private void parseScriptEntries(Element element) {
- NodeList nl = element.getElementsByTagName(ScriptPageConstants.SCRIPT_ENTRY);
- String alternatePath = scriptPage.getTestManager().getAlternateOutputDir();
- for (int i = 0; i < nl.getLength(); i++) {
- Element child = (Element) nl.item(i);
- final String path = Jaxp.getChildText(child, ScriptPageConstants.RAW_FILENAME_FIELD);
- String runnable = Jaxp.getChildText(child, ScriptPageConstants.RUNNABLE_FIELD);
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
- if (file.exists()) {
- try {
- ScriptTask task = new ScriptTask(file.getLocation().toString(), alternatePath);
- task.setRun(Boolean.parseBoolean(runnable));
- scriptTasks.add(task);
- } catch (NullPointerException e) {
- e.printStackTrace();
- }
- } else {
- LoadScriptHelper helper = new LoadScriptHelper(path);
- Displays.pendInDisplayThread(helper);
- if (helper.stop()) {
- break;
- }
- }
- }
- }
+ private final ScriptPage scriptPage;
+ private final ScriptTableViewer scriptTableViewer;
+ private final Vector<ScriptTask> scriptTasks;
+
+ public LoadScriptPage(ScriptPage tmPage) {
+ this.scriptPage = tmPage;
+ this.scriptTableViewer = scriptPage.getScriptTableViewer();
+ scriptTasks = new Vector<ScriptTask>();
+ }
+
+ @Override
+ public void loadConfiguration(final File toProcess) throws Exception {
+
+ Job job = new Job(String.format("Loading Script Run List [%s]", toProcess.getName())) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ Document doc;
+ try {
+ doc = Jaxp.readXmlDocument(toProcess);
+ parseConfig(doc);
+
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ scriptTableViewer.loadTasksFromList(scriptTasks);
+ scriptTableViewer.refresh();
+ debug(toProcess.getAbsolutePath());
+ }
+ });
+ } catch (ParserConfigurationException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
+ } catch (SAXException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
+ } catch (IOException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ }
+
+ private void debug(String val) {
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, "Loaded From: " + val);
+ }
+
+ private void parseConfig(Document doc) {
+ NodeList nl = doc.getElementsByTagName(ScriptPageConstants.SCRIPTPAGE_CONFIG);
+
+ for (int i = 0; i < nl.getLength(); i++) {
+ Element element = (Element) nl.item(i);
+ parseMiscellaneousInfo(element);
+ parseScriptEntries(element);
+ }
+ }
+
+ private void parseMiscellaneousInfo(Element element) {
+ // Iterator iterator = node.getDescendants(new RegExElementFilter(
+ // Pattern.compile(ScriptPageConstants.SERVICES_ENTRY)));
+ // while (iterator.hasNext()) {
+ // Element child = (Element) iterator.next();
+ // TODO load miscellaneous information to page
+ // }
+ }
+
+ private class LoadScriptHelper implements Runnable {
+ private boolean stopLoading = false;
+ private final String path;
+
+ public LoadScriptHelper(String path) {
+ this.path = path;
+ }
+
+ @Override
+ public void run() {
+ if (!MessageDialog.openQuestion(
+ Displays.getActiveShell(),
+ "Script not found",
+ "The script " + path + " was not found in this workspace. Do you want to continue loading from the script list file. ")) {
+ stopLoading = true;
+ }
+ }
+
+ public boolean stop() {
+ return stopLoading;
+ }
+ }
+
+ private void parseScriptEntries(Element element) {
+ NodeList nl = element.getElementsByTagName(ScriptPageConstants.SCRIPT_ENTRY);
+ String alternatePath = scriptPage.getTestManager().getAlternateOutputDir();
+ for (int i = 0; i < nl.getLength(); i++) {
+ Element child = (Element) nl.item(i);
+ final String path = Jaxp.getChildText(child, ScriptPageConstants.RAW_FILENAME_FIELD);
+ String runnable = Jaxp.getChildText(child, ScriptPageConstants.RUNNABLE_FIELD);
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
+ if (file.exists()) {
+ try {
+ ScriptTask task = new ScriptTask(file.getLocation().toString(), alternatePath);
+ task.setRun(Boolean.parseBoolean(runnable));
+ scriptTasks.add(task);
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+ }
+ } else {
+ LoadScriptHelper helper = new LoadScriptHelper(path);
+ Displays.pendInDisplayThread(helper);
+ if (helper.stop()) {
+ break;
+ }
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/SaveScriptPage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/SaveScriptPage.java
index b40ebd86c2..a4efb53bf4 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/SaveScriptPage.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/SaveScriptPage.java
@@ -27,11 +27,11 @@ import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public class SaveScriptPage implements ISaveConfig, ScriptPageConstants, Xmlizable{
+public class SaveScriptPage implements ISaveConfig, ScriptPageConstants, Xmlizable {
- private Document doc;
- private Element root;
- private ScriptPage scriptPage;
+ private final Document doc;
+ private final Element root;
+ private final ScriptPage scriptPage;
public SaveScriptPage(ScriptPage tmPage) throws ParserConfigurationException {
this.scriptPage = tmPage;
@@ -40,16 +40,17 @@ public class SaveScriptPage implements ISaveConfig, ScriptPageConstants, Xmlizab
doc.appendChild(root);
}
+ @Override
public void printXmlTree() {
OseeLog.log(TestManagerPlugin.class, Level.INFO, "Script Page Tree: ");
try {
OseeLog.log(TestManagerPlugin.class, Level.INFO, Jaxp.xmlToString(doc, Jaxp.getPrettyFormat(doc)));
- }
- catch (IOException ex) {
+ } catch (IOException ex) {
OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
}
}
+ @Override
public void saveConfig(File fileName) throws Exception {
ScriptTableViewer scriptTable = scriptPage.getScriptTableViewer();
Vector<ScriptTask> tasks = scriptTable.getTasks();
@@ -64,6 +65,7 @@ public class SaveScriptPage implements ISaveConfig, ScriptPageConstants, Xmlizab
debug(fileName.getAbsolutePath());
}
+ @Override
public Element toXml(Document doc) {
return root;
}
@@ -83,9 +85,11 @@ public class SaveScriptPage implements ISaveConfig, ScriptPageConstants, Xmlizab
private Element scriptTaskToXml(Document doc, ScriptTask task) {
Element taskRoot = doc.createElement(ScriptPageConstants.SCRIPT_ENTRY);
- taskRoot.appendChild(Jaxp.createElement(doc, ScriptPageConstants.SCRIPT_NAME_FIELD,task.getName()));
- taskRoot.appendChild(Jaxp.createElement(doc, ScriptPageConstants.RAW_FILENAME_FIELD,task.getScriptModel().getWorkspaceRelativePath()));
- taskRoot.appendChild(Jaxp.createElement(doc, ScriptPageConstants.RUNNABLE_FIELD,Boolean.toString(task.isRunnable())));
+ taskRoot.appendChild(Jaxp.createElement(doc, ScriptPageConstants.SCRIPT_NAME_FIELD, task.getName()));
+ taskRoot.appendChild(Jaxp.createElement(doc, ScriptPageConstants.RAW_FILENAME_FIELD,
+ task.getScriptModel().getWorkspaceRelativePath()));
+ taskRoot.appendChild(Jaxp.createElement(doc, ScriptPageConstants.RUNNABLE_FIELD,
+ Boolean.toString(task.isRunnable())));
return taskRoot;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java
index 83f6edbc1e..ed4b1a9c17 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java
@@ -41,180 +41,181 @@ import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask.ScriptS
* @author Andrew M. Finkbeiner
*/
public abstract class ScriptManager implements Runnable {
- private final Map<String, ScriptTask> guidToScriptTask = new HashMap<String, ScriptTask>();
- private TestManagerStatusListener statusListenerImpl;
- private final TestManagerEditor testManager;
-
- private volatile boolean updateScriptTable;
- private StructuredViewer stv;
- private ScheduledExecutorService updater;
- private Set<ScriptTask> tasksToUpdate;
- private ITestEnvironment connectedEnv;
- private UserTestSessionKey sessionKey;
-
- public ScriptManager(TestManagerEditor testManager, StructuredViewer stv) {
- this.testManager = testManager;
- this.stv = stv;
-
- tasksToUpdate = new HashSet<ScriptTask>();
- updater = Executors.newScheduledThreadPool(1, new ThreadFactory() {
-
- public Thread newThread(Runnable r) {
- Thread th = new Thread(r, "TM Table updater");
- th.setDaemon(true);
- return th;
- }
-
- });
- updater.scheduleAtFixedRate(this, 0, 2000, TimeUnit.MILLISECONDS);
- OutputModelJob.createSingleton(this);
- }
-
- public abstract void abortScript(boolean isBatchAbort) throws RemoteException;
-
- public void notifyScriptDequeued(String className) {
- ScriptTask task = guidToScriptTask.get(className);
- if (task != null) {
- guidToScriptTask.remove(task);
- }
- }
-
- /**
- * This should be called after the environment is received in order to configure necessary items.
- *
- * @return null if successful, otherwise a string describing the error
- * @throws RemoteException
- */
- public boolean connect(ConnectionEvent event) {
-
- connectedEnv = event.getEnvironment();
- sessionKey = event.getSessionKey();
- try {
- /*
- * Setup the status listener for commands
- */
- statusListenerImpl = new TestManagerStatusListener(testManager, this);
-
- connectedEnv.addStatusListener((IServiceStatusListener) event.getConnector().export(statusListenerImpl));
- return false;
- } catch (Exception e) {
- TestManagerPlugin.log(Level.SEVERE, "failed to connect script manager", e);
- return true;
- }
- }
-
- /**
- * This should NOT be called directly, users should call the HostDataStore's disconnect.
- */
- public boolean disconnect(ConnectionEvent event) {
- connectedEnv = null;
- sessionKey = null;
- guidToScriptTask.clear();
- try {
-
- event.getEnvironment().removeStatusListener(
- (IServiceStatusListener) event.getConnector().findExport(statusListenerImpl));
- return false;
- } catch (RemoteException e) {
- TestManagerPlugin.log(Level.INFO, "problems removing listener", e);
- return true;
- }
- }
-
- public boolean onConnectionLost() {
- connectedEnv = null;
- sessionKey = null;
- guidToScriptTask.clear();
- return false;
- }
-
- public ScriptTask getScriptTask(String name) {
- return guidToScriptTask.get(name);
- }
-
- public void notifyScriptQueued(GUID theGUID, final ScriptTask script) {
- guidToScriptTask.put(script.getScriptModel().getTestClass(), script);
- script.setStatus(ScriptStatusEnum.IN_QUEUE);
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (stv.getControl().isDisposed()) {
- return;
- }
- stv.refresh(script);
- }
- });
- }
-
- public void updateScriptTableViewer(final ScriptTask task) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (stv.getControl().isDisposed()) {
- return;
- }
- stv.refresh(task);
- }
- });
- }
-
- public void updateScriptTableViewerTimed(ScriptTask task) {
- updateScriptTable = true;
- synchronized (tasksToUpdate) {
- tasksToUpdate.add(task);
- }
- }
-
- @Override
- public void run() {
- if (updateScriptTable) {
- updateScriptTable = false;
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- synchronized (tasksToUpdate) {
- if (stv.getControl().isDisposed()) {
- return;
- }
- for (ScriptTask task : tasksToUpdate) {
- stv.refresh(task);
- }
- tasksToUpdate.clear();
- }
- }
- });
- }
- }
-
- protected TestManagerEditor getTestManagerEditor() {
- return testManager;
- }
-
- public abstract void addTestsToQueue(List<ScriptTask> scripts);
-
- /**
- * @param task
- */
- public void notifyScriptStart(final ScriptTask task) {
- task.setStatus(ScriptStatusEnum.RUNNING);
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- stv.refresh(task);
- }
- });
- }
-
- public void storeOutFile(ScriptTask task, TestComplete testComplete, boolean isValidRun) {
- if (task.getScriptModel() != null) {
- Job job =
- new StoreOutfileJob(connectedEnv, testManager, this, task, testComplete.getClientOutfilePath(),
- testComplete.getServerOutfilePath(), isValidRun);
- StoreOutfileJob.scheduleJob(job);
- }
- }
-
- protected UserTestSessionKey getSessionKey() {
- return sessionKey;
- }
+ private final Map<String, ScriptTask> guidToScriptTask = new HashMap<String, ScriptTask>();
+ private TestManagerStatusListener statusListenerImpl;
+ private final TestManagerEditor testManager;
+
+ private volatile boolean updateScriptTable;
+ private StructuredViewer stv;
+ private ScheduledExecutorService updater;
+ private Set<ScriptTask> tasksToUpdate;
+ private ITestEnvironment connectedEnv;
+ private UserTestSessionKey sessionKey;
+
+ public ScriptManager(TestManagerEditor testManager, StructuredViewer stv) {
+ this.testManager = testManager;
+ this.stv = stv;
+
+ tasksToUpdate = new HashSet<ScriptTask>();
+ updater = Executors.newScheduledThreadPool(1, new ThreadFactory() {
+
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread th = new Thread(r, "TM Table updater");
+ th.setDaemon(true);
+ return th;
+ }
+
+ });
+ updater.scheduleAtFixedRate(this, 0, 2000, TimeUnit.MILLISECONDS);
+ OutputModelJob.createSingleton(this);
+ }
+
+ public abstract void abortScript(boolean isBatchAbort) throws RemoteException;
+
+ public void notifyScriptDequeued(String className) {
+ ScriptTask task = guidToScriptTask.get(className);
+ if (task != null) {
+ guidToScriptTask.remove(task);
+ }
+ }
+
+ /**
+ * This should be called after the environment is received in order to configure necessary items.
+ *
+ * @return null if successful, otherwise a string describing the error
+ * @throws RemoteException
+ */
+ public boolean connect(ConnectionEvent event) {
+
+ connectedEnv = event.getEnvironment();
+ sessionKey = event.getSessionKey();
+ try {
+ /*
+ * Setup the status listener for commands
+ */
+ statusListenerImpl = new TestManagerStatusListener(testManager, this);
+
+ connectedEnv.addStatusListener((IServiceStatusListener) event.getConnector().export(statusListenerImpl));
+ return false;
+ } catch (Exception e) {
+ TestManagerPlugin.log(Level.SEVERE, "failed to connect script manager", e);
+ return true;
+ }
+ }
+
+ /**
+ * This should NOT be called directly, users should call the HostDataStore's disconnect.
+ */
+ public boolean disconnect(ConnectionEvent event) {
+ connectedEnv = null;
+ sessionKey = null;
+ guidToScriptTask.clear();
+ try {
+
+ event.getEnvironment().removeStatusListener(
+ (IServiceStatusListener) event.getConnector().findExport(statusListenerImpl));
+ return false;
+ } catch (RemoteException e) {
+ TestManagerPlugin.log(Level.INFO, "problems removing listener", e);
+ return true;
+ }
+ }
+
+ public boolean onConnectionLost() {
+ connectedEnv = null;
+ sessionKey = null;
+ guidToScriptTask.clear();
+ return false;
+ }
+
+ public ScriptTask getScriptTask(String name) {
+ return guidToScriptTask.get(name);
+ }
+
+ public void notifyScriptQueued(GUID theGUID, final ScriptTask script) {
+ guidToScriptTask.put(script.getScriptModel().getTestClass(), script);
+ script.setStatus(ScriptStatusEnum.IN_QUEUE);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (stv.getControl().isDisposed()) {
+ return;
+ }
+ stv.refresh(script);
+ }
+ });
+ }
+
+ public void updateScriptTableViewer(final ScriptTask task) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (stv.getControl().isDisposed()) {
+ return;
+ }
+ stv.refresh(task);
+ }
+ });
+ }
+
+ public void updateScriptTableViewerTimed(ScriptTask task) {
+ updateScriptTable = true;
+ synchronized (tasksToUpdate) {
+ tasksToUpdate.add(task);
+ }
+ }
+
+ @Override
+ public void run() {
+ if (updateScriptTable) {
+ updateScriptTable = false;
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ synchronized (tasksToUpdate) {
+ if (stv.getControl().isDisposed()) {
+ return;
+ }
+ for (ScriptTask task : tasksToUpdate) {
+ stv.refresh(task);
+ }
+ tasksToUpdate.clear();
+ }
+ }
+ });
+ }
+ }
+
+ protected TestManagerEditor getTestManagerEditor() {
+ return testManager;
+ }
+
+ public abstract void addTestsToQueue(List<ScriptTask> scripts);
+
+ /**
+ * @param task
+ */
+ public void notifyScriptStart(final ScriptTask task) {
+ task.setStatus(ScriptStatusEnum.RUNNING);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ stv.refresh(task);
+ }
+ });
+ }
+
+ public void storeOutFile(ScriptTask task, TestComplete testComplete, boolean isValidRun) {
+ if (task.getScriptModel() != null) {
+ Job job =
+ new StoreOutfileJob(connectedEnv, testManager, this, task, testComplete.getClientOutfilePath(),
+ testComplete.getServerOutfilePath(), isValidRun);
+ StoreOutfileJob.scheduleJob(job);
+ }
+ }
+
+ protected UserTestSessionKey getSessionKey() {
+ return sessionKey;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptQueue.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptQueue.java
index 19de01075f..659dbf331d 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptQueue.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptQueue.java
@@ -16,8 +16,8 @@ import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
public abstract class ScriptQueue implements Runnable {
- private List<ScriptTask> scripts;
- private TestManagerEditor testManager;
+ private final List<ScriptTask> scripts;
+ private final TestManagerEditor testManager;
public ScriptQueue(List<ScriptTask> scripts, TestManagerEditor testManager) {
super();
@@ -25,6 +25,7 @@ public abstract class ScriptQueue implements Runnable {
this.testManager = testManager;
}
+ @Override
public abstract void run();
protected List<ScriptTask> getScriptsToExecute() {
@@ -36,6 +37,6 @@ public abstract class ScriptQueue implements Runnable {
}
protected ScriptManager getScriptManager() {
- return testManager.getPageManager().getScriptPage().getScriptManager();
- }
+ return testManager.getPageManager().getScriptPage().getScriptManager();
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/StatusBoardRecieveEvent.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/StatusBoardRecieveEvent.java
index 19c3a73530..f4a52f5e53 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/StatusBoardRecieveEvent.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/StatusBoardRecieveEvent.java
@@ -17,7 +17,7 @@ import java.util.concurrent.Callable;
*/
public abstract class StatusBoardRecieveEvent<V> implements Callable<V> {
- private V data;
+ private final V data;
/**
*
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java
index 2da232cbb5..0010b40b64 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java
@@ -44,312 +44,320 @@ import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask.ScriptS
*/
final class TestManagerServiceStatusDataVisitor implements IServiceStatusDataVisitor {
- private final ScriptManager scriptManager;
- private final TestManagerEditor testManagerEditor;
- private final ExecutorService executor;
+ private final ScriptManager scriptManager;
+ private final TestManagerEditor testManagerEditor;
+ private final ExecutorService executor;
- protected TestManagerServiceStatusDataVisitor(ScriptManager scriptManager, TestManagerEditor testManagerEditor) {
- this.scriptManager = scriptManager;
- this.testManagerEditor = testManagerEditor;
- executor = Executors.newSingleThreadExecutor();
+ protected TestManagerServiceStatusDataVisitor(ScriptManager scriptManager, TestManagerEditor testManagerEditor) {
+ this.scriptManager = scriptManager;
+ this.testManagerEditor = testManagerEditor;
+ executor = Executors.newSingleThreadExecutor();
- }
+ }
- public void asCommandAdded(final CommandAdded commandAdded) {
- executor.submit(new StatusBoardRecieveEvent<CommandAdded>(commandAdded) {
- @Override
- public void run() {
- checkServiceStatusDataValid(commandAdded);
- logServiceStatusData(commandAdded);
- final ScriptTask task = getScriptTask(commandAdded);
- if (task != null) {
- task.setStatus(ScriptStatusEnum.IN_QUEUE);
- scriptManager.updateScriptTableViewer(task);
- }
- }
- });
- logExecutorSize();
- }
+ @Override
+ public void asCommandAdded(final CommandAdded commandAdded) {
+ executor.submit(new StatusBoardRecieveEvent<CommandAdded>(commandAdded) {
+ @Override
+ public void run() {
+ checkServiceStatusDataValid(commandAdded);
+ logServiceStatusData(commandAdded);
+ final ScriptTask task = getScriptTask(commandAdded);
+ if (task != null) {
+ task.setStatus(ScriptStatusEnum.IN_QUEUE);
+ scriptManager.updateScriptTableViewer(task);
+ }
+ }
+ });
+ logExecutorSize();
+ }
- public void asCommandRemoved(final CommandRemoved commandRemoved) {
- executor.submit(new StatusBoardRecieveEvent<CommandRemoved>(commandRemoved) {
- @Override
- public void run() {
- checkServiceStatusDataValid(commandRemoved);
- logServiceStatusData(commandRemoved);
+ @Override
+ public void asCommandRemoved(final CommandRemoved commandRemoved) {
+ executor.submit(new StatusBoardRecieveEvent<CommandRemoved>(commandRemoved) {
+ @Override
+ public void run() {
+ checkServiceStatusDataValid(commandRemoved);
+ logServiceStatusData(commandRemoved);
- final ScriptTask task = getScriptTask(commandRemoved);
- if (task != null) {
- CommandEndedStatusEnum cmdStat = commandRemoved.getReason();
- if (cmdStat.equals(CommandEndedStatusEnum.ABORTED)) {
- logOnConsole(Level.SEVERE, String.format("Test Aborted: [%s]", task.getName()));
- task.setStatus(ScriptStatusEnum.CANCELLED);
- }
- notifyExecutionComplete(task);
- // userEnvironment.notifyScriptDequeued(task.getGuid());
- scriptManager.updateScriptTableViewer(task);
- }
- }
- });
- logExecutorSize();
- }
+ final ScriptTask task = getScriptTask(commandRemoved);
+ if (task != null) {
+ CommandEndedStatusEnum cmdStat = commandRemoved.getReason();
+ if (cmdStat.equals(CommandEndedStatusEnum.ABORTED)) {
+ logOnConsole(Level.SEVERE, String.format("Test Aborted: [%s]", task.getName()));
+ task.setStatus(ScriptStatusEnum.CANCELLED);
+ }
+ notifyExecutionComplete(task);
+ // userEnvironment.notifyScriptDequeued(task.getGuid());
+ scriptManager.updateScriptTableViewer(task);
+ }
+ }
+ });
+ logExecutorSize();
+ }
- public void asEnvironmentError(final EnvironmentError environmentError) {
- executor.submit(new StatusBoardRecieveEvent<EnvironmentError>(environmentError) {
- @Override
- public void run() {
- checkServiceStatusDataValid(environmentError);
+ @Override
+ public void asEnvironmentError(final EnvironmentError environmentError) {
+ executor.submit(new StatusBoardRecieveEvent<EnvironmentError>(environmentError) {
+ @Override
+ public void run() {
+ checkServiceStatusDataValid(environmentError);
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE,
- "errorOccured: " + environmentError.getErr().getMessage());
- environmentError.getErr().printStackTrace();
- final String msg = Lib.exceptionToString(environmentError.getErr());
- logOnConsole(Level.SEVERE, String.format("Test Environment Error: [%s]", msg));
- disconnectOnError(msg);
- }
- });
- logExecutorSize();
- }
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE,
+ "errorOccured: " + environmentError.getErr().getMessage());
+ environmentError.getErr().printStackTrace();
+ final String msg = Lib.exceptionToString(environmentError.getErr());
+ logOnConsole(Level.SEVERE, String.format("Test Environment Error: [%s]", msg));
+ disconnectOnError(msg);
+ }
+ });
+ logExecutorSize();
+ }
- public void asSequentialCommandBegan(final SequentialCommandBegan sequentialCommandBegan) {
- executor.submit(new StatusBoardRecieveEvent<SequentialCommandBegan>(sequentialCommandBegan) {
- @Override
- public void run() {
- checkServiceStatusDataValid(sequentialCommandBegan);
- logServiceStatusData(sequentialCommandBegan);
+ @Override
+ public void asSequentialCommandBegan(final SequentialCommandBegan sequentialCommandBegan) {
+ executor.submit(new StatusBoardRecieveEvent<SequentialCommandBegan>(sequentialCommandBegan) {
+ @Override
+ public void run() {
+ checkServiceStatusDataValid(sequentialCommandBegan);
+ logServiceStatusData(sequentialCommandBegan);
- final ScriptTask task = getScriptTask(sequentialCommandBegan);
- if (task != null && task.getScriptModel() != null) {
- OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("Script Task: [%s]", task));
- logOnConsole(Level.INFO, String.format("Test Starting: [%s]", task.getName()));
- task.setStatus(ScriptStatusEnum.RUNNING);
- scriptManager.updateScriptTableViewer(task);
- }
- }
- });
- logExecutorSize();
- }
+ final ScriptTask task = getScriptTask(sequentialCommandBegan);
+ if (task != null && task.getScriptModel() != null) {
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("Script Task: [%s]", task));
+ logOnConsole(Level.INFO, String.format("Test Starting: [%s]", task.getName()));
+ task.setStatus(ScriptStatusEnum.RUNNING);
+ scriptManager.updateScriptTableViewer(task);
+ }
+ }
+ });
+ logExecutorSize();
+ }
- public void asSequentialCommandEnded(final SequentialCommandEnded sequentialCommandEnded) {
+ @Override
+ public void asSequentialCommandEnded(final SequentialCommandEnded sequentialCommandEnded) {
- executor.submit(new StatusBoardRecieveEvent<SequentialCommandEnded>(sequentialCommandEnded) {
- @Override
- public void run() {
- checkServiceStatusDataValid(sequentialCommandEnded);
- logServiceStatusData(sequentialCommandEnded);
- final ScriptTask task = getScriptTask(sequentialCommandEnded);
- if (task != null) {
- OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("Script Task: [%s]", task));
- CommandEndedStatusEnum cmdStat = sequentialCommandEnded.getStatus();
- switch (cmdStat) {
- case ABORTED:
- logOnConsole(Level.SEVERE, String.format("Test Aborted: [%s]", task.getName()));
- task.setStatus(ScriptStatusEnum.CANCELLED);
- break;
- case EXCEPTION:
- task.setStatus(ScriptStatusEnum.CANCELLED);
- logOnConsole(Level.SEVERE,
- String.format("Test Aborted: [%s] - Exception Occurred", task.getName()));
- break;
- case HUNG:
- task.setStatus(ScriptStatusEnum.CANCELLED);
- logOnConsole(Level.SEVERE, String.format("Test Hung: [%s]", task.getName()));
- break;
- case RAN_TO_COMPLETION:
- task.setStatus(ScriptStatusEnum.COMPLETE);
- break;
- default:
- task.setStatus(ScriptStatusEnum.COMPLETE);
- logOnConsole(Level.SEVERE, String.format("Test Ended Unexpectedly: [%s]", task.getName()));
- break;
- }
- // onOutfileSave(task, sequentialCommandEnded.getDescription(),
- // isValidRun);
- logOnConsole(Level.INFO, String.format("Test Completed: [%s]", task.getName()));
- notifyExecutionComplete(task);
- // userEnvironment.notifyScriptDequeued(task.getGuid());
- scriptManager.updateScriptTableViewer(task);
- }
- }
- });
- logExecutorSize();
- }
+ executor.submit(new StatusBoardRecieveEvent<SequentialCommandEnded>(sequentialCommandEnded) {
+ @Override
+ public void run() {
+ checkServiceStatusDataValid(sequentialCommandEnded);
+ logServiceStatusData(sequentialCommandEnded);
+ final ScriptTask task = getScriptTask(sequentialCommandEnded);
+ if (task != null) {
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("Script Task: [%s]", task));
+ CommandEndedStatusEnum cmdStat = sequentialCommandEnded.getStatus();
+ switch (cmdStat) {
+ case ABORTED:
+ logOnConsole(Level.SEVERE, String.format("Test Aborted: [%s]", task.getName()));
+ task.setStatus(ScriptStatusEnum.CANCELLED);
+ break;
+ case EXCEPTION:
+ task.setStatus(ScriptStatusEnum.CANCELLED);
+ logOnConsole(Level.SEVERE,
+ String.format("Test Aborted: [%s] - Exception Occurred", task.getName()));
+ break;
+ case HUNG:
+ task.setStatus(ScriptStatusEnum.CANCELLED);
+ logOnConsole(Level.SEVERE, String.format("Test Hung: [%s]", task.getName()));
+ break;
+ case RAN_TO_COMPLETION:
+ task.setStatus(ScriptStatusEnum.COMPLETE);
+ break;
+ default:
+ task.setStatus(ScriptStatusEnum.COMPLETE);
+ logOnConsole(Level.SEVERE, String.format("Test Ended Unexpectedly: [%s]", task.getName()));
+ break;
+ }
+ // onOutfileSave(task, sequentialCommandEnded.getDescription(),
+ // isValidRun);
+ logOnConsole(Level.INFO, String.format("Test Completed: [%s]", task.getName()));
+ notifyExecutionComplete(task);
+ // userEnvironment.notifyScriptDequeued(task.getGuid());
+ scriptManager.updateScriptTableViewer(task);
+ }
+ }
+ });
+ logExecutorSize();
+ }
- public void asTestPointUpdate(final TestPointUpdate testPointUpdate) {
- executor.submit(new StatusBoardRecieveEvent<TestPointUpdate>(testPointUpdate) {
- @Override
- public void run() {
- checkServiceStatusDataValid(testPointUpdate);
- final ScriptTask task = scriptManager.getScriptTask(testPointUpdate.getClassName());
- // final ScriptTask task = getScriptTask(testPointUpdate);
- if (task != null) {
- task.getScriptModel().getOutputModel().setPassedTestPoints(testPointUpdate.getPass());
- task.getScriptModel().getOutputModel().setFailedTestPoints(testPointUpdate.getFail());
- scriptManager.updateScriptTableViewerTimed(task);
- } else {
- OseeLog.log(TestManagerPlugin.class, Level.WARNING, "testPointsUpdated: task is null");
- }
- }
- });
- logExecutorSize();
- }
+ @Override
+ public void asTestPointUpdate(final TestPointUpdate testPointUpdate) {
+ executor.submit(new StatusBoardRecieveEvent<TestPointUpdate>(testPointUpdate) {
+ @Override
+ public void run() {
+ checkServiceStatusDataValid(testPointUpdate);
+ final ScriptTask task = scriptManager.getScriptTask(testPointUpdate.getClassName());
+ // final ScriptTask task = getScriptTask(testPointUpdate);
+ if (task != null) {
+ task.getScriptModel().getOutputModel().setPassedTestPoints(testPointUpdate.getPass());
+ task.getScriptModel().getOutputModel().setFailedTestPoints(testPointUpdate.getFail());
+ scriptManager.updateScriptTableViewerTimed(task);
+ } else {
+ OseeLog.log(TestManagerPlugin.class, Level.WARNING, "testPointsUpdated: task is null");
+ }
+ }
+ });
+ logExecutorSize();
+ }
- private synchronized void logOnConsole(final Level level, final String msg) {
- if (level.equals(Level.SEVERE)) {
- TestManagerPlugin.getInstance().getOteConsoleService().writeError(msg);
- } else {
- TestManagerPlugin.getInstance().getOteConsoleService().write(msg);
- }
- }
+ private synchronized void logOnConsole(final Level level, final String msg) {
+ if (level.equals(Level.SEVERE)) {
+ TestManagerPlugin.getInstance().getOteConsoleService().writeError(msg);
+ } else {
+ TestManagerPlugin.getInstance().getOteConsoleService().write(msg);
+ }
+ }
- private void checkServiceStatusDataValid(IServiceStatusData statusData) {
- if (statusData == null) {
- throw new IllegalArgumentException(String.format("Error [%s] was null.", IServiceStatusData.class.getName()));
- }
- }
+ private void checkServiceStatusDataValid(IServiceStatusData statusData) {
+ if (statusData == null) {
+ throw new IllegalArgumentException(String.format("Error [%s] was null.", IServiceStatusData.class.getName()));
+ }
+ }
- private void disconnectOnError(final String cause) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- TestManagerPlugin.getInstance().getOteConsoleService().writeError(cause);
- }
- });
- }
+ private void disconnectOnError(final String cause) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ TestManagerPlugin.getInstance().getOteConsoleService().writeError(cause);
+ }
+ });
+ }
- private void logServiceStatusData(IServiceStatusDataCommand statusData) {
- OseeLog.log(TestManagerPlugin.class, Level.FINE,
- String.format("%s: %s ", statusData.getClass().getName(), statusData.getDescription()));
- }
+ private void logServiceStatusData(IServiceStatusDataCommand statusData) {
+ OseeLog.log(TestManagerPlugin.class, Level.FINE,
+ String.format("%s: %s ", statusData.getClass().getName(), statusData.getDescription()));
+ }
- private ScriptTask getScriptTask(IServiceStatusDataCommand statusData) {
- // statusData.getDescription().getDescription()
- return scriptManager.getScriptTask(statusData.getDescription().getDescription());
- }
+ private ScriptTask getScriptTask(IServiceStatusDataCommand statusData) {
+ // statusData.getDescription().getDescription()
+ return scriptManager.getScriptTask(statusData.getDescription().getDescription());
+ }
- private void notifyExecutionComplete(ScriptTask scriptTask) {
- // if (userEnvironment.getLastGUIDToRun() != null &&
- // scriptTask.getGuid().equals(userEnvironment.getLastGUIDToRun())) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- testManagerEditor.executionCompleted();
- }
- });
- logExecutorSize();
- // }
- }
+ private void notifyExecutionComplete(ScriptTask scriptTask) {
+ // if (userEnvironment.getLastGUIDToRun() != null &&
+ // scriptTask.getGuid().equals(userEnvironment.getLastGUIDToRun())) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ testManagerEditor.executionCompleted();
+ }
+ });
+ logExecutorSize();
+ // }
+ }
- @Override
- public void asTestServerCommandComplete(final TestServerCommandComplete end) {
+ @Override
+ public void asTestServerCommandComplete(final TestServerCommandComplete end) {
- executor.submit(new StatusBoardRecieveEvent<TestServerCommandComplete>(end) {
- @Override
- public void run() {
- try {
- ITestCommandResult result = end.getHandle().get();
- TestCommandStatus status = result.getStatus();
- Throwable th = result.getThrowable();
- if (th != null) {
- th.printStackTrace();
- }
- if (status != null) {
- System.out.println(status.name());
- }
- } catch (RemoteException ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
- }
+ executor.submit(new StatusBoardRecieveEvent<TestServerCommandComplete>(end) {
+ @Override
+ public void run() {
+ try {
+ ITestCommandResult result = end.getHandle().get();
+ TestCommandStatus status = result.getStatus();
+ Throwable th = result.getThrowable();
+ if (th != null) {
+ th.printStackTrace();
+ }
+ if (status != null) {
+ System.out.println(status.name());
+ }
+ } catch (RemoteException ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
+ }
- notifyExecutionComplete(null);
- }
- });
- logExecutorSize();
- }
+ notifyExecutionComplete(null);
+ }
+ });
+ logExecutorSize();
+ }
- public void asTestComplete(final TestComplete testComplete) {
- executor.submit(new StatusBoardRecieveEvent<TestComplete>(testComplete) {
- @Override
- public void run() {
- ScriptTask task = scriptManager.getScriptTask(testComplete.getClassName());
- if (task != null) {
- OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("Script Task: [%s]", task));
- boolean isValidRun = true;
- CommandEndedStatusEnum cmdStat = testComplete.getStatus();
- switch (cmdStat) {
- case ABORTED:
- logOnConsole(Level.SEVERE, String.format("Test Aborted: [%s]", task.getName()));
- for (IHealthStatus status : testComplete.getHealthStatus()) {
- String msg;
- if (status.getException() != null) {
- msg = Lib.exceptionToString(status.getException());
- } else {
- msg = status.getMessage();
- }
- logOnConsole(status.getLevel(), msg);
- }
- task.setStatus(ScriptStatusEnum.CANCELLED);
- break;
- case EXCEPTION:
- task.setStatus(ScriptStatusEnum.CANCELLED);
- logOnConsole(Level.SEVERE,
- String.format("Test Exception: [%s] - Exception Occurred", task.getName()));
- StringBuilder sb = new StringBuilder();
- try {
- for (IHealthStatus status : testComplete.getHealthStatus()) {
- if (status.getException() != null) {
- sb.append(Lib.exceptionToString(status.getException()));
- } else if (status.getLevel().intValue() >= Level.SEVERE.intValue()) {
- sb.append(status.getMessage());
- }
- }
- logOnConsole(Level.SEVERE, sb.toString());
- } catch (Throwable th) {
- th.printStackTrace();
- }
- break;
- case HUNG:
- task.setStatus(ScriptStatusEnum.CANCELLED);
- logOnConsole(Level.SEVERE, String.format("Test Hung: [%s]", task.getName()));
- break;
- case RAN_TO_COMPLETION:
- task.setStatus(ScriptStatusEnum.COMPLETE);
- break;
- default:
- task.setStatus(ScriptStatusEnum.COMPLETE);
- logOnConsole(Level.SEVERE, String.format("Test Ended Unexpectedly: [%s]", task.getName()));
- isValidRun = false;
- break;
- }
- scriptManager.storeOutFile(task, testComplete, isValidRun);
- logOnConsole(Level.INFO, String.format("Test Completed: [%s]", task.getName()));
+ @Override
+ public void asTestComplete(final TestComplete testComplete) {
+ executor.submit(new StatusBoardRecieveEvent<TestComplete>(testComplete) {
+ @Override
+ public void run() {
+ ScriptTask task = scriptManager.getScriptTask(testComplete.getClassName());
+ if (task != null) {
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("Script Task: [%s]", task));
+ boolean isValidRun = true;
+ CommandEndedStatusEnum cmdStat = testComplete.getStatus();
+ switch (cmdStat) {
+ case ABORTED:
+ logOnConsole(Level.SEVERE, String.format("Test Aborted: [%s]", task.getName()));
+ for (IHealthStatus status : testComplete.getHealthStatus()) {
+ String msg;
+ if (status.getException() != null) {
+ msg = Lib.exceptionToString(status.getException());
+ } else {
+ msg = status.getMessage();
+ }
+ logOnConsole(status.getLevel(), msg);
+ }
+ task.setStatus(ScriptStatusEnum.CANCELLED);
+ break;
+ case EXCEPTION:
+ task.setStatus(ScriptStatusEnum.CANCELLED);
+ logOnConsole(Level.SEVERE,
+ String.format("Test Exception: [%s] - Exception Occurred", task.getName()));
+ StringBuilder sb = new StringBuilder();
+ try {
+ for (IHealthStatus status : testComplete.getHealthStatus()) {
+ if (status.getException() != null) {
+ sb.append(Lib.exceptionToString(status.getException()));
+ } else if (status.getLevel().intValue() >= Level.SEVERE.intValue()) {
+ sb.append(status.getMessage());
+ }
+ }
+ logOnConsole(Level.SEVERE, sb.toString());
+ } catch (Throwable th) {
+ th.printStackTrace();
+ }
+ break;
+ case HUNG:
+ task.setStatus(ScriptStatusEnum.CANCELLED);
+ logOnConsole(Level.SEVERE, String.format("Test Hung: [%s]", task.getName()));
+ break;
+ case RAN_TO_COMPLETION:
+ task.setStatus(ScriptStatusEnum.COMPLETE);
+ break;
+ default:
+ task.setStatus(ScriptStatusEnum.COMPLETE);
+ logOnConsole(Level.SEVERE, String.format("Test Ended Unexpectedly: [%s]", task.getName()));
+ isValidRun = false;
+ break;
+ }
+ scriptManager.storeOutFile(task, testComplete, isValidRun);
+ logOnConsole(Level.INFO, String.format("Test Completed: [%s]", task.getName()));
- scriptManager.notifyScriptDequeued(testComplete.getClassName());
- scriptManager.updateScriptTableViewer(task);
+ scriptManager.notifyScriptDequeued(testComplete.getClassName());
+ scriptManager.updateScriptTableViewer(task);
- }
- }
- });
- logExecutorSize();
- }
+ }
+ }
+ });
+ logExecutorSize();
+ }
- public void asTestStart(final TestStart testStart) {
- executor.submit(new StatusBoardRecieveEvent<TestStart>(testStart) {
- @Override
- public void run() {
- ScriptTask task = scriptManager.getScriptTask(testStart.getTestClassName());
- if (task != null) {
- scriptManager.notifyScriptStart(task);
- logOnConsole(Level.INFO, String.format("Test Started: [%s]", task.getName()));
- }
- }
- });
- logExecutorSize();
- }
+ @Override
+ public void asTestStart(final TestStart testStart) {
+ executor.submit(new StatusBoardRecieveEvent<TestStart>(testStart) {
+ @Override
+ public void run() {
+ ScriptTask task = scriptManager.getScriptTask(testStart.getTestClassName());
+ if (task != null) {
+ scriptManager.notifyScriptStart(task);
+ logOnConsole(Level.INFO, String.format("Test Started: [%s]", task.getName()));
+ }
+ }
+ });
+ logExecutorSize();
+ }
- private void logExecutorSize() {
- if (executor instanceof ThreadPoolExecutor) {
- OseeLog.log(TestManagerServiceStatusDataVisitor.class, Level.FINE, String.format(
- "Current StatusBoard Executor Size [%d]", ((ThreadPoolExecutor) executor).getQueue().size()));
- }
- }
+ private void logExecutorSize() {
+ if (executor instanceof ThreadPoolExecutor) {
+ OseeLog.log(TestManagerServiceStatusDataVisitor.class, Level.FINE,
+ String.format("Current StatusBoard Executor Size [%d]", ((ThreadPoolExecutor) executor).getQueue().size()));
+ }
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerStatusListener.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerStatusListener.java
index a71f3528c8..fdfef5ac55 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerStatusListener.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerStatusListener.java
@@ -20,12 +20,13 @@ import org.eclipse.osee.ote.ui.test.manager.core.TestManagerEditor;
*/
public final class TestManagerStatusListener implements IServiceStatusListener {
- private TestManagerServiceStatusDataVisitor testManagerServiceDataVisitor;
+ private final TestManagerServiceStatusDataVisitor testManagerServiceDataVisitor;
public TestManagerStatusListener(TestManagerEditor testManagerEditor, ScriptManager userEnvironment) {
this.testManagerServiceDataVisitor = new TestManagerServiceStatusDataVisitor(userEnvironment, testManagerEditor);
}
+ @Override
public void statusBoardUpdated(IServiceStatusData statusData) throws RemoteException {
statusData.accept(testManagerServiceDataVisitor);
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java
index 10e7667b01..0b00c5c844 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/PageManager.java
@@ -32,10 +32,10 @@ public class PageManager {
protected HostPage hostPage;
protected OverviewPage overviewPage;
protected ScriptPage scriptPage;
- private List<TestManagerPage> pages;
+ private final List<TestManagerPage> pages;
- private TestManagerEditor testManager;
- private ITestManagerFactory factory;
+ private final TestManagerEditor testManager;
+ private final ITestManagerFactory factory;
public PageManager(ITestManagerFactory factory, TestManagerEditor testManager) {
this.factory = factory;
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java
index 3490ff61e2..ed0b5ea808 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java
@@ -64,534 +64,535 @@ import org.eclipse.ui.part.MultiPageEditorPart;
* </ul>
*/
public abstract class TestManagerEditor extends MultiPageEditorPart implements IActionable, ITestConnectionListener {
- private static final Image errorImage = ImageManager.getImage(OteTestManagerImage.ERROR);
- public static final String namespace = "org.eclipse.osee.ote.ui.test.manager.editors.TestManagerEditor";
-
- public final QualifiedName clearCaseViewName = new QualifiedName(namespace, "CLEARCASEVIEW");
- public final QualifiedName configFileName = new QualifiedName(namespace, "CONFIGFILENAME");
- public final QualifiedName ofpQualName = new QualifiedName(namespace, "OFP");
- public final QualifiedName scriptsQualName = new QualifiedName(namespace, "SCRIPTS");
-
- private boolean fileIsDirty = false;
-
- private boolean fileWasSaved = false;
-
- private int lastPageIndex = 0;
-
- private final TestManagerModel model;
-
- private boolean reloadSourcePage = false;
-
- private int scriptPageIndex;
-
- private TextEditor sourceEditor;
-
- private int sourcePage;
-
- private final ITestManagerFactory testManagerFactory;
-
- private IFile thisIFile = null;
-
- private String xmlText;
-
- private final IPropertyStore propertyStore;
-
- private final PageManager pageManager;
-
- private ITestEnvironment connectedEnv = null;
- private IServiceConnector connector = null;
- private IHostTestEnvironment connectedHost;
-
- public TestManagerEditor(final ITestManagerFactory testManagerFactory) {
- super();
-
- this.testManagerFactory = testManagerFactory;
- this.pageManager = new PageManager(testManagerFactory, this);
- this.model = new TestManagerModel();
- this.propertyStore = new PropertyStore(testManagerFactory.getClass().getSimpleName());
- }
-
- public void activateScriptsPage() {
- setActivePage(scriptPageIndex);
- }
-
- public void addFile(String fullPath) {
- pageManager.getScriptPage().addFile(fullPath);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- TestManagerPlugin.getInstance().getOteClientService().removeConnectionListener(this);
- try {
- pageManager.dispose();
- } catch (Throwable t) {
- TestManagerPlugin.log(Level.SEVERE, "exception while disposing test manager", t);
- }
- }
-
- /**
- * Saves the multi-page editor's document.
- */
- @Override
- public void doSave(IProgressMonitor monitor) {
- if (getActivePage() != sourcePage) {
- pageSourceLoad();
- }
- getEditor(sourcePage).doSave(monitor);
- fileIsDirty = false;
- fileWasSaved = true;
- doSave();
- firePropertyChange(PROP_DIRTY);
- }
-
- /**
- * Saves the multi-page editor's document as another file. Also updates the text for page 0's tab, and updates this
- * multi-page editor's input to correspond to the nested editor's.
- */
- @Override
- public void doSaveAs() {
- if (getActivePage() != sourcePage) {
- pageSourceLoad();
- }
- IEditorPart editor = getEditor(sourcePage);
- editor.doSaveAs();
- setPageText(sourcePage, "Source");
- setInput(editor.getEditorInput());
- readXmlData();
- doSave();
- }
-
- protected void registerPage(int pageNumber, String pageName) {
- setPageText(pageNumber, pageName);
- }
-
- public void executionCompleted() {
- pageManager.getScriptPage().onScriptRunning(false);
- }
-
- public void fireSaveNeeded() {
- fileIsDirty = true;
- firePropertyChange(PROP_DIRTY);
- }
-
- public String getAlternateOutputDir() {
- String scriptOutput = "";
-
- IPropertyStore propertyStore = getPropertyStore();
- scriptOutput = propertyStore.get(TestManagerStorageKeys.SCRIPT_OUTPUT_DIRECTORY_KEY);
- if (scriptOutput == null) {
- scriptOutput = "";
- // TODO: Escobar
- // try {
- // IEditorInput coreinput = getEditorInput();
- // if (coreinput instanceof IFileEditorInput) {
- // scriptOutput =
- // thisIFile.getPersistentProperty(scriptOutputQualName);
- // } else if (coreinput instanceof TestManagerInput) {
- // TestManagerInput input = (TestManagerInput) getEditorInput();
- // scriptOutput =
- // input.getValue(scriptOutputQualName.getLocalName());
- // }
- //
- // scriptOutput =
- // thisIFile.getPersistentProperty(scriptOutputQualName);
- // } catch (CoreException e) {
- // e.printStackTrace();
- // }
- }
- return scriptOutput;
- }
-
- public String getDefaultConfigPath() {
- Location user = Platform.getUserLocation();
- String path = user.getURL().getPath();
- File file = new File(path + File.separator + "org.eclipse.osee.ote.ui.test.manager");
- file.mkdirs();
- file =
- new File(
- path + File.separator + "org.eclipse.osee.ote.ui.test.manager" + File.separator + this.getClass().getName() + ".scriptConfig.xml");
- file.getParentFile().mkdirs();
- return file.getAbsolutePath();
- }
-
- /**
- * @return Returns the model.
- */
- public TestManagerModel getModel() {
- return model;
- }
-
- public String getName() {
- return this.getTitle();
- }
-
- public ClassServerInst getScriptClassServer() {
- return ClassServerInst.getInstance();
- }
-
- public ITestManagerFactory getTestManagerFactory() {
- return testManagerFactory;
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
- if (!(editorInput instanceof IFileEditorInput || editorInput instanceof TestManagerInput || editorInput instanceof IEditorInput)) {
- throw new PartInitException("Invalid Input: Must be IFileEditorInput");
- }
- super.init(site, editorInput);
- }
-
- @Override
- public boolean isDirty() {
- if (super.isDirty()) {
- return true;
- }
- return fileIsDirty;
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /**
- * Retrieves the value for the key. See <code>storeValue</code>. If the key could not be found, an empty string is
- * returned.
- *
- * @param key The <code>QualifiedName</code> whose value is to be retrieved.
- * @return The value of key, or an empty string if the key does not exist.
- */
- public String loadValue(QualifiedName key) {
- TestManagerPlugin.log(Level.INFO, "loadValue: " + key.getQualifier());
- try {
- IEditorInput coreinput = getEditorInput();
- if (coreinput instanceof IFileEditorInput) {
- return thisIFile.getPersistentProperty(key);
- } else if (coreinput instanceof TestManagerInput) {
- TestManagerInput input = (TestManagerInput) getEditorInput();
- return input.getValue(key.getLocalName());
- }
- } catch (CoreException ex) {
- TestManagerPlugin.log(Level.SEVERE, "Can't get value: " + ex);
- }
- return "";
- }
-
- public void setPageError(int page, boolean set) {
- if (set) {
- setPageImage(page, errorImage);
- } else {
- setPageImage(page, null);
- }
- }
-
- /**
- * Stores the value for the key. The key should be one of the publicly available <code>QualifiedName</code>'s in
- * <code>this</code>.
- *
- * @param key The <code>QualifiedName</code> associated with the value to be stored
- * @param value What will be stored under the key.
- */
- public void storeValue(QualifiedName key, String value) {
- TestManagerPlugin.log(Level.INFO, "storeValue: " + key.getQualifier());
- try {
- IEditorInput coreinput = getEditorInput();
- if (coreinput instanceof IFileEditorInput) {
- thisIFile.setPersistentProperty(key, value);
- } else if (coreinput instanceof TestManagerInput) {
- TestManagerInput input = (TestManagerInput) getEditorInput();
- input.storeValue(key.getLocalName(), value);
- }
- } catch (Exception ex) {
- TestManagerPlugin.log(Level.SEVERE, "Can't set value: " + ex);
- }
- }
-
- private void pageSourceCheck() {
- setPageError(sourcePage, model.hasParseExceptions());
- }
-
- private void readXmlData() {
- TestManagerPlugin.log(Level.INFO, "readXmlData");
- IEditorInput coreinput = getEditorInput();
- if (coreinput instanceof IFileEditorInput) {
- IFileEditorInput input = (IFileEditorInput) getEditorInput();
- thisIFile = input.getFile();
- String name = thisIFile.getName();
- this.setPartName(name);
- model.setConfiguration(name);
- if (thisIFile != null) {
- IPath containerPath = thisIFile.getRawLocation();
- model.filename = containerPath.toOSString();
- try {
-
- xmlText = Lib.inputStreamToString(thisIFile.getContents());
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- } else {
- TestManagerPlugin.log(Level.SEVERE, "Can't open xml file!");
- }
- } else if (coreinput instanceof TestManagerInput) {
- TestManagerInput input = (TestManagerInput) getEditorInput();
- String name = "TestManager";
- this.setPartName(name);
- model.setConfiguration(name);
- xmlText = input.getDefaultXML();
- }
- }
-
- /**
- * Creates the pages of the multi-page editor.
- */
- @Override
- protected void createPages() {
- readXmlData();
-
- if (model.setFromXml(xmlText)) {
- pageManager.createPages(getContainer());
- pageSourceCreate();
-
- fileIsDirty = false;
- reloadSourcePage = false;
- pageSourceCheck();
- restoreSettings();
- }
- // If parse errors, send to sourcePage and set error on page
- else {
- if (sourceEditor == null) {
- pageSourceCreate();
- setActivePage(sourcePage);
- return;
- }
- pageSourceCheck();
- setPageImage(sourcePage, errorImage);
- setActivePage(sourcePage);
- }
- fileIsDirty = false;
- firePropertyChange(PROP_DIRTY);
- TestManagerPlugin.getInstance().getOteClientService().addConnectionListener(this);
- }
-
- protected void handleSelection() {
- fireSaveNeeded();
- reloadSourcePage = true;
- }
-
- /**
- * reloads pages as necessary
- */
- @Override
- protected void pageChange(int newPageIndex) {
- // NOTE: Hosts page will be updated continuously, even it if it is not
- // the current page.
- // so it is unnecessary to update it on pageChange.
-
- super.pageChange(newPageIndex);
- if (newPageIndex == sourcePage) {
- pageSourceLoad();
- } else {
- if (sourceEditor == null) {
- return;
- }
- String newXml = sourceEditor.getDocumentProvider().getDocument(sourceEditor.getEditorInput()).get();
- if (sourceEditor.isDirty() || fileWasSaved) {
- fileWasSaved = false;
- // If we just came from sourcePage, re-parse
- if (lastPageIndex == sourcePage) {
- // if parse error, goto source and error
- if (!model.setFromXml(newXml)) {
- setActivePage(sourcePage);
- setPageError(sourcePage, true);
- MessageDialog.openError(getSite().getShell(), "Source Page Error",
- "Error parsing Source page\n\n" + model.getParseExceptions());
- return;
- }
- setPageError(sourcePage, false);
- }
- }
- }
- lastPageIndex = newPageIndex;
- }
-
- void pageSourceCreate() {
- try {
- if (getEditorInput() instanceof IFileEditorInput) {
- sourceEditor = new TextEditor();
- int index = addPage(sourceEditor, getEditorInput());
- sourcePage = index;
- setPageText(sourcePage, "Source");
- }
- } catch (PartInitException e) {
- TestManagerPlugin.log(Level.SEVERE, "Error creating nested text editor", e);
- ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus());
- }
- }
-
- void pageSourceLoad() {
- if (reloadSourcePage) {
- sourceEditor.getDocumentProvider().getDocument(sourceEditor.getEditorInput()).set(model.getRawXml());
- reloadSourcePage = false;
- }
- pageSourceCheck();
- }
-
- public void doSave() {
- readXmlData();
- model.setFromXml(xmlText);
- pageManager.save();
- OutputStream outputStream = null;
- try {
- File file = OseeData.getFile("testManagerSettings.xml");
- outputStream = new FileOutputStream(file);
- getPropertyStore().save(outputStream);
- } catch (Exception ex) {
- TestManagerPlugin.log(Level.SEVERE, "Error storing settings.", ex);
- } finally {
- if (outputStream != null) {
- try {
- outputStream.close();
- } catch (IOException ex) {
- TestManagerPlugin.log(Level.WARNING, "Error closing stream during settings storage.", ex);
- }
- }
- }
- }
-
- public void restoreSettings() {
- InputStream inputStream = null;
- try {
- File file = OseeData.getFile("testManagerSettings.xml");
- inputStream = new FileInputStream(file);
- getPropertyStore().load(inputStream);
- pageManager.restore();
- } catch (Exception ex) {
- TestManagerPlugin.log(Level.WARNING, "Stored settings not available. Using defaults.", ex);
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException ex) {
- TestManagerPlugin.log(Level.WARNING, "Error closing stream while loading settings.", ex);
- }
- }
- }
- }
-
- public IPropertyStore getPropertyStore() {
- return propertyStore;
- }
-
- public PageManager getPageManager() {
- return pageManager;
- }
-
- public String getActionDescription() {
- String version =
- (String) Platform.getBundle("org.eclipse.osee.ote.ui.test.manager").getHeaders().get("Bundle-Version");
- String serverVersion = "";
- try {
- serverVersion = (String) Platform.getBundle("org.eclipse.osee.ote.core").getHeaders().get("Bundle-Version");
- } catch (Exception ex) {
- // do nothing
- }
- StringBuilder builder = new StringBuilder();
- builder.append("Problem found on OSEE TM Version: ");
- builder.append(version);
- builder.append("\nServer Version: ");
- builder.append(serverVersion);
- builder.append("\nTM File: ");
- builder.append(getTitle());
- builder.append("\n");
- builder.append("OFP: \"");
- builder.append(pageManager.getScriptPage().getOFP());
- builder.append("\"\n");
- builder.append("Scripts: \n");
- builder.append(pageManager.getScriptPage().getScripts());
- builder.append("\n");
-
- builder.append(getPropertyStore().toString());
-
- return builder.toString();
- }
-
- @Override
- public void onConnectionLost(IServiceConnector connector) {
- connectedEnv = null;
- connector = null;
- boolean problemEncountered = pageManager.onConnectionLost();
- if (problemEncountered) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(Displays.getActiveShell(), "Disconnect Error",
- "Test manager has encountered a problem while processing the disconnect event. See Error Log for details");
- }
- });
- }
- connectedHost = null;
- }
-
- @Override
- public void onPostConnect(ConnectionEvent event) {
- connectedEnv = event.getEnvironment();
- connectedHost = event.getHostEnvironment();
- connector = event.getConnector();
- boolean problemEncountered = pageManager.onPostConnect(event);
- if (problemEncountered) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(Displays.getActiveShell(), "Connection Error",
- "Test manager has encountered a problem while processing the connection event. See Error Log for details");
- }
- });
- }
- }
-
- @Override
- public void onPreDisconnect(ConnectionEvent event) {
- event.getEnvironment();
- connectedEnv = null;
-
- connector = null;
- boolean problemEncountered = pageManager.onPreDisconnect(event);
- if (problemEncountered) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(Displays.getActiveShell(), "Disconnect Error",
- "Test manager has encountered a problem while processing the disconnect event. See Error Log for details");
- }
- });
- }
- connectedHost = null;
- }
-
- public boolean isConnected() {
- return connectedEnv != null;
- }
-
- public ITestEnvironment getConnectedEnvironment() {
- return connectedEnv;
- }
-
- public IHostTestEnvironment getConnectedHostEnvironment() {
- return connectedHost;
- }
-
- public IServiceConnector getConnector() {
- return connector;
- }
-
- public abstract void createHostWidget(Composite parent);
-
- /**
- * @param array
- */
- public void addFiles(String[] files) {
- pageManager.getScriptPage().addFiles(files);
- }
+ private static final Image errorImage = ImageManager.getImage(OteTestManagerImage.ERROR);
+ public static final String namespace = "org.eclipse.osee.ote.ui.test.manager.editors.TestManagerEditor";
+
+ public final QualifiedName clearCaseViewName = new QualifiedName(namespace, "CLEARCASEVIEW");
+ public final QualifiedName configFileName = new QualifiedName(namespace, "CONFIGFILENAME");
+ public final QualifiedName ofpQualName = new QualifiedName(namespace, "OFP");
+ public final QualifiedName scriptsQualName = new QualifiedName(namespace, "SCRIPTS");
+
+ private boolean fileIsDirty = false;
+
+ private boolean fileWasSaved = false;
+
+ private int lastPageIndex = 0;
+
+ private final TestManagerModel model;
+
+ private boolean reloadSourcePage = false;
+
+ private int scriptPageIndex;
+
+ private TextEditor sourceEditor;
+
+ private int sourcePage;
+
+ private final ITestManagerFactory testManagerFactory;
+
+ private IFile thisIFile = null;
+
+ private String xmlText;
+
+ private final IPropertyStore propertyStore;
+
+ private final PageManager pageManager;
+
+ private ITestEnvironment connectedEnv = null;
+ private IServiceConnector connector = null;
+ private IHostTestEnvironment connectedHost;
+
+ public TestManagerEditor(final ITestManagerFactory testManagerFactory) {
+ super();
+
+ this.testManagerFactory = testManagerFactory;
+ this.pageManager = new PageManager(testManagerFactory, this);
+ this.model = new TestManagerModel();
+ this.propertyStore = new PropertyStore(testManagerFactory.getClass().getSimpleName());
+ }
+
+ public void activateScriptsPage() {
+ setActivePage(scriptPageIndex);
+ }
+
+ public void addFile(String fullPath) {
+ pageManager.getScriptPage().addFile(fullPath);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ TestManagerPlugin.getInstance().getOteClientService().removeConnectionListener(this);
+ try {
+ pageManager.dispose();
+ } catch (Throwable t) {
+ TestManagerPlugin.log(Level.SEVERE, "exception while disposing test manager", t);
+ }
+ }
+
+ /**
+ * Saves the multi-page editor's document.
+ */
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ if (getActivePage() != sourcePage) {
+ pageSourceLoad();
+ }
+ getEditor(sourcePage).doSave(monitor);
+ fileIsDirty = false;
+ fileWasSaved = true;
+ doSave();
+ firePropertyChange(PROP_DIRTY);
+ }
+
+ /**
+ * Saves the multi-page editor's document as another file. Also updates the text for page 0's tab, and updates this
+ * multi-page editor's input to correspond to the nested editor's.
+ */
+ @Override
+ public void doSaveAs() {
+ if (getActivePage() != sourcePage) {
+ pageSourceLoad();
+ }
+ IEditorPart editor = getEditor(sourcePage);
+ editor.doSaveAs();
+ setPageText(sourcePage, "Source");
+ setInput(editor.getEditorInput());
+ readXmlData();
+ doSave();
+ }
+
+ protected void registerPage(int pageNumber, String pageName) {
+ setPageText(pageNumber, pageName);
+ }
+
+ public void executionCompleted() {
+ pageManager.getScriptPage().onScriptRunning(false);
+ }
+
+ public void fireSaveNeeded() {
+ fileIsDirty = true;
+ firePropertyChange(PROP_DIRTY);
+ }
+
+ public String getAlternateOutputDir() {
+ String scriptOutput = "";
+
+ IPropertyStore propertyStore = getPropertyStore();
+ scriptOutput = propertyStore.get(TestManagerStorageKeys.SCRIPT_OUTPUT_DIRECTORY_KEY);
+ if (scriptOutput == null) {
+ scriptOutput = "";
+ // TODO: Escobar
+ // try {
+ // IEditorInput coreinput = getEditorInput();
+ // if (coreinput instanceof IFileEditorInput) {
+ // scriptOutput =
+ // thisIFile.getPersistentProperty(scriptOutputQualName);
+ // } else if (coreinput instanceof TestManagerInput) {
+ // TestManagerInput input = (TestManagerInput) getEditorInput();
+ // scriptOutput =
+ // input.getValue(scriptOutputQualName.getLocalName());
+ // }
+ //
+ // scriptOutput =
+ // thisIFile.getPersistentProperty(scriptOutputQualName);
+ // } catch (CoreException e) {
+ // e.printStackTrace();
+ // }
+ }
+ return scriptOutput;
+ }
+
+ public String getDefaultConfigPath() {
+ Location user = Platform.getUserLocation();
+ String path = user.getURL().getPath();
+ File file = new File(path + File.separator + "org.eclipse.osee.ote.ui.test.manager");
+ file.mkdirs();
+ file =
+ new File(
+ path + File.separator + "org.eclipse.osee.ote.ui.test.manager" + File.separator + this.getClass().getName() + ".scriptConfig.xml");
+ file.getParentFile().mkdirs();
+ return file.getAbsolutePath();
+ }
+
+ /**
+ * @return Returns the model.
+ */
+ public TestManagerModel getModel() {
+ return model;
+ }
+
+ public String getName() {
+ return this.getTitle();
+ }
+
+ public ClassServerInst getScriptClassServer() {
+ return ClassServerInst.getInstance();
+ }
+
+ public ITestManagerFactory getTestManagerFactory() {
+ return testManagerFactory;
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
+ if (!(editorInput instanceof IFileEditorInput || editorInput instanceof TestManagerInput || editorInput instanceof IEditorInput)) {
+ throw new PartInitException("Invalid Input: Must be IFileEditorInput");
+ }
+ super.init(site, editorInput);
+ }
+
+ @Override
+ public boolean isDirty() {
+ if (super.isDirty()) {
+ return true;
+ }
+ return fileIsDirty;
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * Retrieves the value for the key. See <code>storeValue</code>. If the key could not be found, an empty string is
+ * returned.
+ *
+ * @param key The <code>QualifiedName</code> whose value is to be retrieved.
+ * @return The value of key, or an empty string if the key does not exist.
+ */
+ public String loadValue(QualifiedName key) {
+ TestManagerPlugin.log(Level.INFO, "loadValue: " + key.getQualifier());
+ try {
+ IEditorInput coreinput = getEditorInput();
+ if (coreinput instanceof IFileEditorInput) {
+ return thisIFile.getPersistentProperty(key);
+ } else if (coreinput instanceof TestManagerInput) {
+ TestManagerInput input = (TestManagerInput) getEditorInput();
+ return input.getValue(key.getLocalName());
+ }
+ } catch (CoreException ex) {
+ TestManagerPlugin.log(Level.SEVERE, "Can't get value: " + ex);
+ }
+ return "";
+ }
+
+ public void setPageError(int page, boolean set) {
+ if (set) {
+ setPageImage(page, errorImage);
+ } else {
+ setPageImage(page, null);
+ }
+ }
+
+ /**
+ * Stores the value for the key. The key should be one of the publicly available <code>QualifiedName</code>'s in
+ * <code>this</code>.
+ *
+ * @param key The <code>QualifiedName</code> associated with the value to be stored
+ * @param value What will be stored under the key.
+ */
+ public void storeValue(QualifiedName key, String value) {
+ TestManagerPlugin.log(Level.INFO, "storeValue: " + key.getQualifier());
+ try {
+ IEditorInput coreinput = getEditorInput();
+ if (coreinput instanceof IFileEditorInput) {
+ thisIFile.setPersistentProperty(key, value);
+ } else if (coreinput instanceof TestManagerInput) {
+ TestManagerInput input = (TestManagerInput) getEditorInput();
+ input.storeValue(key.getLocalName(), value);
+ }
+ } catch (Exception ex) {
+ TestManagerPlugin.log(Level.SEVERE, "Can't set value: " + ex);
+ }
+ }
+
+ private void pageSourceCheck() {
+ setPageError(sourcePage, model.hasParseExceptions());
+ }
+
+ private void readXmlData() {
+ TestManagerPlugin.log(Level.INFO, "readXmlData");
+ IEditorInput coreinput = getEditorInput();
+ if (coreinput instanceof IFileEditorInput) {
+ IFileEditorInput input = (IFileEditorInput) getEditorInput();
+ thisIFile = input.getFile();
+ String name = thisIFile.getName();
+ this.setPartName(name);
+ model.setConfiguration(name);
+ if (thisIFile != null) {
+ IPath containerPath = thisIFile.getRawLocation();
+ model.filename = containerPath.toOSString();
+ try {
+
+ xmlText = Lib.inputStreamToString(thisIFile.getContents());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ } else {
+ TestManagerPlugin.log(Level.SEVERE, "Can't open xml file!");
+ }
+ } else if (coreinput instanceof TestManagerInput) {
+ TestManagerInput input = (TestManagerInput) getEditorInput();
+ String name = "TestManager";
+ this.setPartName(name);
+ model.setConfiguration(name);
+ xmlText = input.getDefaultXML();
+ }
+ }
+
+ /**
+ * Creates the pages of the multi-page editor.
+ */
+ @Override
+ protected void createPages() {
+ readXmlData();
+
+ if (model.setFromXml(xmlText)) {
+ pageManager.createPages(getContainer());
+ pageSourceCreate();
+
+ fileIsDirty = false;
+ reloadSourcePage = false;
+ pageSourceCheck();
+ restoreSettings();
+ }
+ // If parse errors, send to sourcePage and set error on page
+ else {
+ if (sourceEditor == null) {
+ pageSourceCreate();
+ setActivePage(sourcePage);
+ return;
+ }
+ pageSourceCheck();
+ setPageImage(sourcePage, errorImage);
+ setActivePage(sourcePage);
+ }
+ fileIsDirty = false;
+ firePropertyChange(PROP_DIRTY);
+ TestManagerPlugin.getInstance().getOteClientService().addConnectionListener(this);
+ }
+
+ protected void handleSelection() {
+ fireSaveNeeded();
+ reloadSourcePage = true;
+ }
+
+ /**
+ * reloads pages as necessary
+ */
+ @Override
+ protected void pageChange(int newPageIndex) {
+ // NOTE: Hosts page will be updated continuously, even it if it is not
+ // the current page.
+ // so it is unnecessary to update it on pageChange.
+
+ super.pageChange(newPageIndex);
+ if (newPageIndex == sourcePage) {
+ pageSourceLoad();
+ } else {
+ if (sourceEditor == null) {
+ return;
+ }
+ String newXml = sourceEditor.getDocumentProvider().getDocument(sourceEditor.getEditorInput()).get();
+ if (sourceEditor.isDirty() || fileWasSaved) {
+ fileWasSaved = false;
+ // If we just came from sourcePage, re-parse
+ if (lastPageIndex == sourcePage) {
+ // if parse error, goto source and error
+ if (!model.setFromXml(newXml)) {
+ setActivePage(sourcePage);
+ setPageError(sourcePage, true);
+ MessageDialog.openError(getSite().getShell(), "Source Page Error",
+ "Error parsing Source page\n\n" + model.getParseExceptions());
+ return;
+ }
+ setPageError(sourcePage, false);
+ }
+ }
+ }
+ lastPageIndex = newPageIndex;
+ }
+
+ void pageSourceCreate() {
+ try {
+ if (getEditorInput() instanceof IFileEditorInput) {
+ sourceEditor = new TextEditor();
+ int index = addPage(sourceEditor, getEditorInput());
+ sourcePage = index;
+ setPageText(sourcePage, "Source");
+ }
+ } catch (PartInitException e) {
+ TestManagerPlugin.log(Level.SEVERE, "Error creating nested text editor", e);
+ ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus());
+ }
+ }
+
+ void pageSourceLoad() {
+ if (reloadSourcePage) {
+ sourceEditor.getDocumentProvider().getDocument(sourceEditor.getEditorInput()).set(model.getRawXml());
+ reloadSourcePage = false;
+ }
+ pageSourceCheck();
+ }
+
+ public void doSave() {
+ readXmlData();
+ model.setFromXml(xmlText);
+ pageManager.save();
+ OutputStream outputStream = null;
+ try {
+ File file = OseeData.getFile("testManagerSettings.xml");
+ outputStream = new FileOutputStream(file);
+ getPropertyStore().save(outputStream);
+ } catch (Exception ex) {
+ TestManagerPlugin.log(Level.SEVERE, "Error storing settings.", ex);
+ } finally {
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException ex) {
+ TestManagerPlugin.log(Level.WARNING, "Error closing stream during settings storage.", ex);
+ }
+ }
+ }
+ }
+
+ public void restoreSettings() {
+ InputStream inputStream = null;
+ try {
+ File file = OseeData.getFile("testManagerSettings.xml");
+ inputStream = new FileInputStream(file);
+ getPropertyStore().load(inputStream);
+ pageManager.restore();
+ } catch (Exception ex) {
+ TestManagerPlugin.log(Level.WARNING, "Stored settings not available. Using defaults.", ex);
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException ex) {
+ TestManagerPlugin.log(Level.WARNING, "Error closing stream while loading settings.", ex);
+ }
+ }
+ }
+ }
+
+ public IPropertyStore getPropertyStore() {
+ return propertyStore;
+ }
+
+ public PageManager getPageManager() {
+ return pageManager;
+ }
+
+ @Override
+ public String getActionDescription() {
+ String version =
+ (String) Platform.getBundle("org.eclipse.osee.ote.ui.test.manager").getHeaders().get("Bundle-Version");
+ String serverVersion = "";
+ try {
+ serverVersion = (String) Platform.getBundle("org.eclipse.osee.ote.core").getHeaders().get("Bundle-Version");
+ } catch (Exception ex) {
+ // do nothing
+ }
+ StringBuilder builder = new StringBuilder();
+ builder.append("Problem found on OSEE TM Version: ");
+ builder.append(version);
+ builder.append("\nServer Version: ");
+ builder.append(serverVersion);
+ builder.append("\nTM File: ");
+ builder.append(getTitle());
+ builder.append("\n");
+ builder.append("OFP: \"");
+ builder.append(pageManager.getScriptPage().getOFP());
+ builder.append("\"\n");
+ builder.append("Scripts: \n");
+ builder.append(pageManager.getScriptPage().getScripts());
+ builder.append("\n");
+
+ builder.append(getPropertyStore().toString());
+
+ return builder.toString();
+ }
+
+ @Override
+ public void onConnectionLost(IServiceConnector connector) {
+ connectedEnv = null;
+ connector = null;
+ boolean problemEncountered = pageManager.onConnectionLost();
+ if (problemEncountered) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(Displays.getActiveShell(), "Disconnect Error",
+ "Test manager has encountered a problem while processing the disconnect event. See Error Log for details");
+ }
+ });
+ }
+ connectedHost = null;
+ }
+
+ @Override
+ public void onPostConnect(ConnectionEvent event) {
+ connectedEnv = event.getEnvironment();
+ connectedHost = event.getHostEnvironment();
+ connector = event.getConnector();
+ boolean problemEncountered = pageManager.onPostConnect(event);
+ if (problemEncountered) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(Displays.getActiveShell(), "Connection Error",
+ "Test manager has encountered a problem while processing the connection event. See Error Log for details");
+ }
+ });
+ }
+ }
+
+ @Override
+ public void onPreDisconnect(ConnectionEvent event) {
+ event.getEnvironment();
+ connectedEnv = null;
+
+ connector = null;
+ boolean problemEncountered = pageManager.onPreDisconnect(event);
+ if (problemEncountered) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(Displays.getActiveShell(), "Disconnect Error",
+ "Test manager has encountered a problem while processing the disconnect event. See Error Log for details");
+ }
+ });
+ }
+ connectedHost = null;
+ }
+
+ public boolean isConnected() {
+ return connectedEnv != null;
+ }
+
+ public ITestEnvironment getConnectedEnvironment() {
+ return connectedEnv;
+ }
+
+ public IHostTestEnvironment getConnectedHostEnvironment() {
+ return connectedHost;
+ }
+
+ public IServiceConnector getConnector() {
+ return connector;
+ }
+
+ public abstract void createHostWidget(Composite parent);
+
+ /**
+ * @param array
+ */
+ public void addFiles(String[] files) {
+ pageManager.getScriptPage().addFiles(files);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorContributor.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorContributor.java
index aa85e434d4..a95ade24ae 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorContributor.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorContributor.java
@@ -39,33 +39,36 @@ public class TestManagerEditorContributor extends MultiPageEditorActionBarContri
createActions();
}
+ @Override
public void setActivePage(IEditorPart part) {
- if (activeEditorPart == part) return;
+ if (activeEditorPart == part) {
+ return;
+ }
activeEditorPart = part;
IActionBars actionBars = getActionBars();
if (actionBars != null) {
- ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
+ ITextEditor editor = part instanceof ITextEditor ? (ITextEditor) part : null;
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor,
- ITextEditorActionConstants.DELETE));
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor,
- ITextEditorActionConstants.UNDO));
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor,
- ITextEditorActionConstants.REDO));
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
+ getAction(editor, ITextEditorActionConstants.DELETE));
+ actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
+ getAction(editor, ITextEditorActionConstants.UNDO));
+ actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(),
+ getAction(editor, ITextEditorActionConstants.REDO));
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT));
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor,
- ITextEditorActionConstants.COPY));
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor,
- ITextEditorActionConstants.PASTE));
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor,
- ITextEditorActionConstants.SELECT_ALL));
- actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor,
- ITextEditorActionConstants.FIND));
- actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor,
- IDEActionFactory.BOOKMARK.getId()));
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),
+ getAction(editor, ITextEditorActionConstants.COPY));
+ actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
+ getAction(editor, ITextEditorActionConstants.PASTE));
+ actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
+ getAction(editor, ITextEditorActionConstants.SELECT_ALL));
+ actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(),
+ getAction(editor, ITextEditorActionConstants.FIND));
+ actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(),
+ getAction(editor, IDEActionFactory.BOOKMARK.getId()));
actionBars.updateActionBars();
}
}
@@ -76,7 +79,7 @@ public class TestManagerEditorContributor extends MultiPageEditorActionBarContri
* @return IAction or null if editor is null.
*/
protected IAction getAction(ITextEditor editor, String actionID) {
- return (editor == null ? null : editor.getAction(actionID));
+ return editor == null ? null : editor.getAction(actionID);
}
private void createActions() {
@@ -100,20 +103,13 @@ public class TestManagerEditorContributor extends MultiPageEditorActionBarContri
public void contributeToStatusLine(final IStatusLineManager statusLineManager) {
super.contributeToStatusLine(statusLineManager);
try {
- /*Job addStatusLineManager = new Job("TM contributing to the status line.") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- OseeContributionItem.addTo(statusLineManager);
- } catch (Throwable th) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, th.getMessage(), th);
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
- };
- addStatusLineManager.schedule();*/
+ /*
+ * Job addStatusLineManager = new Job("TM contributing to the status line.") {
+ * @Override protected IStatus run(IProgressMonitor monitor) { try {
+ * OseeContributionItem.addTo(statusLineManager); } catch (Throwable th) { OseeLog.log(TestManagerPlugin.class,
+ * Level.SEVERE, th.getMessage(), th); return Status.CANCEL_STATUS; } return Status.OK_STATUS; } };
+ * addStatusLineManager.schedule();
+ */
} catch (Throwable th) {
OseeLog.log(TestManagerPlugin.class, Level.WARNING, "Unable to contribute to the status line.", th);
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInput.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInput.java
index 3700a0748a..fff6b88038 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInput.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInput.java
@@ -25,7 +25,7 @@ import org.eclipse.ui.IPersistableElement;
public class TestManagerEditorInput implements IFileEditorInput, IPersistableElement {
private static final String FACTORY_ID = TestManagerEditorInputFactory.class.getCanonicalName();
- private IFile iFile;
+ private final IFile iFile;
public TestManagerEditorInput(File file) {
this(AWorkspace.fileToIFile(file));
@@ -39,9 +39,11 @@ public class TestManagerEditorInput implements IFileEditorInput, IPersistableEle
/*
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object o) {
- if (o == this)
+ if (o == this) {
return true;
+ }
if (iFile != null && o instanceof TestManagerEditorInput) {
TestManagerEditorInput input = (TestManagerEditorInput) o;
@@ -53,6 +55,7 @@ public class TestManagerEditorInput implements IFileEditorInput, IPersistableEle
/*
* @see org.eclipse.ui.IEditorInput#exists()
*/
+ @Override
public boolean exists() {
return true;
}
@@ -60,15 +63,18 @@ public class TestManagerEditorInput implements IFileEditorInput, IPersistableEle
/*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @Override
@SuppressWarnings("unchecked")
public Object getAdapter(Class adapter) {
return iFile.getAdapter(adapter);
}
+ @Override
public String getFactoryId() {
return FACTORY_ID;
}
+ @Override
public IFile getFile() {
return iFile;
}
@@ -76,6 +82,7 @@ public class TestManagerEditorInput implements IFileEditorInput, IPersistableEle
/*
* @see org.eclipse.ui.IEditorInput#getImageDescriptor()
*/
+ @Override
public ImageDescriptor getImageDescriptor() {
return null;
}
@@ -94,6 +101,7 @@ public class TestManagerEditorInput implements IFileEditorInput, IPersistableEle
/*
* @see org.eclipse.ui.IEditorInput#getName()
*/
+ @Override
public String getName() {
return iFile.getName();
}
@@ -101,30 +109,37 @@ public class TestManagerEditorInput implements IFileEditorInput, IPersistableEle
/*
* @see org.eclipse.ui.IEditorInput#getPersistable()
*/
+ @Override
public IPersistableElement getPersistable() {
return this;
}
+ @Override
public IStorage getStorage() throws CoreException {
return new IStorage() {
+ @Override
@SuppressWarnings("unchecked")
public Object getAdapter(Class adapter) {
return iFile.getAdapter(adapter);
}
+ @Override
public InputStream getContents() throws CoreException {
return iFile.getContents();
}
+ @Override
public IPath getFullPath() {
return iFile.getFullPath();
}
+ @Override
public String getName() {
return iFile.getName();
}
+ @Override
public boolean isReadOnly() {
return false;
}
@@ -135,6 +150,7 @@ public class TestManagerEditorInput implements IFileEditorInput, IPersistableEle
/*
* @see org.eclipse.ui.IEditorInput#getToolTipText()
*/
+ @Override
public String getToolTipText() {
return iFile.getName();
}
@@ -142,10 +158,12 @@ public class TestManagerEditorInput implements IFileEditorInput, IPersistableEle
/*
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return iFile.hashCode();
}
+ @Override
public void saveState(IMemento memento) {
if (iFile != null && iFile.getLocation().toFile().exists()) {
memento.putString("path", iFile.getLocation().toFile().getAbsolutePath());
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInputFactory.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInputFactory.java
index 8a09827872..b8a4b81251 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInputFactory.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditorInputFactory.java
@@ -20,6 +20,7 @@ public class TestManagerEditorInputFactory implements IElementFactory {
public TestManagerEditorInputFactory() {
}
+ @Override
public IAdaptable createElement(IMemento memento) {
String path = memento.getString("path");
File file = new File(path);
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerInput.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerInput.java
index c411514b86..923a5dd9a4 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerInput.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerInput.java
@@ -31,22 +31,27 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class TestManagerInput implements IEditorInput {
- private HashMap<String, String> keyValue;
+ private final HashMap<String, String> keyValue;
public TestManagerInput() {
keyValue = new HashMap<String, String>();
loadFromFile();
}
+ @Override
public boolean equals(Object object) {
- if (object instanceof TestManagerInput) return true;
+ if (object instanceof TestManagerInput) {
+ return true;
+ }
return false;
}
+ @Override
public boolean exists() {
return false;
}
+ @Override
@SuppressWarnings("unchecked")
public Object getAdapter(Class adapter) {
return null;
@@ -57,18 +62,22 @@ public class TestManagerInput implements IEditorInput {
}
+ @Override
public ImageDescriptor getImageDescriptor() {
return null;
}
+ @Override
public String getName() {
return "TestManager";
}
+ @Override
public IPersistableElement getPersistable() {
return null;
}
+ @Override
public String getToolTipText() {
return "OSEE TestManager";
}
@@ -86,8 +95,8 @@ public class TestManagerInput implements IEditorInput {
Location user = Platform.getUserLocation();
String path = user.getURL().getPath();
File file =
- new File(
- path + File.separator + "org.eclipse.osee.ote.ui.test.manager" + File.separator + this.getClass().getName() + ".xml");
+ new File(
+ path + File.separator + "org.eclipse.osee.ote.ui.test.manager" + File.separator + this.getClass().getName() + ".xml");
file.getParentFile().mkdirs();
return file;
}
@@ -121,7 +130,7 @@ public class TestManagerInput implements IEditorInput {
Iterator<String> it = keyValue.keySet().iterator();
while (it.hasNext()) {
- String key = (String) it.next();
+ String key = it.next();
String value = keyValue.get(key);
if (key != null && value != null && !key.equals("") && !value.equals("")) {
Element pair = document.createElement("Pair");
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java
index 8ccd2a9ba8..a9a7249fe5 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java
@@ -28,13 +28,11 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-
/**
* Base Class for all TestManagers
*/
public class TestManagerModel {
-
final static String CONFIGURATION = "configuration";
final static String CONTACT = "contact";
final static String DESCRIPTION = "description";
@@ -45,10 +43,10 @@ public class TestManagerModel {
private String contact = "";
private String description = "";
private String[] ofps = null;
- private List<String> parseExceptions = new ArrayList<String>();
+ private final List<String> parseExceptions = new ArrayList<String>();
private String rawXml = "";
protected String filename = "";
- private Map<String, String> defaultOfpExe = new HashMap<String,String>();
+ private final Map<String, String> defaultOfpExe = new HashMap<String, String>();
public TestManagerModel() {
}
@@ -134,24 +132,21 @@ public class TestManagerModel {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// Call this to catch parse errors
-
+
Document document = factory.newDocumentBuilder().parse(new InputSource(new StringReader(xmlString)));
-
+
parseDocument(xmlString, document);
- }
- catch (ParserConfigurationException e) {
+ } catch (ParserConfigurationException e) {
OseeLog.log(TestManagerPlugin.class, Level.SEVERE, e.toString());
parseExceptions.add(e.toString());
return false;
- }
- catch (SAXException e) {
+ } catch (SAXException e) {
OseeLog.log(TestManagerPlugin.class, Level.SEVERE, e.toString());
OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "xmlText *" + xmlString + "*");
parseExceptions.add(e.toString());
return false;
- }
- catch (IOException e) {
+ } catch (IOException e) {
OseeLog.log(TestManagerPlugin.class, Level.SEVERE, e.toString());
parseExceptions.add(e.toString());
return false;
@@ -181,22 +176,22 @@ public class TestManagerModel {
NodeList nodeList = document.getFirstChild().getChildNodes();
List<String> ofpList = new ArrayList<String>();
defaultOfpExe.clear();
- for(int i = 0; i < nodeList.getLength(); i++){
+ for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
- if(node.getNodeName().equals(DESCRIPTION)){
+ if (node.getNodeName().equals(DESCRIPTION)) {
description = node.getTextContent();
- } else if(node.getNodeName().equals(CONTACT)){
+ } else if (node.getNodeName().equals(CONTACT)) {
contact = node.getTextContent();
- } else if(node.getNodeName().equals(OFP)){
+ } else if (node.getNodeName().equals(OFP)) {
Node defaultType = node.getAttributes().getNamedItem("default");
- if(defaultType != null){
+ if (defaultType != null) {
String defaultTypeAsString = defaultType.getNodeValue();
defaultOfpExe.put("default_" + defaultTypeAsString, node.getTextContent().trim());
}
ofpList.add(node.getTextContent().trim());
}
}
-
+
ofps = ofpList.toArray(new String[ofpList.size()]);// AXml.getTagDataArray(xmlString, OFP);
OseeLog.log(TestManagerPlugin.class, Level.INFO, "description *" + description + "*");
OseeLog.log(TestManagerPlugin.class, Level.INFO, "contact *" + contact + "*");
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/ScriptRunJob.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/ScriptRunJob.java
index 6a716bbfec..eea2d7aaff 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/ScriptRunJob.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/ScriptRunJob.java
@@ -30,117 +30,117 @@ import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
* @author Roberto E. Escobar
*/
public class ScriptRunJob extends Job {
- private static final String JOB_NAME = "Script Run Job";
-
- private final TestManagerEditor testManagerEditor;
- private final List<ScriptTask> runTasks;
-
- public ScriptRunJob(TestManagerEditor testManagerEditor) {
- super(JOB_NAME);
- this.testManagerEditor = testManagerEditor;
- this.testManagerEditor.doSave();
- ScriptPage scriptPage = getScriptPage();
- scriptPage.getScriptTableViewer().refresh();
- this.runTasks = scriptPage.getScriptTableViewer().getRunTasks();
- }
-
- public IStatus verifyOutfileLocations() {
- final LinkedList<IStatus> failedLocations = new LinkedList<IStatus>();
- for (ScriptTask task : runTasks) {
- final String fileName = task.getScriptModel().getOutputModel().getRawFilename();
- final File file = new File(fileName);
- if (file.exists() && (!file.canWrite() || !file.canRead())) {
- failedLocations.add(new Status(Status.ERROR, TestManagerPlugin.PLUGIN_ID, "could not access " + fileName));
- } else if (!file.getParentFile().canWrite()) {
- failedLocations.add(new Status(Status.ERROR, TestManagerPlugin.PLUGIN_ID, "could not access " + fileName));
- }
- }
- if (failedLocations.isEmpty()) {
- return Status.OK_STATUS;
- } else {
- return new Status(Status.ERROR, TestManagerPlugin.PLUGIN_ID, "unable to access out files") {
-
- @Override
- public boolean isMultiStatus() {
- return true;
- }
-
- @Override
- public IStatus[] getChildren() {
- return failedLocations.toArray(new IStatus[failedLocations.size()]);
- }
-
- };
- }
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- IStatus toReturn = Status.CANCEL_STATUS;
- final IStatus status = verifyOutfileLocations();
-
- if (status != Status.OK_STATUS) {
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- ErrorDialog.openError(
- Displays.getActiveShell(),
- "Script Run Error",
- "Could not access some out file locations. Check access permissions. Click Details to see a list of failed locations",
- status, -1);
- }
-
- });
-
- return Status.OK_STATUS;
- }
-
- long time = System.currentTimeMillis();
-
- clearMarkers();
- getScriptPage().onScriptRunning(true);
-
- long elapsed = System.currentTimeMillis() - time;
- OseeLog.log(TestManagerPlugin.class, Level.FINE,
- String.format("%d milliseconds to initialize the running of scripts.", elapsed));
- OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("%d scripts have been batched.", runTasks.size()));
-
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- getScriptPage().getScriptManager().addTestsToQueue(runTasks);
- }
-
- });
- toReturn = Status.OK_STATUS;
- return toReturn;
- }
-
- private ScriptPage getScriptPage() {
- return this.testManagerEditor.getPageManager().getScriptPage();
- }
-
- public boolean isRunAllowed() {
-
- return this.testManagerEditor.getPageManager().areSettingsValidForRun();
-
- }
-
- private void clearMarkers() {
- // TODO can we somehow wait until the script is actually run to remove
- // the markers? Otherwise if the run is aborted before the script
- // runs...
-
- // Remove markers from scripts to be run
- // for (ScriptTask task : runTasks) {
- // try {
- // MarkerSupport.deleteMarkersFromInputFile(task.getScriptModel().getIFile());
- // }
- // catch (Exception ex) {
- // OseeLog.log(Activator.class, Level.SEVERE, "Unable to clear the tests markers before
- // running the test.", ex);
- // }
- // }
- }
+ private static final String JOB_NAME = "Script Run Job";
+
+ private final TestManagerEditor testManagerEditor;
+ private final List<ScriptTask> runTasks;
+
+ public ScriptRunJob(TestManagerEditor testManagerEditor) {
+ super(JOB_NAME);
+ this.testManagerEditor = testManagerEditor;
+ this.testManagerEditor.doSave();
+ ScriptPage scriptPage = getScriptPage();
+ scriptPage.getScriptTableViewer().refresh();
+ this.runTasks = scriptPage.getScriptTableViewer().getRunTasks();
+ }
+
+ public IStatus verifyOutfileLocations() {
+ final LinkedList<IStatus> failedLocations = new LinkedList<IStatus>();
+ for (ScriptTask task : runTasks) {
+ final String fileName = task.getScriptModel().getOutputModel().getRawFilename();
+ final File file = new File(fileName);
+ if (file.exists() && (!file.canWrite() || !file.canRead())) {
+ failedLocations.add(new Status(IStatus.ERROR, TestManagerPlugin.PLUGIN_ID, "could not access " + fileName));
+ } else if (!file.getParentFile().canWrite()) {
+ failedLocations.add(new Status(IStatus.ERROR, TestManagerPlugin.PLUGIN_ID, "could not access " + fileName));
+ }
+ }
+ if (failedLocations.isEmpty()) {
+ return Status.OK_STATUS;
+ } else {
+ return new Status(IStatus.ERROR, TestManagerPlugin.PLUGIN_ID, "unable to access out files") {
+
+ @Override
+ public boolean isMultiStatus() {
+ return true;
+ }
+
+ @Override
+ public IStatus[] getChildren() {
+ return failedLocations.toArray(new IStatus[failedLocations.size()]);
+ }
+
+ };
+ }
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ IStatus toReturn = Status.CANCEL_STATUS;
+ final IStatus status = verifyOutfileLocations();
+
+ if (status != Status.OK_STATUS) {
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ ErrorDialog.openError(
+ Displays.getActiveShell(),
+ "Script Run Error",
+ "Could not access some out file locations. Check access permissions. Click Details to see a list of failed locations",
+ status, -1);
+ }
+
+ });
+
+ return Status.OK_STATUS;
+ }
+
+ long time = System.currentTimeMillis();
+
+ clearMarkers();
+ getScriptPage().onScriptRunning(true);
+
+ long elapsed = System.currentTimeMillis() - time;
+ OseeLog.log(TestManagerPlugin.class, Level.FINE,
+ String.format("%d milliseconds to initialize the running of scripts.", elapsed));
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, String.format("%d scripts have been batched.", runTasks.size()));
+
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ getScriptPage().getScriptManager().addTestsToQueue(runTasks);
+ }
+
+ });
+ toReturn = Status.OK_STATUS;
+ return toReturn;
+ }
+
+ private ScriptPage getScriptPage() {
+ return this.testManagerEditor.getPageManager().getScriptPage();
+ }
+
+ public boolean isRunAllowed() {
+
+ return this.testManagerEditor.getPageManager().areSettingsValidForRun();
+
+ }
+
+ private void clearMarkers() {
+ // TODO can we somehow wait until the script is actually run to remove
+ // the markers? Otherwise if the run is aborted before the script
+ // runs...
+
+ // Remove markers from scripts to be run
+ // for (ScriptTask task : runTasks) {
+ // try {
+ // MarkerSupport.deleteMarkersFromInputFile(task.getScriptModel().getIFile());
+ // }
+ // catch (Exception ex) {
+ // OseeLog.log(Activator.class, Level.SEVERE, "Unable to clear the tests markers before
+ // running the test.", ex);
+ // }
+ // }
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java
index 1bbecc39ce..bdae93a4c1 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java
@@ -38,129 +38,129 @@ import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
*/
public class StoreOutfileJob extends Job {
- private final ScriptManager userEnvironment;
- private final ScriptTask scriptTask;
- private final boolean isValidRun;
- private final TestManagerEditor testManagerEditor;
- private final ITestEnvironment env;
+ private final ScriptManager userEnvironment;
+ private final ScriptTask scriptTask;
+ private final boolean isValidRun;
+ private final TestManagerEditor testManagerEditor;
+ private final ITestEnvironment env;
- private final String clientOutfilePath;
+ private final String clientOutfilePath;
- private final String serverOutfilePath;
+ private final String serverOutfilePath;
- public StoreOutfileJob(ITestEnvironment env, TestManagerEditor testManagerEditor, ScriptManager userEnvironment, ScriptTask scriptTask, String clientOutfilePath, String serverOutfilePath, boolean isValidRun) {
- super("Store: " + scriptTask.getName());
- this.env = env;
- this.scriptTask = scriptTask;
- this.testManagerEditor = testManagerEditor;
- this.userEnvironment = userEnvironment;
- this.isValidRun = isValidRun;
- this.clientOutfilePath = clientOutfilePath;
- this.serverOutfilePath = serverOutfilePath;
- }
+ public StoreOutfileJob(ITestEnvironment env, TestManagerEditor testManagerEditor, ScriptManager userEnvironment, ScriptTask scriptTask, String clientOutfilePath, String serverOutfilePath, boolean isValidRun) {
+ super("Store: " + scriptTask.getName());
+ this.env = env;
+ this.scriptTask = scriptTask;
+ this.testManagerEditor = testManagerEditor;
+ this.userEnvironment = userEnvironment;
+ this.isValidRun = isValidRun;
+ this.clientOutfilePath = clientOutfilePath;
+ this.serverOutfilePath = serverOutfilePath;
+ }
- public static void scheduleJob(Job job) {
- job.setUser(false);
- job.setPriority(Job.SHORT);
- job.schedule();
- }
+ public static void scheduleJob(Job job) {
+ job.setUser(false);
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if (isValidRun == true) {
- try {
- storeOutfile(scriptTask);
- } catch (Exception e) {
- return new Status(Status.ERROR, TestManagerPlugin.PLUGIN_ID, "Failed to write out file to workspace", e);
- }
- }
- // scriptTask.computeExists();
- userEnvironment.updateScriptTableViewer(scriptTask);
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- processOutFile(scriptTask);
- } catch (Exception ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
- }
- return Status.OK_STATUS;
- }
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if (isValidRun == true) {
+ try {
+ storeOutfile(scriptTask);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, TestManagerPlugin.PLUGIN_ID, "Failed to write out file to workspace", e);
+ }
+ }
+ // scriptTask.computeExists();
+ userEnvironment.updateScriptTableViewer(scriptTask);
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ processOutFile(scriptTask);
+ } catch (Exception ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
+ }
+ return Status.OK_STATUS;
+ }
- public void processOutFile(ScriptTask task) {
- OseeLog.log(TestManagerPlugin.class, Level.INFO, "Processing Outfile: " + task.getName());
- // task.computeExists();
- File xmlSourceFile = task.getScriptModel().getOutputModel().getFile();
- IFile javaSourceIFile = task.getScriptModel().getIFile();
+ public void processOutFile(ScriptTask task) {
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, "Processing Outfile: " + task.getName());
+ // task.computeExists();
+ File xmlSourceFile = task.getScriptModel().getOutputModel().getFile();
+ IFile javaSourceIFile = task.getScriptModel().getIFile();
- if (!xmlSourceFile.exists()) {
- TestManagerPlugin.getInstance().getOteConsoleService().writeError("Output File Not Created");
- } else {
- // Refresh the parent so the workspace knows the new tmo file exists
- AWorkspace.refreshResource(javaSourceIFile);
- task.getScriptModel().getOutputModel().updateTestPointsFromOutfile();
- int failedPoints = task.getScriptModel().getOutputModel().getFailedTestPoints();
- userEnvironment.updateScriptTableViewer(scriptTask);
- if (failedPoints > 0) {
- // Print fails in red, but don't force the console to popup
- TestManagerPlugin.getInstance().getOteConsoleService().write(
- String.format("Test Point Failures => %s[%d]", task.getName(), failedPoints),
- OseeConsole.CONSOLE_ERROR, false);
- }
- }
- }
+ if (!xmlSourceFile.exists()) {
+ TestManagerPlugin.getInstance().getOteConsoleService().writeError("Output File Not Created");
+ } else {
+ // Refresh the parent so the workspace knows the new tmo file exists
+ AWorkspace.refreshResource(javaSourceIFile);
+ task.getScriptModel().getOutputModel().updateTestPointsFromOutfile();
+ int failedPoints = task.getScriptModel().getOutputModel().getFailedTestPoints();
+ userEnvironment.updateScriptTableViewer(scriptTask);
+ if (failedPoints > 0) {
+ // Print fails in red, but don't force the console to popup
+ TestManagerPlugin.getInstance().getOteConsoleService().write(
+ String.format("Test Point Failures => %s[%d]", task.getName(), failedPoints), OseeConsole.CONSOLE_ERROR,
+ false);
+ }
+ }
+ }
- private boolean isKeepSavedOutfileEnabled() {
- return testManagerEditor.getPropertyStore().getBoolean(TestManagerStorageKeys.KEEP_OLD_OUTFILE_COPIES_ENABLED_KEY);
- }
+ private boolean isKeepSavedOutfileEnabled() {
+ return testManagerEditor.getPropertyStore().getBoolean(TestManagerStorageKeys.KEEP_OLD_OUTFILE_COPIES_ENABLED_KEY);
+ }
- private void storeOutfile(ScriptTask scriptTask) throws Exception {
- if (clientOutfilePath.equals(serverOutfilePath) != true) {
- // the paths are different so we need to copy the file
- byte[] outBytes = env.getScriptOutfile(serverOutfilePath);
- if (outBytes != null && outBytes.length > 0) {
+ private void storeOutfile(ScriptTask scriptTask) throws Exception {
+ if (clientOutfilePath.equals(serverOutfilePath) != true) {
+ // the paths are different so we need to copy the file
+ byte[] outBytes = env.getScriptOutfile(serverOutfilePath);
+ if (outBytes != null && outBytes.length > 0) {
- if (isKeepSavedOutfileEnabled()) {
- moveOutputToNextAvailableSpot(scriptTask);
- }
- // else {
- // task.getScriptModel().getOutputModel().getIFile().delete(true, null);
- // }
- IFile file = AIFile.constructIFile(clientOutfilePath);
- if (file != null) {
- AIFile.writeToFile(file, new ByteArrayInputStream(outBytes));
- MarkerPlugin.getDefault().addMarkers(file);
- } else {
- Lib.writeBytesToFile(outBytes, new File(clientOutfilePath));
- }
- }
- }
- }
+ if (isKeepSavedOutfileEnabled()) {
+ moveOutputToNextAvailableSpot(scriptTask);
+ }
+ // else {
+ // task.getScriptModel().getOutputModel().getIFile().delete(true, null);
+ // }
+ IFile file = AIFile.constructIFile(clientOutfilePath);
+ if (file != null) {
+ AIFile.writeToFile(file, new ByteArrayInputStream(outBytes));
+ MarkerPlugin.getDefault().addMarkers(file);
+ } else {
+ Lib.writeBytesToFile(outBytes, new File(clientOutfilePath));
+ }
+ }
+ }
+ }
- private void moveOutputToNextAvailableSpot(ScriptTask task) {
- OutputModel outputModel = task.getScriptModel().getOutputModel();
- File oldFile = outputModel.getFile();
- if (oldFile != null && oldFile.exists() && oldFile.isFile() && oldFile.canRead()) {
- String outputExtension = "." + outputModel.getFileExtension();
- int fileNum = 1;
- File destFile =
- new File(oldFile.getAbsoluteFile().toString().replaceFirst(outputExtension,
- "." + fileNum + outputExtension));
- if (destFile.exists()) {
- while (destFile.exists()) {
- fileNum++;
- destFile =
- new File(oldFile.getAbsoluteFile().toString().replaceFirst(outputExtension,
- "." + fileNum + outputExtension));
- }
- }
- try {
- Lib.copyFile(oldFile, destFile);
- } catch (IOException e2) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Failed to move output file to next available spot", e2);
- }
- }
- }
+ private void moveOutputToNextAvailableSpot(ScriptTask task) {
+ OutputModel outputModel = task.getScriptModel().getOutputModel();
+ File oldFile = outputModel.getFile();
+ if (oldFile != null && oldFile.exists() && oldFile.isFile() && oldFile.canRead()) {
+ String outputExtension = "." + outputModel.getFileExtension();
+ int fileNum = 1;
+ File destFile =
+ new File(
+ oldFile.getAbsoluteFile().toString().replaceFirst(outputExtension, "." + fileNum + outputExtension));
+ if (destFile.exists()) {
+ while (destFile.exists()) {
+ fileNum++;
+ destFile =
+ new File(oldFile.getAbsoluteFile().toString().replaceFirst(outputExtension,
+ "." + fileNum + outputExtension));
+ }
+ }
+ try {
+ Lib.copyFile(oldFile, destFile);
+ } catch (IOException e2) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Failed to move output file to next available spot", e2);
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/FileModel.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/FileModel.java
index 475ded59e1..edb3550ac7 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/FileModel.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/FileModel.java
@@ -23,11 +23,8 @@ import org.eclipse.osee.framework.ui.ws.AWorkspace;
import org.eclipse.osee.ote.ui.test.manager.internal.TestManagerPlugin;
import org.eclipse.ui.PlatformUI;
-
-
public class FileModel {
-
private File file = null;
private IFile iFile = null;
private long lastModified = 0;
@@ -37,8 +34,9 @@ public class FileModel {
public FileModel(String rawFilename) {
this.rawFilename = rawFilename;
- if (getIFile() != null)
+ if (getIFile() != null) {
lastModified = getIFile().getModificationStamp();
+ }
}
public boolean exists() {
@@ -80,10 +78,12 @@ public class FileModel {
* @return Returns the path.
*/
public String getPath() {
- if (iFile == null)
+ if (iFile == null) {
iFile = getIFile();
- if (iFile != null)
+ }
+ if (iFile != null) {
path = iFile.getFullPath().toString();
+ }
return path;
}
@@ -93,7 +93,7 @@ public class FileModel {
public String getRawFilename() {
return rawFilename;
}
-
+
public String getWorkspaceRelativePath() {
IWorkspace ws = ResourcesPlugin.getWorkspace();
IFile ifile = ws.getRoot().getFileForLocation(new Path(rawFilename));
@@ -105,32 +105,35 @@ public class FileModel {
}
public String getText() {
- if (iFile == null)
+ if (iFile == null) {
getIFile();
- if (iFile == null)
+ }
+ if (iFile == null) {
return "";
+ }
if (text == null || iFile.getModificationStamp() != lastModified) {
text = AFile.readFile(rawFilename);
OseeLog.log(TestManagerPlugin.class, Level.INFO, "getText: Reading file " + getName());
- }
- else
+ } else {
OseeLog.log(TestManagerPlugin.class, Level.INFO, "getText: Using buffered file " + getName());
+ }
lastModified = iFile.getModificationStamp();
return text;
}
public boolean isModified() {
- if (iFile == null)
+ if (iFile == null) {
getIFile();
+ }
if (iFile == null) {
OseeLog.log(TestManagerPlugin.class, Level.WARNING, "Can't Read iFile");
return true;
}
- return (iFile.getModificationStamp() != lastModified);
+ return iFile.getModificationStamp() != lastModified;
}
public void openEditor() {
- if(getIFile() != null){
+ if (getIFile() != null) {
AWorkspace.openEditor(getIFile());
}
}
@@ -139,12 +142,12 @@ public class FileModel {
OseeLog.log(TestManagerPlugin.class, Level.INFO, "Show in explorer " + getName());
// Open in Package Explorer and error if can't
boolean success = AWorkspace.showInPackageExplorer(getIFile());
-// if(!success){
-// success = AWorkspace.showInResourceNavigator(getIFile());
-// }
+ // if(!success){
+ // success = AWorkspace.showInResourceNavigator(getIFile());
+ // }
if (!success) {
MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Open Error",
- "Can't Show in Explorer\n\n" + getName());
+ "Can't Show in Explorer\n\n" + getName());
}
// As a convenience, open in Navigator, but don't error
success = AWorkspace.showInResourceNavigator(getIFile());
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/OutputModelJob.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/OutputModelJob.java
index 25a676ef41..57208efb48 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/OutputModelJob.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/OutputModelJob.java
@@ -20,25 +20,23 @@ import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
/**
* @author Andrew M. Finkbeiner
- *
*/
public class OutputModelJob extends Job {
private static OutputModelJob singleton = null;
- private ScriptManager scriptManager;
- private ConcurrentLinkedQueue<ScriptTask> outputModels = new ConcurrentLinkedQueue<ScriptTask>();
-
-
- public static void createSingleton(ScriptManager scriptManager){
- if(singleton == null){
+ private final ScriptManager scriptManager;
+ private final ConcurrentLinkedQueue<ScriptTask> outputModels = new ConcurrentLinkedQueue<ScriptTask>();
+
+ public static void createSingleton(ScriptManager scriptManager) {
+ if (singleton == null) {
singleton = new OutputModelJob(scriptManager);
}
}
-
- public static OutputModelJob getSingleton(){
+
+ public static OutputModelJob getSingleton() {
return singleton;
}
-
+
/**
* @param name
*/
@@ -50,7 +48,7 @@ public class OutputModelJob extends Job {
@Override
protected IStatus run(IProgressMonitor monitor) {
- while(!outputModels.isEmpty()){
+ while (!outputModels.isEmpty()) {
ScriptTask task = outputModels.remove();
task.getScriptModel().getOutputModel().updateTestPointsFromOutfile();
task.getPassFail();
@@ -58,10 +56,10 @@ public class OutputModelJob extends Job {
}
return Status.OK_STATUS;
}
-
- public void addTask(ScriptTask task){
+
+ public void addTask(ScriptTask task) {
outputModels.add(task);
schedule();
}
-
+
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/ScriptModel.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/ScriptModel.java
index 436182dbd6..da0895193f 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/ScriptModel.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/models/ScriptModel.java
@@ -24,155 +24,150 @@ import org.eclipse.osee.ote.core.environment.config.ScriptVersionConfig;
public class ScriptModel extends FileModel {
+ public enum ScriptInteractionEnum {
+ BATCH,
+ MANUAL,
+ UNKNOWN
+ }
- public enum ScriptInteractionEnum {
- BATCH, MANUAL, UNKNOWN
- }
-
- public class TestFileData {
- public String absoluteFilePath = null;
- public String classPath = null;
- public String error = "";
- public String name = null;
- public String outFile = null;
- public String projectPath = null;
- public String rawFileName;
-
- public ScriptVersionConfig getVersionInfo() {
- ScriptVersionConfig scriptVersion = new ScriptVersionConfig();
- File javaFile = new File(rawFileName);
- if (javaFile != null && javaFile.exists() && javaFile.canRead()) {
- IRepositoryEntry entry = VersionControl.getInstance()
- .getRepositoryEntry(javaFile);
- if (entry != null) {
- scriptVersion.setRevision(entry.getVersion());
- scriptVersion.setLocation(entry.getURL());
- scriptVersion.setRepositoryType(entry
- .getVersionControlSystem());
- scriptVersion.setLastAuthor(entry.getLastAuthor());
- scriptVersion.setLastModificationDate(entry
- .getLastModificationDate());
- scriptVersion.setModifiedFlag(entry.getModifiedFlag());
- }
- }
- return scriptVersion;
- }
- }
-
- private TestFileData javaFileData;
- private OutputModel outputModel;
- private TestScript testScript;
-
-
- /**
- * @param rawFilename
- * @param outputDir
- * alternate output directory for tmo output files null will
- * default to script directory
- */
- public ScriptModel(String rawFilename, String outputDir) {
- super(rawFilename);
- javaFileData = new TestFileData();
- javaFileData = getSunData(outputDir);
- javaFileData.rawFileName = rawFilename;
- outputModel = new OutputModel(javaFileData.outFile);
- }
-
- public ScriptInteractionEnum getInteraction() {
- if (testScript == null)
- return ScriptInteractionEnum.UNKNOWN;
- if (testScript.isBatchable())
- return ScriptInteractionEnum.BATCH;
- else
- return ScriptInteractionEnum.MANUAL;
- }
-
- /**
- * @return Returns the outputModel.
- */
- public OutputModel getOutputModel() {
- outputModel.setRawFilename(javaFileData.outFile);
- return outputModel;
-
- }
-
- /**
- * @param alternateOutputDir
- * place output files here instead of at location of the script
- * @return Returns sun data.
- */
- private TestFileData getSunData(String alternateOutputDir) {
- javaFileData.absoluteFilePath = getRawFilename();
- String temp = null;
- if (javaFileData.absoluteFilePath.endsWith(".java")) {
- temp = AJavaProject.getClassName(this.getRawFilename());
- }
- javaFileData.name = ((temp == null) ? new File(getRawFilename()).getName() : temp);
- javaFileData.classPath = "";
- alternateOutputDir = alternateOutputDir.trim();
- if (alternateOutputDir == null || alternateOutputDir.equals("")) {
- javaFileData.outFile = javaFileData.absoluteFilePath.replaceFirst(".java$", ".tmo");
- if (!javaFileData.outFile.endsWith(".tmo")) {
- javaFileData.outFile += ".tmo";
- }
- } else {
- try{
- File dir = new File(alternateOutputDir);
- if (dir.exists() && dir.isDirectory()) {
- javaFileData.outFile = alternateOutputDir;
- } else {
- if(getIFile() != null){
- IProject project = getIFile().getProject();
- IFolder folder = project.getFolder(alternateOutputDir);
- if(!folder.exists()){
- ContainerCreator containerCreator = new ContainerCreator(folder.getWorkspace(), folder.getFullPath());
- containerCreator.createContainer(new NullProgressMonitor());
- }
- javaFileData.outFile = folder.getLocation().toFile().getAbsolutePath();
- }
- }
-
- javaFileData.outFile += File.separator;
- javaFileData.outFile += getName();
- javaFileData.outFile = javaFileData.outFile.replaceFirst(".java$",".tmo");
- if (!javaFileData.outFile.endsWith(".tmo")) {
- javaFileData.outFile += ".tmo";
- }
- } catch (CoreException ex){
- ex.printStackTrace();
- javaFileData.outFile = javaFileData.absoluteFilePath.replaceFirst(".java$", ".tmo");
- if (!javaFileData.outFile.endsWith(".tmo")) {
- javaFileData.outFile += ".tmo";
- }
- }
- }
-// outputModel = new OutputModel(javaFileData.outFile);
-
-
-// OseeLog.log(TestManagerPlugin.class, Level.FINE, "javaFileData.absoluteJavaPath *"+ javaFileData.absoluteFilePath + "*");
-// OseeLog.log(TestManagerPlugin.class, Level.FINE, "javaFileData.className *" + javaFileData.name + "*");
-// OseeLog.log(TestManagerPlugin.class, Level.FINE, "javaFileData.classPath *" + javaFileData.classPath + "*");
-// OseeLog.log(TestManagerPlugin.class, Level.FINE, "javaFileData.outFile *" + javaFileData.outFile+ "*");
-
- return javaFileData;
- }
-
- public TestFileData updateScriptModelInfo(String alternateOutputDir){
- TestFileData javaFileData = getSunData(alternateOutputDir);
- outputModel = new OutputModel(javaFileData.outFile);
- return javaFileData;
- }
-
- public String getTestClass(){
- return javaFileData.name;
- }
-
- /**
- * @param outputModel
- * The outputModel to set.
- */
- public void setOutputModel(OutputModel outputModel) {
- this.outputModel = outputModel;
- }
+ public class TestFileData {
+ public String absoluteFilePath = null;
+ public String classPath = null;
+ public String error = "";
+ public String name = null;
+ public String outFile = null;
+ public String projectPath = null;
+ public String rawFileName;
+
+ public ScriptVersionConfig getVersionInfo() {
+ ScriptVersionConfig scriptVersion = new ScriptVersionConfig();
+ File javaFile = new File(rawFileName);
+ if (javaFile != null && javaFile.exists() && javaFile.canRead()) {
+ IRepositoryEntry entry = VersionControl.getInstance().getRepositoryEntry(javaFile);
+ if (entry != null) {
+ scriptVersion.setRevision(entry.getVersion());
+ scriptVersion.setLocation(entry.getURL());
+ scriptVersion.setRepositoryType(entry.getVersionControlSystem());
+ scriptVersion.setLastAuthor(entry.getLastAuthor());
+ scriptVersion.setLastModificationDate(entry.getLastModificationDate());
+ scriptVersion.setModifiedFlag(entry.getModifiedFlag());
+ }
+ }
+ return scriptVersion;
+ }
+ }
+
+ private TestFileData javaFileData;
+ private OutputModel outputModel;
+ private TestScript testScript;
+
+ /**
+ * @param rawFilename
+ * @param outputDir alternate output directory for tmo output files null will default to script directory
+ */
+ public ScriptModel(String rawFilename, String outputDir) {
+ super(rawFilename);
+ javaFileData = new TestFileData();
+ javaFileData = getSunData(outputDir);
+ javaFileData.rawFileName = rawFilename;
+ outputModel = new OutputModel(javaFileData.outFile);
+ }
+
+ public ScriptInteractionEnum getInteraction() {
+ if (testScript == null) {
+ return ScriptInteractionEnum.UNKNOWN;
+ }
+ if (testScript.isBatchable()) {
+ return ScriptInteractionEnum.BATCH;
+ } else {
+ return ScriptInteractionEnum.MANUAL;
+ }
+ }
+
+ /**
+ * @return Returns the outputModel.
+ */
+ public OutputModel getOutputModel() {
+ outputModel.setRawFilename(javaFileData.outFile);
+ return outputModel;
+
+ }
+
+ /**
+ * @param alternateOutputDir place output files here instead of at location of the script
+ * @return Returns sun data.
+ */
+ private TestFileData getSunData(String alternateOutputDir) {
+ javaFileData.absoluteFilePath = getRawFilename();
+ String temp = null;
+ if (javaFileData.absoluteFilePath.endsWith(".java")) {
+ temp = AJavaProject.getClassName(this.getRawFilename());
+ }
+ javaFileData.name = temp == null ? new File(getRawFilename()).getName() : temp;
+ javaFileData.classPath = "";
+ alternateOutputDir = alternateOutputDir.trim();
+ if (alternateOutputDir == null || alternateOutputDir.equals("")) {
+ javaFileData.outFile = javaFileData.absoluteFilePath.replaceFirst(".java$", ".tmo");
+ if (!javaFileData.outFile.endsWith(".tmo")) {
+ javaFileData.outFile += ".tmo";
+ }
+ } else {
+ try {
+ File dir = new File(alternateOutputDir);
+ if (dir.exists() && dir.isDirectory()) {
+ javaFileData.outFile = alternateOutputDir;
+ } else {
+ if (getIFile() != null) {
+ IProject project = getIFile().getProject();
+ IFolder folder = project.getFolder(alternateOutputDir);
+ if (!folder.exists()) {
+ ContainerCreator containerCreator =
+ new ContainerCreator(folder.getWorkspace(), folder.getFullPath());
+ containerCreator.createContainer(new NullProgressMonitor());
+ }
+ javaFileData.outFile = folder.getLocation().toFile().getAbsolutePath();
+ }
+ }
+
+ javaFileData.outFile += File.separator;
+ javaFileData.outFile += getName();
+ javaFileData.outFile = javaFileData.outFile.replaceFirst(".java$", ".tmo");
+ if (!javaFileData.outFile.endsWith(".tmo")) {
+ javaFileData.outFile += ".tmo";
+ }
+ } catch (CoreException ex) {
+ ex.printStackTrace();
+ javaFileData.outFile = javaFileData.absoluteFilePath.replaceFirst(".java$", ".tmo");
+ if (!javaFileData.outFile.endsWith(".tmo")) {
+ javaFileData.outFile += ".tmo";
+ }
+ }
+ }
+ // outputModel = new OutputModel(javaFileData.outFile);
+
+ // OseeLog.log(TestManagerPlugin.class, Level.FINE, "javaFileData.absoluteJavaPath *"+ javaFileData.absoluteFilePath + "*");
+ // OseeLog.log(TestManagerPlugin.class, Level.FINE, "javaFileData.className *" + javaFileData.name + "*");
+ // OseeLog.log(TestManagerPlugin.class, Level.FINE, "javaFileData.classPath *" + javaFileData.classPath + "*");
+ // OseeLog.log(TestManagerPlugin.class, Level.FINE, "javaFileData.outFile *" + javaFileData.outFile+ "*");
+
+ return javaFileData;
+ }
+
+ public TestFileData updateScriptModelInfo(String alternateOutputDir) {
+ TestFileData javaFileData = getSunData(alternateOutputDir);
+ outputModel = new OutputModel(javaFileData.outFile);
+ return javaFileData;
+ }
+
+ public String getTestClass() {
+ return javaFileData.name;
+ }
+
+ /**
+ * @param outputModel The outputModel to set.
+ */
+ public void setOutputModel(OutputModel outputModel) {
+ this.outputModel = outputModel;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/operations/AddIFileToTestManager.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/operations/AddIFileToTestManager.java
index 3d23381340..df1a6ca883 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/operations/AddIFileToTestManager.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/operations/AddIFileToTestManager.java
@@ -39,25 +39,25 @@ public class AddIFileToTestManager {
AWorkbench.popup("ERROR", "Test Manager Not Opened");
return;
}
- for(TestManagerEditor editor: PluginUtil.getTestManagers()){
+ for (TestManagerEditor editor : PluginUtil.getTestManagers()) {
editor.getPageManager().getScriptPage().getScriptTableViewer().getTaskList().removeAllTasks();
}
}
-
- public void addFilesToScriptPage(List<String> files, boolean removeOtherScripts){
+
+ public void addFilesToScriptPage(List<String> files, boolean removeOtherScripts) {
if (PluginUtil.areTestManagersAvailable() != true) {
AWorkbench.popup("ERROR", "Test Manager Not Opened");
return;
}
TestManagerEditor[] itemsToOpen = PluginUtil.getTestManagers();
for (TestManagerEditor tme : itemsToOpen) {
- if(removeOtherScripts){
+ if (removeOtherScripts) {
tme.getPageManager().getScriptPage().getScriptTableViewer().getTaskList().removeAllTasks();
}
tme.addFiles(files.toArray(new String[files.size()]));
}
}
-
+
public void addIFileToScriptsPage(String fullPath) {
if (PluginUtil.areTestManagersAvailable() != true) {
AWorkbench.popup("ERROR", "Test Manager Not Opened");
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/HostPage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/HostPage.java
index 0d7d536331..08d9d21beb 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/HostPage.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/HostPage.java
@@ -21,78 +21,77 @@ import org.eclipse.swt.widgets.Group;
public class HostPage extends TestManagerPage {
- private static final String pageName = "Hosts";
-
- public HostPage(Composite parent, int style,
- TestManagerEditor parentTestManager) {
- super(parent, style, parentTestManager);
- createPage();
- TestManagerPlugin.getInstance().setHelp(this, "tm_hosts_page", "org.eclipse.osee.framework.help.ui");
- }
-
- @Override
- public String getPageName() {
- return pageName;
- }
-
- protected void createPage() {
- super.createPage();
- Composite parent = (Composite) getContent();
-
- Group hostGroup = new Group(parent, SWT.NONE);
- hostGroup.setLayout(new GridLayout());
- hostGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- hostGroup.setText("Double click a Host to Connect/Disconnect");
-
- getTestManager().createHostWidget(hostGroup);
- computeScrollSize();
- }
-
- @Override
- public boolean areSettingsValidForRun() {
- return getTestManager().isConnected();
- }
-
- @Override
- public void restoreData() {
- // Do Nothing
- }
-
- @Override
- public void saveData() {
- // Do Nothing
- }
-
- @Override
- public String getErrorMessage() {
- StringBuilder builder = new StringBuilder();
- if (areSettingsValidForRun() != true) {
- builder.append("Connect to a Test Server");
- }
- return builder.toString();
- }
-
- @Override
- public boolean onConnection(ConnectionEvent event) {
- return false;
-
- }
-
- @Override
- public boolean onDisconnect(ConnectionEvent event) {
- return false;
-
- }
-
- @Override
- public boolean onConnectionLost() {
- return false;
- }
-
- @Override
- public void dispose() {
- super.dispose();
- }
-
+ private static final String pageName = "Hosts";
+
+ public HostPage(Composite parent, int style, TestManagerEditor parentTestManager) {
+ super(parent, style, parentTestManager);
+ createPage();
+ TestManagerPlugin.getInstance().setHelp(this, "tm_hosts_page", "org.eclipse.osee.framework.help.ui");
+ }
+
+ @Override
+ public String getPageName() {
+ return pageName;
+ }
+
+ @Override
+ protected void createPage() {
+ super.createPage();
+ Composite parent = (Composite) getContent();
+
+ Group hostGroup = new Group(parent, SWT.NONE);
+ hostGroup.setLayout(new GridLayout());
+ hostGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ hostGroup.setText("Double click a Host to Connect/Disconnect");
+
+ getTestManager().createHostWidget(hostGroup);
+ computeScrollSize();
+ }
+
+ @Override
+ public boolean areSettingsValidForRun() {
+ return getTestManager().isConnected();
+ }
+
+ @Override
+ public void restoreData() {
+ // Do Nothing
+ }
+
+ @Override
+ public void saveData() {
+ // Do Nothing
+ }
+
+ @Override
+ public String getErrorMessage() {
+ StringBuilder builder = new StringBuilder();
+ if (areSettingsValidForRun() != true) {
+ builder.append("Connect to a Test Server");
+ }
+ return builder.toString();
+ }
+
+ @Override
+ public boolean onConnection(ConnectionEvent event) {
+ return false;
+
+ }
+
+ @Override
+ public boolean onDisconnect(ConnectionEvent event) {
+ return false;
+
+ }
+
+ @Override
+ public boolean onConnectionLost() {
+ return false;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/OverviewPage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/OverviewPage.java
index 85bbbdc8ba..1145a2f82e 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/OverviewPage.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/OverviewPage.java
@@ -52,6 +52,7 @@ public class OverviewPage extends TestManagerPage implements IActionable {
return toolTip;
}
+ @Override
public String toString() {
return name().replaceAll("_", " ");
}
@@ -75,6 +76,7 @@ public class OverviewPage extends TestManagerPage implements IActionable {
/**
* @return Returns the pageName.
*/
+ @Override
public String getPageName() {
return pageName;
}
@@ -106,6 +108,7 @@ public class OverviewPage extends TestManagerPage implements IActionable {
}
}
+ @Override
protected void createPage() {
super.createPage();
Composite parent = (Composite) getContent();
@@ -123,11 +126,12 @@ public class OverviewPage extends TestManagerPage implements IActionable {
labelMap.put(enumEntry, updateableLabel);
}
- OseeUiActions.addButtonToEditorToolBar(this, TestManagerPlugin.getInstance(), composite, TestManagerEditor.namespace,
- "Test Manager");
+ OseeUiActions.addButtonToEditorToolBar(this, TestManagerPlugin.getInstance(), composite,
+ TestManagerEditor.namespace, "Test Manager");
}
+ @Override
public String getActionDescription() {
return "";
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/ScriptPage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/ScriptPage.java
index c45da3b50e..02c9a7a93f 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/ScriptPage.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/ScriptPage.java
@@ -49,419 +49,424 @@ import org.eclipse.ui.PlatformUI;
public abstract class ScriptPage extends TestManagerPage {
- private static final String NOT_CONNECTED = "<< NOT_CONNECTED >>";
-
- public enum UpdateableLabel {
- HOSTLABEL,
- CONFIGPATHLABEL;
- }
-
- public static final OseeUiActivator plugin = TestManagerPlugin.getInstance();
- private static final String pageName = "Scripts";
- private ToolItem abortButton;
- private ToolItem abortBatchButton;
- private CoolBar coolBar;
- private ToolItem deleteButton;
- private Label hostConnectLabel;
- private LoadWidget loadWidget;
- protected ToolItem runButton;
- private SaveWidget saveWidget;
- private ScriptTableViewer scriptTable;
- private StatusWindowWidget statusWindow;
- private final TestManagerEditor testManagerEditor;
-
- public ScriptPage(Composite parent, int style, TestManagerEditor parentTestManager) {
- super(parent, style, parentTestManager);
- this.testManagerEditor = parentTestManager;
- }
-
- public void addFile(String fullPath) {
- scriptTable.addFile(fullPath);
- }
-
- @Override
- public void createPage() {
- super.createPage();
- Composite parent = (Composite) getContent();
- coolBar = new CoolBar(parent, SWT.FLAT);
-
- createControlsToolBar(coolBar);
- createConfigurationToolBar(coolBar);
- packCoolBar();
-
- SashForm sashForm = new SashForm(parent, SWT.NONE);
- sashForm.setLayout(new GridLayout());
- sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- sashForm.setOrientation(SWT.VERTICAL);
- sashForm.SASH_WIDTH = 3;
-
- createScriptTableSection(sashForm);
- createStatusWindow(sashForm);
-
- sashForm.setWeights(new int[] {8, 2});
- computeScrollSize();
-
- TestManagerPlugin.getInstance().setHelp(this, "tm_scripts_page", "org.eclipse.osee.framework.help.ui");
- }
-
- public void loadStorageString() {
- scriptTable.loadStorageString(testManagerEditor.loadValue(testManagerEditor.scriptsQualName));
- }
-
- @Override
- public void dispose() {
- scriptTable.dispose();
- testManagerEditor.storeValue(testManagerEditor.scriptsQualName, scriptTable.getStorageString());
- OseeLog.log(TestManagerPlugin.class, Level.INFO, "ScriptPage Dispose Called");
- super.dispose();
- }
-
- public CoolBar getCoolBar() {
- return coolBar;
- }
-
- public String getOFP() {
- if (hostConnectLabel == null) {
- return "";
- }
- return hostConnectLabel.getText();
- }
-
- @Override
- public String getPageName() {
- return pageName;
- }
-
- public String getScripts() {
- if (scriptTable == null) {
- return "";
- } else if (scriptTable.getTaskList() == null) {
- return "";
- }
- return scriptTable.getTaskList().toString();
- }
-
- public ScriptTableViewer getScriptTableViewer() {
- return scriptTable;
- }
-
- public StatusWindowWidget getStatusWindow() {
- return statusWindow;
- }
-
- public void onScriptRunning(final boolean running) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (running) {
- runButton.setEnabled(false);
- abortButton.setEnabled(true);
- abortBatchButton.setEnabled(true);
- } else {
- runButton.setEnabled(true);
- abortButton.setEnabled(false);
- abortBatchButton.setEnabled(false);
- }
- }
- });
- }
-
- public void packCoolBar() {
- Point size = this.getSize();
- coolBar.setSize(coolBar.computeSize(size.x, size.y));
- }
-
- private void createConfigurationToolBar(CoolBar coolBar) {
- CoolItem configCoolItem = new CoolItem(coolBar, SWT.NONE);
- ToolBar configToolBar = new ToolBar(coolBar, SWT.FLAT | SWT.HORIZONTAL);
-
- saveWidget = new SaveWidget(this);
- saveWidget.createToolItem(configToolBar);
-
- loadWidget = new LoadWidget(this);
- loadWidget.createToolItem(configToolBar);
-
- deleteButton = new ToolItem(configToolBar, SWT.PUSH | SWT.CENTER);
- deleteButton.setImage(ImageManager.getImage(OteTestManagerImage.FILE_DELETE));
- deleteButton.setToolTipText("Deletes Selected (highlighted) Scripts");
- deleteButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleDeleteButton();
- }
- });
- deleteButton.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event e) {
- if (e.button == 3) {
- handleDeleteButton();
- }
- }
- });
-
- configToolBar.pack();
-
- Point size = configToolBar.getSize();
- configCoolItem.setControl(configToolBar);
- configCoolItem.setSize(configCoolItem.computeSize(size.x, size.y));
- configCoolItem.setMinimumSize(size);
- }
-
- private void createControlsToolBar(CoolBar coolBar) {
- CoolItem controlsCoolItem = new CoolItem(coolBar, SWT.NONE);
- ToolBar controlsToolBar = new ToolBar(coolBar, SWT.FLAT | SWT.HORIZONTAL);
-
- runButton = new ToolItem(controlsToolBar, SWT.PUSH | SWT.CENTER);
- runButton.setImage(ImageManager.getImage(OteTestManagerImage.SEL_RUN_EXEC));
- runButton.setDisabledImage(ImageManager.getImage(OteTestManagerImage.UNSEL_RUN_EXEC));
- runButton.setToolTipText("Runs the Checked Scripts");
- runButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleRunButton();
- }
- });
- runButton.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event e) {
- if (e.button == 3) {
- handleRunButton();
- }
- }
- });
- runButton.setEnabled(false);
-
- // Create and configure the "Abort" button
- abortButton = new ToolItem(controlsToolBar, SWT.PUSH | SWT.CENTER);
- abortButton.setImage(ImageManager.getImage(OteTestManagerImage.SEL_ABORT_STOP));
- abortButton.setDisabledImage(ImageManager.getImage(OteTestManagerImage.UNSEL_ABORT_STOP));
- abortButton.setToolTipText("Abort Currently Running Script");
- abortButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleAbortButton();
- abortBatchButton.setEnabled(false);
- abortButton.setEnabled(false);
- Timer timer = new Timer();
- timer.schedule(new EnabledAbortsTimer(), 30000);
- }
- });
- abortButton.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event e) {
- if (e.button == 3) {
- handleAbortButton();
- abortBatchButton.setEnabled(false);
- abortButton.setEnabled(false);
- Timer timer = new Timer();
- timer.schedule(new EnabledAbortsTimer(), 30000);
- }
- }
- });
- abortButton.setEnabled(false);
-
- abortBatchButton = new ToolItem(controlsToolBar, SWT.PUSH | SWT.CENTER);
- abortBatchButton.setImage(ImageManager.getImage(OteTestManagerImage.SEL_BATCH_ABORT_STOP));
- abortBatchButton.setDisabledImage(ImageManager.getImage(OteTestManagerImage.UNSEL_BATCH_ABORT_STOP));
- abortBatchButton.setToolTipText("Abort Script Batch");
- abortBatchButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleBatchAbortButton();
- abortBatchButton.setEnabled(false);
- abortButton.setEnabled(false);
- Timer timer = new Timer();
- timer.schedule(new EnabledAbortsTimer(), 30000);
- }
- });
- abortBatchButton.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event e) {
- if (e.button == 3) {
- handleBatchAbortButton();
- abortBatchButton.setEnabled(false);
- abortButton.setEnabled(false);
- Timer timer = new Timer();
- timer.schedule(new EnabledAbortsTimer(), 30000);
- }
- }
- });
- abortBatchButton.setEnabled(false);
-
- controlsToolBar.pack();
-
- Point size = controlsToolBar.getSize();
- controlsCoolItem.setControl(controlsToolBar);
- controlsCoolItem.setSize(controlsCoolItem.computeSize(size.x, size.y));
- controlsCoolItem.setMinimumSize(size);
- }
-
- private void createScriptTableSection(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- scriptTable = new ScriptTableViewer(composite, this.getTestManager());
- // scriptTable.addDisposeListener(new DisposeListener() {
- // public void widgetDisposed(DisposeEvent e) {
- // testManagerEditor.storeValue(testManagerEditor.scriptsQualName, scriptTable.getStorageString());
- // }
- // });
-
- }
-
- private void createStatusWindow(Composite parent) {
- statusWindow = new StatusWindowWidget(parent);
-
- statusWindow.setLabelAndValue(UpdateableLabel.HOSTLABEL.name(), "Selected Host", NOT_CONNECTED, SWT.BOLD,
- SWT.COLOR_DARK_RED);
-
- String selectedFile = testManagerEditor.loadValue(testManagerEditor.configFileName);
- if (selectedFile == null || selectedFile.equals("")) {
- selectedFile = testManagerEditor.getDefaultConfigPath();
- testManagerEditor.storeValue(testManagerEditor.configFileName, selectedFile);
- }
- OseeLog.log(TestManagerPlugin.class, Level.INFO, "The default config is: " + selectedFile);
-
- statusWindow.setLabelAndValue(UpdateableLabel.CONFIGPATHLABEL.name(), "Config File Path", selectedFile);
-
- saveWidget.setStatusLabel(statusWindow);
- loadWidget.setStatusLabel(statusWindow);
-
- // // Status ICON Labels
- // connectStatusIconLabel = new
- // Label(statusWindow.getStatusIconComposite(), SWT.NONE);
- // hostWidget.setConnectStatusLabel(connectStatusIconLabel);
- // connectStatusIconLabel.setVisible(false);
-
- statusWindow.refresh();
- }
-
- // TODO this stuff needs some updating too...
- protected void handleAbortButton() {
- TestManagerPlugin.getInstance().getOteConsoleService().write("Aborting Test Script...");
- try {
- getScriptManager().abortScript(false);
- } catch (RemoteException e) {
- TestManagerPlugin.getInstance().getOteConsoleService().writeError(Lib.exceptionToString(e));
- }
- }
-
- // TODO this stuff needs some updating too...
- protected void handleBatchAbortButton() {
- TestManagerPlugin.getInstance().getOteConsoleService().write("Aborting Test Script Batch...");
- try {
- getScriptManager().abortScript(true);
- } catch (RemoteException e) {
- TestManagerPlugin.getInstance().getOteConsoleService().writeError(Lib.exceptionToString(e));
- }
- }
-
- private void handleDeleteButton() {
- scriptTable.removeSelectedTasks();
- }
-
- private void handleRunButton() {
- ScriptRunJob runJob = new ScriptRunJob(getTestManager());
- if (runJob.isRunAllowed()) {
- runJob.setPriority(Job.LONG);
- runJob.setUser(true);
- runJob.schedule();
- } else {
- MessageDialog.openError(Displays.getActiveShell(), "Error", "Test Manager Settings Error");
- }
- }
-
- private class EnabledAbortsTimer extends TimerTask {
-
- @Override
- public void run() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- if (!runButton.isEnabled()) {
- abortBatchButton.setEnabled(true);
- abortButton.setEnabled(true);
- }
- } catch (Throwable th) {
-
- }
- }
- });
-
- }
-
- }
-
- @Override
- public boolean areSettingsValidForRun() {
- return getScriptTableViewer().getRunTasks().size() > 0;
- }
-
- @Override
- public String getErrorMessage() {
- StringBuilder builder = new StringBuilder();
- if (getScriptTableViewer().getRunTasks().size() <= 0) {
- builder.append("Scripts not selected.");
- }
- return builder.toString();
- }
-
- @Override
- public boolean onConnection(final ConnectionEvent event) {
- boolean result = getScriptManager().connect(event);
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- runButton.setEnabled(true);
- abortButton.setEnabled(false);
- abortBatchButton.setEnabled(false);
- scriptTable.onConnectionChanged(true);
- statusWindow.setValue(UpdateableLabel.HOSTLABEL.name(), event.getProperties().getStation(), SWT.BOLD,
- SWT.COLOR_DARK_GREEN);
- statusWindow.refresh();
- }
-
- });
- return result;
- }
-
- @Override
- public boolean onDisconnect(ConnectionEvent event) {
- boolean result = getScriptManager().disconnect(event);
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- runButton.setEnabled(false);
- abortButton.setEnabled(false);
- abortBatchButton.setEnabled(false);
- scriptTable.onConnectionChanged(false);
- statusWindow.setValue(UpdateableLabel.HOSTLABEL.name(), NOT_CONNECTED, SWT.BOLD, SWT.COLOR_DARK_RED);
- statusWindow.refresh();
- }
- });
- return result;
- }
-
- @Override
- public boolean onConnectionLost() {
- boolean result = getScriptManager().onConnectionLost();
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- runButton.setEnabled(false);
- abortButton.setEnabled(false);
- abortBatchButton.setEnabled(false);
- scriptTable.onConnectionChanged(false);
- statusWindow.setValue(UpdateableLabel.HOSTLABEL.name(), NOT_CONNECTED, SWT.BOLD, SWT.COLOR_DARK_RED);
- statusWindow.refresh();
- }
- });
- return result;
- }
-
- public abstract ScriptManager getScriptManager();
-
- /**
- * @param files
- */
- public void addFiles(String[] files) {
- scriptTable.addFiles(files);
- }
+ private static final String NOT_CONNECTED = "<< NOT_CONNECTED >>";
+
+ public enum UpdateableLabel {
+ HOSTLABEL,
+ CONFIGPATHLABEL;
+ }
+
+ public static final OseeUiActivator plugin = TestManagerPlugin.getInstance();
+ private static final String pageName = "Scripts";
+ private ToolItem abortButton;
+ private ToolItem abortBatchButton;
+ private CoolBar coolBar;
+ private ToolItem deleteButton;
+ private Label hostConnectLabel;
+ private LoadWidget loadWidget;
+ protected ToolItem runButton;
+ private SaveWidget saveWidget;
+ private ScriptTableViewer scriptTable;
+ private StatusWindowWidget statusWindow;
+ private final TestManagerEditor testManagerEditor;
+
+ public ScriptPage(Composite parent, int style, TestManagerEditor parentTestManager) {
+ super(parent, style, parentTestManager);
+ this.testManagerEditor = parentTestManager;
+ }
+
+ public void addFile(String fullPath) {
+ scriptTable.addFile(fullPath);
+ }
+
+ @Override
+ public void createPage() {
+ super.createPage();
+ Composite parent = (Composite) getContent();
+ coolBar = new CoolBar(parent, SWT.FLAT);
+
+ createControlsToolBar(coolBar);
+ createConfigurationToolBar(coolBar);
+ packCoolBar();
+
+ SashForm sashForm = new SashForm(parent, SWT.NONE);
+ sashForm.setLayout(new GridLayout());
+ sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ sashForm.setOrientation(SWT.VERTICAL);
+ sashForm.SASH_WIDTH = 3;
+
+ createScriptTableSection(sashForm);
+ createStatusWindow(sashForm);
+
+ sashForm.setWeights(new int[] {8, 2});
+ computeScrollSize();
+
+ TestManagerPlugin.getInstance().setHelp(this, "tm_scripts_page", "org.eclipse.osee.framework.help.ui");
+ }
+
+ public void loadStorageString() {
+ scriptTable.loadStorageString(testManagerEditor.loadValue(testManagerEditor.scriptsQualName));
+ }
+
+ @Override
+ public void dispose() {
+ scriptTable.dispose();
+ testManagerEditor.storeValue(testManagerEditor.scriptsQualName, scriptTable.getStorageString());
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, "ScriptPage Dispose Called");
+ super.dispose();
+ }
+
+ public CoolBar getCoolBar() {
+ return coolBar;
+ }
+
+ public String getOFP() {
+ if (hostConnectLabel == null) {
+ return "";
+ }
+ return hostConnectLabel.getText();
+ }
+
+ @Override
+ public String getPageName() {
+ return pageName;
+ }
+
+ public String getScripts() {
+ if (scriptTable == null) {
+ return "";
+ } else if (scriptTable.getTaskList() == null) {
+ return "";
+ }
+ return scriptTable.getTaskList().toString();
+ }
+
+ public ScriptTableViewer getScriptTableViewer() {
+ return scriptTable;
+ }
+
+ public StatusWindowWidget getStatusWindow() {
+ return statusWindow;
+ }
+
+ public void onScriptRunning(final boolean running) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (running) {
+ runButton.setEnabled(false);
+ abortButton.setEnabled(true);
+ abortBatchButton.setEnabled(true);
+ } else {
+ runButton.setEnabled(true);
+ abortButton.setEnabled(false);
+ abortBatchButton.setEnabled(false);
+ }
+ }
+ });
+ }
+
+ public void packCoolBar() {
+ Point size = this.getSize();
+ coolBar.setSize(coolBar.computeSize(size.x, size.y));
+ }
+
+ private void createConfigurationToolBar(CoolBar coolBar) {
+ CoolItem configCoolItem = new CoolItem(coolBar, SWT.NONE);
+ ToolBar configToolBar = new ToolBar(coolBar, SWT.FLAT | SWT.HORIZONTAL);
+
+ saveWidget = new SaveWidget(this);
+ saveWidget.createToolItem(configToolBar);
+
+ loadWidget = new LoadWidget(this);
+ loadWidget.createToolItem(configToolBar);
+
+ deleteButton = new ToolItem(configToolBar, SWT.PUSH | SWT.CENTER);
+ deleteButton.setImage(ImageManager.getImage(OteTestManagerImage.FILE_DELETE));
+ deleteButton.setToolTipText("Deletes Selected (highlighted) Scripts");
+ deleteButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleDeleteButton();
+ }
+ });
+ deleteButton.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ if (e.button == 3) {
+ handleDeleteButton();
+ }
+ }
+ });
+
+ configToolBar.pack();
+
+ Point size = configToolBar.getSize();
+ configCoolItem.setControl(configToolBar);
+ configCoolItem.setSize(configCoolItem.computeSize(size.x, size.y));
+ configCoolItem.setMinimumSize(size);
+ }
+
+ private void createControlsToolBar(CoolBar coolBar) {
+ CoolItem controlsCoolItem = new CoolItem(coolBar, SWT.NONE);
+ ToolBar controlsToolBar = new ToolBar(coolBar, SWT.FLAT | SWT.HORIZONTAL);
+
+ runButton = new ToolItem(controlsToolBar, SWT.PUSH | SWT.CENTER);
+ runButton.setImage(ImageManager.getImage(OteTestManagerImage.SEL_RUN_EXEC));
+ runButton.setDisabledImage(ImageManager.getImage(OteTestManagerImage.UNSEL_RUN_EXEC));
+ runButton.setToolTipText("Runs the Checked Scripts");
+ runButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleRunButton();
+ }
+ });
+ runButton.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ if (e.button == 3) {
+ handleRunButton();
+ }
+ }
+ });
+ runButton.setEnabled(false);
+
+ // Create and configure the "Abort" button
+ abortButton = new ToolItem(controlsToolBar, SWT.PUSH | SWT.CENTER);
+ abortButton.setImage(ImageManager.getImage(OteTestManagerImage.SEL_ABORT_STOP));
+ abortButton.setDisabledImage(ImageManager.getImage(OteTestManagerImage.UNSEL_ABORT_STOP));
+ abortButton.setToolTipText("Abort Currently Running Script");
+ abortButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleAbortButton();
+ abortBatchButton.setEnabled(false);
+ abortButton.setEnabled(false);
+ Timer timer = new Timer();
+ timer.schedule(new EnabledAbortsTimer(), 30000);
+ }
+ });
+ abortButton.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ if (e.button == 3) {
+ handleAbortButton();
+ abortBatchButton.setEnabled(false);
+ abortButton.setEnabled(false);
+ Timer timer = new Timer();
+ timer.schedule(new EnabledAbortsTimer(), 30000);
+ }
+ }
+ });
+ abortButton.setEnabled(false);
+
+ abortBatchButton = new ToolItem(controlsToolBar, SWT.PUSH | SWT.CENTER);
+ abortBatchButton.setImage(ImageManager.getImage(OteTestManagerImage.SEL_BATCH_ABORT_STOP));
+ abortBatchButton.setDisabledImage(ImageManager.getImage(OteTestManagerImage.UNSEL_BATCH_ABORT_STOP));
+ abortBatchButton.setToolTipText("Abort Script Batch");
+ abortBatchButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleBatchAbortButton();
+ abortBatchButton.setEnabled(false);
+ abortButton.setEnabled(false);
+ Timer timer = new Timer();
+ timer.schedule(new EnabledAbortsTimer(), 30000);
+ }
+ });
+ abortBatchButton.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ if (e.button == 3) {
+ handleBatchAbortButton();
+ abortBatchButton.setEnabled(false);
+ abortButton.setEnabled(false);
+ Timer timer = new Timer();
+ timer.schedule(new EnabledAbortsTimer(), 30000);
+ }
+ }
+ });
+ abortBatchButton.setEnabled(false);
+
+ controlsToolBar.pack();
+
+ Point size = controlsToolBar.getSize();
+ controlsCoolItem.setControl(controlsToolBar);
+ controlsCoolItem.setSize(controlsCoolItem.computeSize(size.x, size.y));
+ controlsCoolItem.setMinimumSize(size);
+ }
+
+ private void createScriptTableSection(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ scriptTable = new ScriptTableViewer(composite, this.getTestManager());
+ // scriptTable.addDisposeListener(new DisposeListener() {
+ // public void widgetDisposed(DisposeEvent e) {
+ // testManagerEditor.storeValue(testManagerEditor.scriptsQualName, scriptTable.getStorageString());
+ // }
+ // });
+
+ }
+
+ private void createStatusWindow(Composite parent) {
+ statusWindow = new StatusWindowWidget(parent);
+
+ statusWindow.setLabelAndValue(UpdateableLabel.HOSTLABEL.name(), "Selected Host", NOT_CONNECTED, SWT.BOLD,
+ SWT.COLOR_DARK_RED);
+
+ String selectedFile = testManagerEditor.loadValue(testManagerEditor.configFileName);
+ if (selectedFile == null || selectedFile.equals("")) {
+ selectedFile = testManagerEditor.getDefaultConfigPath();
+ testManagerEditor.storeValue(testManagerEditor.configFileName, selectedFile);
+ }
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, "The default config is: " + selectedFile);
+
+ statusWindow.setLabelAndValue(UpdateableLabel.CONFIGPATHLABEL.name(), "Config File Path", selectedFile);
+
+ saveWidget.setStatusLabel(statusWindow);
+ loadWidget.setStatusLabel(statusWindow);
+
+ // // Status ICON Labels
+ // connectStatusIconLabel = new
+ // Label(statusWindow.getStatusIconComposite(), SWT.NONE);
+ // hostWidget.setConnectStatusLabel(connectStatusIconLabel);
+ // connectStatusIconLabel.setVisible(false);
+
+ statusWindow.refresh();
+ }
+
+ // TODO this stuff needs some updating too...
+ protected void handleAbortButton() {
+ TestManagerPlugin.getInstance().getOteConsoleService().write("Aborting Test Script...");
+ try {
+ getScriptManager().abortScript(false);
+ } catch (RemoteException e) {
+ TestManagerPlugin.getInstance().getOteConsoleService().writeError(Lib.exceptionToString(e));
+ }
+ }
+
+ // TODO this stuff needs some updating too...
+ protected void handleBatchAbortButton() {
+ TestManagerPlugin.getInstance().getOteConsoleService().write("Aborting Test Script Batch...");
+ try {
+ getScriptManager().abortScript(true);
+ } catch (RemoteException e) {
+ TestManagerPlugin.getInstance().getOteConsoleService().writeError(Lib.exceptionToString(e));
+ }
+ }
+
+ private void handleDeleteButton() {
+ scriptTable.removeSelectedTasks();
+ }
+
+ private void handleRunButton() {
+ ScriptRunJob runJob = new ScriptRunJob(getTestManager());
+ if (runJob.isRunAllowed()) {
+ runJob.setPriority(Job.LONG);
+ runJob.setUser(true);
+ runJob.schedule();
+ } else {
+ MessageDialog.openError(Displays.getActiveShell(), "Error", "Test Manager Settings Error");
+ }
+ }
+
+ private class EnabledAbortsTimer extends TimerTask {
+
+ @Override
+ public void run() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if (!runButton.isEnabled()) {
+ abortBatchButton.setEnabled(true);
+ abortButton.setEnabled(true);
+ }
+ } catch (Throwable th) {
+
+ }
+ }
+ });
+
+ }
+
+ }
+
+ @Override
+ public boolean areSettingsValidForRun() {
+ return getScriptTableViewer().getRunTasks().size() > 0;
+ }
+
+ @Override
+ public String getErrorMessage() {
+ StringBuilder builder = new StringBuilder();
+ if (getScriptTableViewer().getRunTasks().size() <= 0) {
+ builder.append("Scripts not selected.");
+ }
+ return builder.toString();
+ }
+
+ @Override
+ public boolean onConnection(final ConnectionEvent event) {
+ boolean result = getScriptManager().connect(event);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ runButton.setEnabled(true);
+ abortButton.setEnabled(false);
+ abortBatchButton.setEnabled(false);
+ scriptTable.onConnectionChanged(true);
+ statusWindow.setValue(UpdateableLabel.HOSTLABEL.name(), event.getProperties().getStation(), SWT.BOLD,
+ SWT.COLOR_DARK_GREEN);
+ statusWindow.refresh();
+ }
+
+ });
+ return result;
+ }
+
+ @Override
+ public boolean onDisconnect(ConnectionEvent event) {
+ boolean result = getScriptManager().disconnect(event);
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ runButton.setEnabled(false);
+ abortButton.setEnabled(false);
+ abortBatchButton.setEnabled(false);
+ scriptTable.onConnectionChanged(false);
+ statusWindow.setValue(UpdateableLabel.HOSTLABEL.name(), NOT_CONNECTED, SWT.BOLD, SWT.COLOR_DARK_RED);
+ statusWindow.refresh();
+ }
+ });
+ return result;
+ }
+
+ @Override
+ public boolean onConnectionLost() {
+ boolean result = getScriptManager().onConnectionLost();
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ runButton.setEnabled(false);
+ abortButton.setEnabled(false);
+ abortBatchButton.setEnabled(false);
+ scriptTable.onConnectionChanged(false);
+ statusWindow.setValue(UpdateableLabel.HOSTLABEL.name(), NOT_CONNECTED, SWT.BOLD, SWT.COLOR_DARK_RED);
+ statusWindow.refresh();
+ }
+ });
+ return result;
+ }
+
+ public abstract ScriptManager getScriptManager();
+
+ /**
+ * @param files
+ */
+ public void addFiles(String[] files) {
+ scriptTable.addFiles(files);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/StatusWindowWidget.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/StatusWindowWidget.java
index 7bf6ea2c99..cde33023c5 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/StatusWindowWidget.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/StatusWindowWidget.java
@@ -23,113 +23,113 @@ import org.eclipse.swt.widgets.Composite;
* @author Roberto E. Escobar
*/
public class StatusWindowWidget {
- private final Map<String, Map<EntryAttribute, Object>> labelValueMap;
- private final List<String> keys;
- private final FormattedText statusTextArea;
+ private final Map<String, Map<EntryAttribute, Object>> labelValueMap;
+ private final List<String> keys;
+ private final FormattedText statusTextArea;
- private enum EntryAttribute {
- LABEL,
- VALUE,
- STYLE,
- COLOR;
- }
+ private enum EntryAttribute {
+ LABEL,
+ VALUE,
+ STYLE,
+ COLOR;
+ }
- public StatusWindowWidget(Composite parent) {
- keys = new ArrayList<String>();
- labelValueMap = new HashMap<String, Map<EntryAttribute, Object>>();
- statusTextArea = new FormattedText(parent, SWT.BORDER, SWT.DEFAULT, SWT.DEFAULT, false);
- statusTextArea.setTextAreaBackground(SWT.COLOR_WHITE);
- }
+ public StatusWindowWidget(Composite parent) {
+ keys = new ArrayList<String>();
+ labelValueMap = new HashMap<String, Map<EntryAttribute, Object>>();
+ statusTextArea = new FormattedText(parent, SWT.BORDER, SWT.DEFAULT, SWT.DEFAULT, false);
+ statusTextArea.setTextAreaBackground(SWT.COLOR_WHITE);
+ }
- public void setLabelAndValue(String key, String label, String value, int style, int color) {
- if (!keys.contains(key)) {
- keys.add(key);
- }
- Map<EntryAttribute, Object> entry = new HashMap<EntryAttribute, Object>();
- entry.put(EntryAttribute.LABEL, label);
- entry.put(EntryAttribute.VALUE, value);
- entry.put(EntryAttribute.STYLE, new Integer(style));
- entry.put(EntryAttribute.COLOR, new Integer(color));
+ public void setLabelAndValue(String key, String label, String value, int style, int color) {
+ if (!keys.contains(key)) {
+ keys.add(key);
+ }
+ Map<EntryAttribute, Object> entry = new HashMap<EntryAttribute, Object>();
+ entry.put(EntryAttribute.LABEL, label);
+ entry.put(EntryAttribute.VALUE, value);
+ entry.put(EntryAttribute.STYLE, new Integer(style));
+ entry.put(EntryAttribute.COLOR, new Integer(color));
- labelValueMap.put(key, entry);
- }
+ labelValueMap.put(key, entry);
+ }
- public void setLabelAndValue(String key, String label, String value) {
- setLabelAndValue(key, label, value, SWT.NORMAL, SWT.COLOR_BLACK);
- }
+ public void setLabelAndValue(String key, String label, String value) {
+ setLabelAndValue(key, label, value, SWT.NORMAL, SWT.COLOR_BLACK);
+ }
- public String getValue(String key) {
- Map<EntryAttribute, Object> entry = labelValueMap.get(key);
- EntryAttribute attribute = EntryAttribute.VALUE;
- return ((entry != null && entry.get(attribute) != null) ? (String) entry.get(attribute) : "");
- }
+ public String getValue(String key) {
+ Map<EntryAttribute, Object> entry = labelValueMap.get(key);
+ EntryAttribute attribute = EntryAttribute.VALUE;
+ return entry != null && entry.get(attribute) != null ? (String) entry.get(attribute) : "";
+ }
- public String getLabel(String key) {
- Map<EntryAttribute, Object> entry = labelValueMap.get(key);
- EntryAttribute attribute = EntryAttribute.LABEL;
- return ((entry != null && entry.get(attribute) != null) ? (String) entry.get(attribute) : "");
- }
+ public String getLabel(String key) {
+ Map<EntryAttribute, Object> entry = labelValueMap.get(key);
+ EntryAttribute attribute = EntryAttribute.LABEL;
+ return entry != null && entry.get(attribute) != null ? (String) entry.get(attribute) : "";
+ }
- public void setLabel(String key, String label) {
- Map<EntryAttribute, Object> entry = labelValueMap.get(key);
- if (entry != null) {
- entry.put(EntryAttribute.LABEL, label);
- } else {
- setLabelAndValue(key, label, "");
- }
- }
+ public void setLabel(String key, String label) {
+ Map<EntryAttribute, Object> entry = labelValueMap.get(key);
+ if (entry != null) {
+ entry.put(EntryAttribute.LABEL, label);
+ } else {
+ setLabelAndValue(key, label, "");
+ }
+ }
- public void setValueStyle(String key, int style) {
- Map<EntryAttribute, Object> entry = labelValueMap.get(key);
- if (entry != null) {
- entry.put(EntryAttribute.STYLE, new Integer(style));
- }
- }
+ public void setValueStyle(String key, int style) {
+ Map<EntryAttribute, Object> entry = labelValueMap.get(key);
+ if (entry != null) {
+ entry.put(EntryAttribute.STYLE, new Integer(style));
+ }
+ }
- public void setValueColor(String key, int color) {
- Map<EntryAttribute, Object> entry = labelValueMap.get(key);
- if (entry != null) {
- entry.put(EntryAttribute.STYLE, new Integer(color));
- }
- }
+ public void setValueColor(String key, int color) {
+ Map<EntryAttribute, Object> entry = labelValueMap.get(key);
+ if (entry != null) {
+ entry.put(EntryAttribute.STYLE, new Integer(color));
+ }
+ }
- public void setValue(String key, String value, int style, int color) {
- Map<EntryAttribute, Object> entry = labelValueMap.get(key);
- if (entry != null) {
- entry.put(EntryAttribute.VALUE, value);
- entry.put(EntryAttribute.STYLE, new Integer(style));
- entry.put(EntryAttribute.COLOR, new Integer(color));
- } else {
- setLabelAndValue(key, "", value, style, color);
- }
- }
+ public void setValue(String key, String value, int style, int color) {
+ Map<EntryAttribute, Object> entry = labelValueMap.get(key);
+ if (entry != null) {
+ entry.put(EntryAttribute.VALUE, value);
+ entry.put(EntryAttribute.STYLE, new Integer(style));
+ entry.put(EntryAttribute.COLOR, new Integer(color));
+ } else {
+ setLabelAndValue(key, "", value, style, color);
+ }
+ }
- public void setValue(String key, String value) {
- Map<EntryAttribute, Object> entry = labelValueMap.get(key);
- if (entry != null) {
- entry.put(EntryAttribute.VALUE, value);
- } else {
- setLabelAndValue(key, "", value);
- }
- }
+ public void setValue(String key, String value) {
+ Map<EntryAttribute, Object> entry = labelValueMap.get(key);
+ if (entry != null) {
+ entry.put(EntryAttribute.VALUE, value);
+ } else {
+ setLabelAndValue(key, "", value);
+ }
+ }
- public void refresh() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- statusTextArea.clearTextArea();
- for (String key : keys) {
- Map<EntryAttribute, Object> entry = labelValueMap.get(key);
- if (entry != null) {
- String label = (String) entry.get(EntryAttribute.LABEL);
- String value = (String) entry.get(EntryAttribute.VALUE);
- Integer style = (Integer) entry.get(EntryAttribute.STYLE);
- Integer color = (Integer) entry.get(EntryAttribute.COLOR);
- statusTextArea.addText("\t" + label + ": ", SWT.BOLD, SWT.COLOR_DARK_BLUE);
- statusTextArea.addText(value + "\n", style, color);
- }
- }
- }
- });
- }
+ public void refresh() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ statusTextArea.clearTextArea();
+ for (String key : keys) {
+ Map<EntryAttribute, Object> entry = labelValueMap.get(key);
+ if (entry != null) {
+ String label = (String) entry.get(EntryAttribute.LABEL);
+ String value = (String) entry.get(EntryAttribute.VALUE);
+ Integer style = (Integer) entry.get(EntryAttribute.STYLE);
+ Integer color = (Integer) entry.get(EntryAttribute.COLOR);
+ statusTextArea.addText("\t" + label + ": ", SWT.BOLD, SWT.COLOR_DARK_BLUE);
+ statusTextArea.addText(value + "\n", style, color);
+ }
+ }
+ }
+ });
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/contributions/ScriptExecutionContribution.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/contributions/ScriptExecutionContribution.java
index 343bca532c..10560265d5 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/contributions/ScriptExecutionContribution.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/contributions/ScriptExecutionContribution.java
@@ -30,13 +30,14 @@ public class ScriptExecutionContribution implements IPropertyStoreBasedControl {
private static final String LOGGING_GROUP = "Select a logging level";
private static final String EXECUTION_OPTIONS_GROUP = "Execution Options";
private static final String SCRIPT_OUTPUT_TOOLTIP =
- "If the path in the text box is an existing directory all files will be written there.\n" + "If the path is empty the files will be written to the same location as the script.\n" + "In all other cases the path will be relative to the parent project of the file.\n";
+ "If the path in the text box is an existing directory all files will be written there.\n" + "If the path is empty the files will be written to the same location as the script.\n" + "In all other cases the path will be relative to the parent project of the file.\n";
private static final String SCRIPT_OUTPUT_LABEL = "Script Output Directory: ";
private FileOrDirectorySelectionPanel scriptDirectoryPanel;
private LoggingPanel loggingPanel;
private ScriptExecutionOptionsPanel optionsPanel;
+ @Override
public Control createControl(Composite parent) {
Group group = new Group(parent, SWT.NONE);
group.setLayout(new GridLayout());
@@ -44,7 +45,7 @@ public class ScriptExecutionContribution implements IPropertyStoreBasedControl {
group.setText(GROUP_TITLE);
this.scriptDirectoryPanel =
- new FileOrDirectorySelectionPanel(group, SWT.NONE, SCRIPT_OUTPUT_LABEL, SCRIPT_OUTPUT_TOOLTIP, true);
+ new FileOrDirectorySelectionPanel(group, SWT.NONE, SCRIPT_OUTPUT_LABEL, SCRIPT_OUTPUT_TOOLTIP, true);
Composite composite = new Composite(group, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
@@ -69,6 +70,7 @@ public class ScriptExecutionContribution implements IPropertyStoreBasedControl {
return group;
}
+ @Override
public void load(IPropertyStore propertyStore) {
this.scriptDirectoryPanel.setSelected(propertyStore.get(TestManagerStorageKeys.SCRIPT_OUTPUT_DIRECTORY_KEY));
@@ -78,13 +80,14 @@ public class ScriptExecutionContribution implements IPropertyStoreBasedControl {
this.loggingPanel.setSelected(propertyStore.get(TestManagerStorageKeys.LOGGING_LEVEL_KEY));
}
+ @Override
public void save(IPropertyStore propertyStore) {
propertyStore.put(TestManagerStorageKeys.SCRIPT_OUTPUT_DIRECTORY_KEY, this.scriptDirectoryPanel.getSelected());
propertyStore.put(TestManagerStorageKeys.LOGGING_LEVEL_KEY, this.loggingPanel.getSelected());
propertyStore.put(TestManagerStorageKeys.KEEP_OLD_OUTFILE_COPIES_ENABLED_KEY,
- this.optionsPanel.isKeepOldCopiesEnabled());
+ this.optionsPanel.isKeepOldCopiesEnabled());
propertyStore.put(TestManagerStorageKeys.BATCH_MODE_ENABLED_KEY, this.optionsPanel.isBatchModeEnabled());
}
@@ -103,6 +106,7 @@ public class ScriptExecutionContribution implements IPropertyStoreBasedControl {
return builder.toString();
}
+ @Override
public int getPriority() {
return 0;
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java
index deeceab4e3..34775a16ac 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java
@@ -27,6 +27,7 @@ import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.nebula.widgets.xviewer.XViewer;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.util.OseeData;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActivator;
import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.ote.ui.markers.MarkerPlugin;
@@ -136,12 +137,12 @@ public class ScriptTableViewer {
File file = OseeData.getFile("tm.xml");
String configFile = testManagerEditor.loadValue(testManagerEditor.configFileName);
ISaveConfig saveConfig =
- ConfigFactory.getInstance().getSaveConfigHandler(testManagerEditor.getPageManager().getScriptPage());
+ ConfigFactory.getInstance().getSaveConfigHandler(testManagerEditor.getPageManager().getScriptPage());
try {
saveConfig.saveConfig(file);
} catch (Exception ex) {
- Dialogs.popupError("Error Loading File", String.format("Error loading file: [%s]\n%s", configFile,
- TestManagerPlugin.getStackMessages(ex)));
+ Dialogs.popupError("Error Loading File",
+ String.format("Error loading file: [%s]\n%s", configFile, OseeUiActivator.getStackMessages(ex)));
}
return "file:";
@@ -176,13 +177,12 @@ public class ScriptTableViewer {
if (str.equals("file:")) {
File configFile = OseeData.getFile("tm.xml");
ILoadConfig loadConfig =
- ConfigFactory.getInstance().getLoadConfigHandler(
- this.testManagerEditor.getPageManager().getScriptPage());
+ ConfigFactory.getInstance().getLoadConfigHandler(this.testManagerEditor.getPageManager().getScriptPage());
try {
loadConfig.loadConfiguration(configFile);
} catch (Exception ex) {
- Dialogs.popupError("Error Saving File", String.format("Error saving file: [%s]\n%s", configFile,
- TestManagerPlugin.getStackMessages(ex)));
+ Dialogs.popupError("Error Saving File",
+ String.format("Error saving file: [%s]\n%s", configFile, OseeUiActivator.getStackMessages(ex)));
}
} else {
String scripts[] = str.split(",");
@@ -199,8 +199,8 @@ public class ScriptTableViewer {
task.setRun(run);
taskList.addTask(task);
} catch (Exception ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, String.format(
- "Unable to add file [%s] to script view.", script), ex);
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE,
+ String.format("Unable to add file [%s] to script view.", script), ex);
}
}
}
@@ -267,6 +267,7 @@ public class ScriptTableViewer {
attachDragDropListener();
attachKeyListeners();
scriptTable.getMenuManager().addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager manager) {
getPopupMenu();
}
@@ -321,49 +322,49 @@ public class ScriptTableViewer {
}
});
menuManager.insertBefore(XViewer.MENU_GROUP_PRE, new Separator());
- menuManager.insertBefore(XViewer.MENU_GROUP_PRE, new Action("Set Selected to Run",
- ImageManager.getImageDescriptor(PluginUiImage.CHECKBOX_ENABLED)) {
- @Override
- public void run() {
- IStructuredSelection sel = (IStructuredSelection) getSelection();
- Iterator<?> iter = sel.iterator();
- while (iter.hasNext()) {
- ScriptTask task = (ScriptTask) iter.next();
- task.setRun(true);
- taskList.taskChanged(task);
+ menuManager.insertBefore(XViewer.MENU_GROUP_PRE,
+ new Action("Set Selected to Run", ImageManager.getImageDescriptor(PluginUiImage.CHECKBOX_ENABLED)) {
+ @Override
+ public void run() {
+ IStructuredSelection sel = (IStructuredSelection) getSelection();
+ Iterator<?> iter = sel.iterator();
+ while (iter.hasNext()) {
+ ScriptTask task = (ScriptTask) iter.next();
+ task.setRun(true);
+ taskList.taskChanged(task);
+ }
+ refresh();
}
- refresh();
- }
- });
- menuManager.insertBefore(XViewer.MENU_GROUP_PRE, new Action("Set Selected to Not Run",
- ImageManager.getImageDescriptor(PluginUiImage.CHECKBOX_DISABLED)) {
- @Override
- public void run() {
- IStructuredSelection sel = (IStructuredSelection) getSelection();
- Iterator<?> iter = sel.iterator();
- while (iter.hasNext()) {
- ScriptTask task = (ScriptTask) iter.next();
- task.setRun(false);
- taskList.taskChanged(task);
+ });
+ menuManager.insertBefore(XViewer.MENU_GROUP_PRE,
+ new Action("Set Selected to Not Run", ImageManager.getImageDescriptor(PluginUiImage.CHECKBOX_DISABLED)) {
+ @Override
+ public void run() {
+ IStructuredSelection sel = (IStructuredSelection) getSelection();
+ Iterator<?> iter = sel.iterator();
+ while (iter.hasNext()) {
+ ScriptTask task = (ScriptTask) iter.next();
+ task.setRun(false);
+ taskList.taskChanged(task);
+ }
+ refresh();
}
- refresh();
- }
- });
+ });
menuManager.insertBefore(XViewer.MENU_GROUP_PRE, new Separator());
- menuManager.insertBefore(XViewer.MENU_GROUP_PRE, new Action("Select All to Run",
- ImageManager.getImageDescriptor(PluginUiImage.CHECKBOX_ENABLED)) {
- @Override
- public void run() {
- setAllTasksRun(true);
- }
- });
- menuManager.insertBefore(XViewer.MENU_GROUP_PRE, new Action("Deselect All to Run",
- ImageManager.getImageDescriptor(PluginUiImage.CHECKBOX_DISABLED)) {
- @Override
- public void run() {
- setAllTasksRun(false);
- }
- });
+ menuManager.insertBefore(XViewer.MENU_GROUP_PRE,
+ new Action("Select All to Run", ImageManager.getImageDescriptor(PluginUiImage.CHECKBOX_ENABLED)) {
+ @Override
+ public void run() {
+ setAllTasksRun(true);
+ }
+ });
+ menuManager.insertBefore(XViewer.MENU_GROUP_PRE,
+ new Action("Deselect All to Run", ImageManager.getImageDescriptor(PluginUiImage.CHECKBOX_DISABLED)) {
+ @Override
+ public void run() {
+ setAllTasksRun(false);
+ }
+ });
menuManager.insertBefore(XViewer.MENU_GROUP_PRE, new Separator());
// item = new MenuItem(previewMenu, SWT.CASCADE);
@@ -438,7 +439,7 @@ public class ScriptTableViewer {
batchDropHandler(new File(toProcess));
} else {
if (toProcess.endsWith(".java") || toProcess.endsWith(".vxe") || !new File(toProcess).getName().matches(
- ".*\\..*")) {
+ ".*\\..*")) {
ScriptTask newTask = new ScriptTask(files[i], testManagerEditor.getAlternateOutputDir());
if (!taskList.contains(newTask)) {
// newTask.computeExists();
@@ -463,11 +464,11 @@ public class ScriptTableViewer {
private void batchDropHandler(File batchFile) {
try {
ILoadConfig loadConfig =
- ConfigFactory.getInstance().getLoadConfigHandler(testManagerEditor.getPageManager().getScriptPage());
+ ConfigFactory.getInstance().getLoadConfigHandler(testManagerEditor.getPageManager().getScriptPage());
loadConfig.loadConfiguration(batchFile);
} catch (Exception ex) {
Dialogs.popupError("Invalid Drop", String.format("Unable to read batch file\nFile [%s]\n%s",
- (batchFile != null ? batchFile.getAbsolutePath() : "NULL"), TestManagerPlugin.getStackMessages(ex)));
+ (batchFile != null ? batchFile.getAbsolutePath() : "NULL"), OseeUiActivator.getStackMessages(ex)));
}
}
@@ -480,9 +481,11 @@ public class ScriptTableViewer {
private void attachKeyListeners() {
scriptTable.getTree().addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent e) {
}
+ @Override
public void keyReleased(KeyEvent e) {
// If they press enter, do the same as a double click
if (e.character == SWT.DEL) {
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTask.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTask.java
index d71838cd35..7cfb51a2d3 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTask.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTask.java
@@ -18,7 +18,15 @@ import org.eclipse.osee.ote.ui.test.manager.models.ScriptModel.ScriptInteraction
public class ScriptTask {
public enum ScriptStatusEnum {
- CANCELLED, CANCELLING, COMPLETE, IN_QUEUE, INCOMPATIBLE, INVALID, NOT_CONNECTED, READY, RUNNING
+ CANCELLED,
+ CANCELLING,
+ COMPLETE,
+ IN_QUEUE,
+ INCOMPATIBLE,
+ INVALID,
+ NOT_CONNECTED,
+ READY,
+ RUNNING
}
private GUID guid = null;
@@ -72,11 +80,11 @@ public class ScriptTask {
if (scriptModel.getOutputModel().isAborted()) {
return "ABORTED";
} else if (passTP > 0 || failTP > 0) {
- if (failTP == 0) {
- return "PASS (" + passTP + ")";
- } else {
- return "FAIL (" + failTP + "/" + (passTP + failTP) + ")";
- }
+ if (failTP == 0) {
+ return "PASS (" + passTP + ")";
+ } else {
+ return "FAIL (" + failTP + "/" + (passTP + failTP) + ")";
+ }
} else if (status == ScriptStatusEnum.RUNNING) {
return "(0/0)";
}
@@ -103,9 +111,9 @@ public class ScriptTask {
public ScriptStatusEnum getStatus() {
return status;
}
-
+
public Boolean getRunStatus() {
- return run;
+ return run;
}
/**
@@ -116,9 +124,9 @@ public class ScriptTask {
}
-// public void computeExists() {
-// exists = scriptModel.getOutputModel().exists();
-// }
+ // public void computeExists() {
+ // exists = scriptModel.getOutputModel().exists();
+ // }
// public boolean isOutputReadonly() {
// return !scriptModel.getOutputModel().getFile().canWrite();
@@ -132,7 +140,7 @@ public class ScriptTask {
}
public boolean isRunnable() {
- return (isRun());// && status != ScriptStatusEnum.INCOMPATIBLE
+ return isRun();// && status != ScriptStatusEnum.INCOMPATIBLE
// && status != ScriptStatusEnum.INVALID);
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTaskList.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTaskList.java
index 80f4546a4b..bc7d7c493f 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTaskList.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTaskList.java
@@ -18,8 +18,8 @@ import java.util.Vector;
public class ScriptTaskList {
- private Set<ITaskListViewer> changeListeners = new HashSet<ITaskListViewer>();
- private Vector<ScriptTask> tasks = new Vector<ScriptTask>();
+ private final Set<ITaskListViewer> changeListeners = new HashSet<ITaskListViewer>();
+ private final Vector<ScriptTask> tasks = new Vector<ScriptTask>();
private boolean isConnected = false;
/**
@@ -43,8 +43,9 @@ public class ScriptTaskList {
inTask.updateStatusOnConnected(this.isConnected);
tasks.add(tasks.size(), inTask);
Iterator<ITaskListViewer> iterator = changeListeners.iterator();
- while (iterator.hasNext())
- (iterator.next()).addTask(inTask);
+ while (iterator.hasNext()) {
+ iterator.next().addTask(inTask);
+ }
}
public void addTasks(List<ScriptTask> inTasks) {
@@ -54,8 +55,9 @@ public class ScriptTaskList {
ScriptTask[] array = new ScriptTask[inTasks.size()];
this.tasks.addAll(inTasks);
Iterator<ITaskListViewer> iterator = changeListeners.iterator();
- while (iterator.hasNext())
- (iterator.next()).addTasks(this.tasks.toArray(array));
+ while (iterator.hasNext()) {
+ iterator.next().addTasks(this.tasks.toArray(array));
+ }
}
/**
@@ -94,8 +96,9 @@ public class ScriptTaskList {
public void removeTask(ScriptTask task) {
tasks.remove(task);
Iterator<ITaskListViewer> iterator = changeListeners.iterator();
- while (iterator.hasNext())
- (iterator.next()).removeTask(task);
+ while (iterator.hasNext()) {
+ iterator.next().removeTask(task);
+ }
}
/**
@@ -103,14 +106,16 @@ public class ScriptTaskList {
*/
public void taskChanged(ScriptTask task) {
Iterator<ITaskListViewer> iterator = changeListeners.iterator();
- while (iterator.hasNext())
- (iterator.next()).updateTask(task);
+ while (iterator.hasNext()) {
+ iterator.next().updateTask(task);
+ }
}
+ @Override
public String toString() {
String str = "";
for (int i = 0; i < tasks.size(); i++) {
- ScriptTask task = (ScriptTask) tasks.get(i);
+ ScriptTask task = tasks.get(i);
str += "\nTask " + task.getName() + " Status: " + task.getStatus();
}
return str + "\n\n";
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTable.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTable.java
index e04981a1e1..cbc81f1921 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTable.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTable.java
@@ -57,7 +57,7 @@ public class XScriptTable extends XViewer {
}
return super.handleLeftClick(treeColumn, treeItem);
}
-
+
@Override
public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
XViewerColumn aCol = (XViewerColumn) treeColumn.getData();
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableContentProvider.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableContentProvider.java
index cad755e7c3..91c7bffb33 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableContentProvider.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableContentProvider.java
@@ -53,8 +53,8 @@ public class XScriptTableContentProvider implements IStructuredContentProvider,
@Override
public Object[] getChildren(Object parentElement) {
- if(parentElement instanceof ScriptTaskList){
- return ((ScriptTaskList)parentElement).getTasks().toArray();
+ if (parentElement instanceof ScriptTaskList) {
+ return ((ScriptTaskList) parentElement).getTasks().toArray();
}
return null;
}
@@ -67,7 +67,9 @@ public class XScriptTableContentProvider implements IStructuredContentProvider,
@Override
public boolean hasChildren(Object element) {
Object[] children = getChildren(element);
- if(children != null && children.length > 0) return true;
+ if (children != null && children.length > 0) {
+ return true;
+ }
return false;
}
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableFactory.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableFactory.java
index ef16ccd3ac..477a086f74 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableFactory.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/xscript/XScriptTableFactory.java
@@ -27,27 +27,23 @@ import org.eclipse.swt.SWT;
*/
public class XScriptTableFactory extends XViewerFactory {
private static String COLUMN_NAMESPACE = "xviewer.script.table";
- public static XViewerColumn RUN =
- new XViewerColumn(COLUMN_NAMESPACE + ".run", "Run", 42, SWT.LEFT, true, SortDataType.Boolean, false, null);
- public static XViewerColumn TEST =
- new XViewerColumn(COLUMN_NAMESPACE + ".test", "Test", 275, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn STATUS =
- new XViewerColumn(COLUMN_NAMESPACE + ".status", "Status", 125, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn RESULT =
- new XViewerColumn(COLUMN_NAMESPACE + ".result", "Result", 125, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn OUPUT_FILE =
- new XViewerColumn(COLUMN_NAMESPACE + ".outfile", "Output File", 70, SWT.LEFT, true, SortDataType.String,
- false, null);
- public static XViewerColumn TEST_LOCATION =
- new XViewerColumn(COLUMN_NAMESPACE + ".testlocation", "Test Location", 160, SWT.LEFT, true,
- SortDataType.String, false, null);
+ public static XViewerColumn RUN = new XViewerColumn(COLUMN_NAMESPACE + ".run", "Run", 42, SWT.LEFT, true,
+ SortDataType.Boolean, false, null);
+ public static XViewerColumn TEST = new XViewerColumn(COLUMN_NAMESPACE + ".test", "Test", 275, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn STATUS = new XViewerColumn(COLUMN_NAMESPACE + ".status", "Status", 125, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn RESULT = new XViewerColumn(COLUMN_NAMESPACE + ".result", "Result", 125, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn OUPUT_FILE = new XViewerColumn(COLUMN_NAMESPACE + ".outfile", "Output File", 70,
+ SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn TEST_LOCATION = new XViewerColumn(COLUMN_NAMESPACE + ".testlocation", "Test Location",
+ 160, SWT.LEFT, true, SortDataType.String, false, null);
private final FileStoreCustomizations propertyStoreCustomizations;
private static final String defaultCustomDataXml =
- "<XTreeProperties name=\"default\" namespace=\"xviewer.script.table\" guid=\"710h7sah9dtt01464nvkkv\"><xSorter><id>xviewer.script.table.test</id></xSorter><xSorter><id>xviewer.script.table.test</id></xSorter><xFilter></xFilter><xCol><id>xviewer.script.table.run</id><name>Run</name><wdth>42</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.test</id><name>Test</name><wdth>351</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.result</id><name>Result</name><wdth>110</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.status</id><name>Status</name><wdth>125</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.outfile</id><name>Output File</name><wdth>75</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.testlocation</id><name>Test Location</name><wdth>160</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol></XTreeProperties>";
+ "<XTreeProperties name=\"default\" namespace=\"xviewer.script.table\" guid=\"710h7sah9dtt01464nvkkv\"><xSorter><id>xviewer.script.table.test</id></xSorter><xSorter><id>xviewer.script.table.test</id></xSorter><xFilter></xFilter><xCol><id>xviewer.script.table.run</id><name>Run</name><wdth>42</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.test</id><name>Test</name><wdth>351</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.result</id><name>Result</name><wdth>110</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.status</id><name>Status</name><wdth>125</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.outfile</id><name>Output File</name><wdth>75</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol><xCol><id>xviewer.script.table.testlocation</id><name>Test Location</name><wdth>160</wdth><algn>left</algn><srtFwd>true</srtFwd><show>true</show></xCol></XTreeProperties>";
public XScriptTableFactory() {
super(COLUMN_NAMESPACE);
@@ -59,7 +55,7 @@ public class XScriptTableFactory extends XViewerFactory {
folder = new File(System.getProperty("java.io.tmpdir"));
}
propertyStoreCustomizations =
- new FileStoreCustomizations(folder, "OteScript", ".xml", "DefaultOteScript.xml", defaultCustomDataXml);
+ new FileStoreCustomizations(folder, "OteScript", ".xml", "DefaultOteScript.xml", defaultCustomDataXml);
registerColumns(RUN, TEST, RESULT, STATUS, OUPUT_FILE, TEST_LOCATION);
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/panels/LoggingPanel.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/panels/LoggingPanel.java
index 3a9641b72f..e53fedc837 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/panels/LoggingPanel.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/panels/LoggingPanel.java
@@ -122,8 +122,8 @@ public class LoggingPanel extends Composite {
try {
level = Level.parse(value);
} catch (Exception ex) {
- OseeLog.log(TestManagerPlugin.class, Level.WARNING, String.format(
- "Error parsing log level [%s] using default [%s]", value, level));
+ OseeLog.log(TestManagerPlugin.class, Level.WARNING,
+ String.format("Error parsing log level [%s] using default [%s]", value, level));
}
LoggingLevel loggingLevel = LoggingLevel.fromLevel(level);
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/TestManagerPreferencePage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/TestManagerPreferencePage.java
index 2d5fcadb1e..06e2e7b0d5 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/TestManagerPreferencePage.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/TestManagerPreferencePage.java
@@ -31,11 +31,13 @@ public class TestManagerPreferencePage extends PreferencePage implements IWorkbe
public static final String TEST_MANAGER_KEY = "org.eclipse.osee.ote.ui.test.manager.PreferencePage";
private EnvironmentPreferencePage environmentPreferencePage;
+ @Override
public void init(IWorkbench workbench) {
// Initialize the preference store we wish to use
setPreferenceStore(TestManagerPlugin.getInstance().getPreferenceStore());
}
+ @Override
public boolean performOk() {
environmentPreferencePage.storeVariables();
@@ -72,9 +74,10 @@ public class TestManagerPreferencePage extends PreferencePage implements IWorkbe
}
private void createPageDescription(Composite parent) {
- (new Label(parent, SWT.NONE)).setText("Test Manager Settings:");
+ new Label(parent, SWT.NONE).setText("Test Manager Settings:");
}
+ @Override
protected Control createContents(Composite parent) {
createPageDescription(parent);
@@ -85,10 +88,12 @@ public class TestManagerPreferencePage extends PreferencePage implements IWorkbe
return parent;
}
+ @Override
protected void performApply() {
performOk();
}
+ @Override
protected void performDefaults() {
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageDataViewer.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageDataViewer.java
index f177d534e3..955dc6a172 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageDataViewer.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageDataViewer.java
@@ -26,111 +26,111 @@ import org.eclipse.swt.widgets.Group;
*/
public class EnvironmentPageDataViewer {
- private Group environmentVariable;
- private EnvironmentPreferenceNode nodeToDisplay;
- private final ArrayList<StyleRange> styleArray;
- private StyledText textArea;
-
- public EnvironmentPageDataViewer(Composite parent) {
- createArea(parent);
- styleArray = new ArrayList<StyleRange>();
- }
-
- public void clearTextArea() {
- textArea.setText("");
- styleArray.clear();
- textArea.redraw();
- }
-
- public void setNodeToDisplay(EnvironmentPreferenceNode nodeToDisplay) {
- this.nodeToDisplay = nodeToDisplay;
- update();
- }
-
- public void setTitleName(String name) {
- environmentVariable.setText("Preview Environment Variable: " + name);
- environmentVariable.redraw();
- }
-
- public void update() {
- clearTextArea();
- if (nodeToDisplay != null) {
- setTitleName(nodeToDisplay.getEnvName());
- addEntry(nodeToDisplay.getEnvName(), nodeToDisplay.getValue());
- } else {
- setTitleName("NONE SELECTED");
- }
- }
-
- private void addEntry(String name, String value) {
- addEntryName(name);
- addEntryValue(value);
- }
-
- private void addEntryName(String name) {
- if (name != null) {
- String temp = textArea.getText();
- temp += "\n\t";
- int startIndex = temp.length();
- temp += name;
- textArea.setText(temp);
- StyleRange tempStyle = new StyleRange();
- styleArray.add(tempStyle);
- tempStyle.fontStyle = SWT.BOLD;
- tempStyle.start = startIndex;
- tempStyle.length = name.length();
- tempStyle.underline = true;
- tempStyle.foreground = Displays.getSystemColor(SWT.COLOR_DARK_BLUE);
- textArea.setStyleRanges(styleArray.toArray(new StyleRange[styleArray.size()]));
- textArea.redraw();
- }
- }
-
- private void addEntryValue(String value) {
- if (value != null) {
- String temp = textArea.getText();
- temp += " = ";
- int startIndex = temp.length();
- String toAdd = value.replaceAll(":", ":\n\t\t");
- temp += toAdd;
- textArea.setText(temp + "\n");
- StyleRange tempStyle = new StyleRange();
- styleArray.add(tempStyle);
- tempStyle.fontStyle = SWT.ITALIC;
- tempStyle.start = startIndex;
- tempStyle.length = toAdd.length();
- tempStyle.foreground = Displays.getSystemColor(SWT.COLOR_BLACK);
- textArea.setStyleRanges(styleArray.toArray(new StyleRange[styleArray.size()]));
- textArea.redraw();
- }
- }
-
- private Control createArea(Composite parent) {
- GridData d = new GridData(GridData.FILL_BOTH);
-
- environmentVariable = new Group(parent, SWT.NONE);
- environmentVariable.setText("Preview Environment Variable:");
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- environmentVariable.setLayout(gridLayout);
- environmentVariable.setLayoutData(d);
-
- Composite topLevelComposite = new Composite(environmentVariable, SWT.NONE);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- topLevelComposite.setLayout(gridLayout);
- topLevelComposite.setLayoutData(d);
- topLevelComposite.setToolTipText("Select a Value From the Tree to Display");
-
- textArea = new StyledText(topLevelComposite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- textArea.setEditable(false);
- GridLayout gL = new GridLayout();
- gL.numColumns = 1;
- textArea.setLayout(gL);
- textArea.setLayoutData(d);
- textArea.setBackground(Displays.getSystemColor(SWT.COLOR_WHITE));
- textArea.setToolTipText("Select a Value From the Tree to Display");
-
- return parent;
- }
+ private Group environmentVariable;
+ private EnvironmentPreferenceNode nodeToDisplay;
+ private final ArrayList<StyleRange> styleArray;
+ private StyledText textArea;
+
+ public EnvironmentPageDataViewer(Composite parent) {
+ createArea(parent);
+ styleArray = new ArrayList<StyleRange>();
+ }
+
+ public void clearTextArea() {
+ textArea.setText("");
+ styleArray.clear();
+ textArea.redraw();
+ }
+
+ public void setNodeToDisplay(EnvironmentPreferenceNode nodeToDisplay) {
+ this.nodeToDisplay = nodeToDisplay;
+ update();
+ }
+
+ public void setTitleName(String name) {
+ environmentVariable.setText("Preview Environment Variable: " + name);
+ environmentVariable.redraw();
+ }
+
+ public void update() {
+ clearTextArea();
+ if (nodeToDisplay != null) {
+ setTitleName(nodeToDisplay.getEnvName());
+ addEntry(nodeToDisplay.getEnvName(), nodeToDisplay.getValue());
+ } else {
+ setTitleName("NONE SELECTED");
+ }
+ }
+
+ private void addEntry(String name, String value) {
+ addEntryName(name);
+ addEntryValue(value);
+ }
+
+ private void addEntryName(String name) {
+ if (name != null) {
+ String temp = textArea.getText();
+ temp += "\n\t";
+ int startIndex = temp.length();
+ temp += name;
+ textArea.setText(temp);
+ StyleRange tempStyle = new StyleRange();
+ styleArray.add(tempStyle);
+ tempStyle.fontStyle = SWT.BOLD;
+ tempStyle.start = startIndex;
+ tempStyle.length = name.length();
+ tempStyle.underline = true;
+ tempStyle.foreground = Displays.getSystemColor(SWT.COLOR_DARK_BLUE);
+ textArea.setStyleRanges(styleArray.toArray(new StyleRange[styleArray.size()]));
+ textArea.redraw();
+ }
+ }
+
+ private void addEntryValue(String value) {
+ if (value != null) {
+ String temp = textArea.getText();
+ temp += " = ";
+ int startIndex = temp.length();
+ String toAdd = value.replaceAll(":", ":\n\t\t");
+ temp += toAdd;
+ textArea.setText(temp + "\n");
+ StyleRange tempStyle = new StyleRange();
+ styleArray.add(tempStyle);
+ tempStyle.fontStyle = SWT.ITALIC;
+ tempStyle.start = startIndex;
+ tempStyle.length = toAdd.length();
+ tempStyle.foreground = Displays.getSystemColor(SWT.COLOR_BLACK);
+ textArea.setStyleRanges(styleArray.toArray(new StyleRange[styleArray.size()]));
+ textArea.redraw();
+ }
+ }
+
+ private Control createArea(Composite parent) {
+ GridData d = new GridData(GridData.FILL_BOTH);
+
+ environmentVariable = new Group(parent, SWT.NONE);
+ environmentVariable.setText("Preview Environment Variable:");
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+ environmentVariable.setLayout(gridLayout);
+ environmentVariable.setLayoutData(d);
+
+ Composite topLevelComposite = new Composite(environmentVariable, SWT.NONE);
+ gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+ topLevelComposite.setLayout(gridLayout);
+ topLevelComposite.setLayoutData(d);
+ topLevelComposite.setToolTipText("Select a Value From the Tree to Display");
+
+ textArea = new StyledText(topLevelComposite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ textArea.setEditable(false);
+ GridLayout gL = new GridLayout();
+ gL.numColumns = 1;
+ textArea.setLayout(gL);
+ textArea.setLayoutData(d);
+ textArea.setBackground(Displays.getSystemColor(SWT.COLOR_WHITE));
+ textArea.setToolTipText("Select a Value From the Tree to Display");
+
+ return parent;
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageEventHandler.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageEventHandler.java
index e2687135ea..8544f9eafd 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageEventHandler.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageEventHandler.java
@@ -30,95 +30,95 @@ import org.eclipse.swt.widgets.Composite;
*/
public class EnvironmentPageEventHandler {
- private EnvironmentPreferenceNode currentSelection;
- private final EnvironmentPageDataViewer environmentPageDataViewer;
- private final ArrayList<EnvironmentPreferenceNode> treeInputList;
- private final CheckboxTreeViewer treeViewer;
+ private EnvironmentPreferenceNode currentSelection;
+ private final EnvironmentPageDataViewer environmentPageDataViewer;
+ private final ArrayList<EnvironmentPreferenceNode> treeInputList;
+ private final CheckboxTreeViewer treeViewer;
- public EnvironmentPageEventHandler(Composite parent, CheckboxTreeViewer treeViewer, ArrayList<EnvironmentPreferenceNode> treeInputList) {
- this.treeViewer = treeViewer;
- this.treeInputList = treeInputList;
- this.environmentPageDataViewer = new EnvironmentPageDataViewer(parent);
- }
+ public EnvironmentPageEventHandler(Composite parent, CheckboxTreeViewer treeViewer, ArrayList<EnvironmentPreferenceNode> treeInputList) {
+ this.treeViewer = treeViewer;
+ this.treeInputList = treeInputList;
+ this.environmentPageDataViewer = new EnvironmentPageDataViewer(parent);
+ }
- public void editEnvVariable(EnvironmentPreferenceNode node) {
- EnvVariableDetailsDialogHelper selection = new EnvVariableDetailsDialogHelper(node.getEnvName(), node.getValue());
- Displays.pendInDisplayThread(selection);
- if (selection.getResult() != Window.CANCEL) {
- node.setValue(selection.getSelection());
- environmentPageDataViewer.update();
- }
- }
+ public void editEnvVariable(EnvironmentPreferenceNode node) {
+ EnvVariableDetailsDialogHelper selection = new EnvVariableDetailsDialogHelper(node.getEnvName(), node.getValue());
+ Displays.pendInDisplayThread(selection);
+ if (selection.getResult() != Window.CANCEL) {
+ node.setValue(selection.getSelection());
+ environmentPageDataViewer.update();
+ }
+ }
- public void handleAddEnvironmentVariableEvent() {
- EnvVariableDialogHelper selection = new EnvVariableDialogHelper();
- Displays.pendInDisplayThread(selection);
- if (selection.getResult() != Window.CANCEL) {
- this.addEnvironmentVariable(selection.getSelection());
- treeViewer.refresh();
- }
- }
+ public void handleAddEnvironmentVariableEvent() {
+ EnvVariableDialogHelper selection = new EnvVariableDialogHelper();
+ Displays.pendInDisplayThread(selection);
+ if (selection.getResult() != Window.CANCEL) {
+ this.addEnvironmentVariable(selection.getSelection());
+ treeViewer.refresh();
+ }
+ }
- public void handleCheckStateChangeEvent(CheckStateChangedEvent event) {
- Object obj = event.getElement();
- if (obj != null) {
- EnvironmentPreferenceNode tempSelection = null;
+ public void handleCheckStateChangeEvent(CheckStateChangedEvent event) {
+ Object obj = event.getElement();
+ if (obj != null) {
+ EnvironmentPreferenceNode tempSelection = null;
- if (obj instanceof EnvironmentPreferenceNode) {
- tempSelection = (EnvironmentPreferenceNode) obj;
- tempSelection.setChecked(event.getChecked());
- currentSelection = tempSelection;
- environmentPageDataViewer.setNodeToDisplay(currentSelection);
- }
- }
- }
+ if (obj instanceof EnvironmentPreferenceNode) {
+ tempSelection = (EnvironmentPreferenceNode) obj;
+ tempSelection.setChecked(event.getChecked());
+ currentSelection = tempSelection;
+ environmentPageDataViewer.setNodeToDisplay(currentSelection);
+ }
+ }
+ }
- public void handleEditVariableEvent() {
- ISelection sel = this.treeViewer.getSelection();
- if (!sel.isEmpty()) {
- TreeObject selectedItem = (TreeObject) ((StructuredSelection) sel).getFirstElement();
- if (selectedItem instanceof EnvironmentPreferenceNode) {
- editEnvVariable((EnvironmentPreferenceNode) selectedItem);
- }
- }
- }
+ public void handleEditVariableEvent() {
+ ISelection sel = this.treeViewer.getSelection();
+ if (!sel.isEmpty()) {
+ TreeObject selectedItem = (TreeObject) ((StructuredSelection) sel).getFirstElement();
+ if (selectedItem instanceof EnvironmentPreferenceNode) {
+ editEnvVariable((EnvironmentPreferenceNode) selectedItem);
+ }
+ }
+ }
- public void handleRemoveSelectedViewEvent() {
- StructuredSelection sel = (StructuredSelection) treeViewer.getSelection();
- if (!sel.isEmpty()) {
- Iterator<?> it = sel.iterator();
- while (it.hasNext()) {
- TreeObject leaf = (TreeObject) it.next();
- if (leaf instanceof TreeParent) {
- treeInputList.remove(leaf);
- environmentPageDataViewer.setNodeToDisplay(null);
- } else {
- leaf.getParent().removeChild(leaf);
- environmentPageDataViewer.update();
- }
- }
- treeViewer.refresh();
- }
- }
+ public void handleRemoveSelectedViewEvent() {
+ StructuredSelection sel = (StructuredSelection) treeViewer.getSelection();
+ if (!sel.isEmpty()) {
+ Iterator<?> it = sel.iterator();
+ while (it.hasNext()) {
+ TreeObject leaf = (TreeObject) it.next();
+ if (leaf instanceof TreeParent) {
+ treeInputList.remove(leaf);
+ environmentPageDataViewer.setNodeToDisplay(null);
+ } else {
+ leaf.getParent().removeChild(leaf);
+ environmentPageDataViewer.update();
+ }
+ }
+ treeViewer.refresh();
+ }
+ }
- public void handleTreeSelectionEvent(SelectionChangedEvent event) {
- ISelection sel = event.getSelection();
- if (!sel.isEmpty()) {
- TreeObject selectedItem = (TreeObject) ((StructuredSelection) sel).getFirstElement();
+ public void handleTreeSelectionEvent(SelectionChangedEvent event) {
+ ISelection sel = event.getSelection();
+ if (!sel.isEmpty()) {
+ TreeObject selectedItem = (TreeObject) ((StructuredSelection) sel).getFirstElement();
- EnvironmentPreferenceNode tempSelection = null;
+ EnvironmentPreferenceNode tempSelection = null;
- if (selectedItem instanceof EnvironmentPreferenceNode) {
- tempSelection = (EnvironmentPreferenceNode) selectedItem;
- currentSelection = tempSelection;
- environmentPageDataViewer.setNodeToDisplay(currentSelection);
- }
- treeViewer.refresh();
- }
- }
+ if (selectedItem instanceof EnvironmentPreferenceNode) {
+ tempSelection = (EnvironmentPreferenceNode) selectedItem;
+ currentSelection = tempSelection;
+ environmentPageDataViewer.setNodeToDisplay(currentSelection);
+ }
+ treeViewer.refresh();
+ }
+ }
- private void addEnvironmentVariable(String name) {
- EnvironmentPreferenceNode node = new EnvironmentPreferenceNode(name);
- treeInputList.add(node);
- }
+ private void addEnvironmentVariable(String name) {
+ EnvironmentPreferenceNode node = new EnvironmentPreferenceNode(name);
+ treeInputList.add(node);
+ }
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferenceNode.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferenceNode.java
index 51a889b69a..1d2cbe6b8b 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferenceNode.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferenceNode.java
@@ -34,10 +34,12 @@ public class EnvironmentPreferenceNode extends TreeParent {
return value;
}
+ @Override
public boolean isChecked() {
return checked;
}
+ @Override
public void setChecked(boolean selected) {
this.checked = selected;
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferencePage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferencePage.java
index d19ac62d07..e9bce8bd1a 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferencePage.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPreferencePage.java
@@ -132,9 +132,11 @@ public class EnvironmentPreferencePage {
private void attachListeners() {
treeViewer.getTree().addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent e) {
}
+ @Override
public void keyReleased(KeyEvent e) {
if (e.character == SWT.DEL) {
environmentPageEventHandler.handleRemoveSelectedViewEvent();
@@ -143,25 +145,30 @@ public class EnvironmentPreferencePage {
});
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
environmentPageEventHandler.handleTreeSelectionEvent(event);
}
});
treeViewer.getTree().addMouseListener(new MouseListener() {
+ @Override
public void mouseDoubleClick(MouseEvent e) {
environmentPageEventHandler.handleEditVariableEvent();
}
+ @Override
public void mouseDown(MouseEvent e) {
}
+ @Override
public void mouseUp(MouseEvent e) {
}
});
treeViewer.addCheckStateListener(new ICheckStateListener() {
+ @Override
public void checkStateChanged(CheckStateChangedEvent event) {
environmentPageEventHandler.handleCheckStateChangeEvent(event);
}
@@ -182,10 +189,12 @@ public class EnvironmentPreferencePage {
addButton.setText("Add");
addButton.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
environmentPageEventHandler.handleAddEnvironmentVariableEvent();
}
@@ -195,10 +204,12 @@ public class EnvironmentPreferencePage {
removeButton.setText("Remove");
removeButton.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
environmentPageEventHandler.handleRemoveSelectedViewEvent();
}
@@ -237,14 +248,16 @@ public class EnvironmentPreferencePage {
treeGridData.verticalAlignment = GridData.FILL;
treeViewer =
- new CheckboxTreeViewer(areaComposite, SWT.MULTI | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ new CheckboxTreeViewer(areaComposite, SWT.MULTI | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
treeViewer.getTree().setLayoutData(treeGridData);
treeViewer.setContentProvider(new ITreeContentProvider() {
+ @Override
public void dispose() {
}
+ @Override
public Object[] getChildren(Object parentElement) {
if (parentElement != null && parentElement instanceof TreeParent) {
TreeParent parent = (TreeParent) parentElement;
@@ -255,6 +268,7 @@ public class EnvironmentPreferencePage {
return new Object[0];
}
+ @Override
public Object[] getElements(Object inputElement) {
if (inputElement != null && inputElement instanceof ArrayList<?>) {
ArrayList<?> elementArray = (ArrayList<?>) inputElement;
@@ -263,6 +277,7 @@ public class EnvironmentPreferencePage {
return new Object[0];
}
+ @Override
public Object getParent(Object element) {
if (element != null && element instanceof TreeObject) {
TreeObject child = (TreeObject) element;
@@ -271,6 +286,7 @@ public class EnvironmentPreferencePage {
return new Object();
}
+ @Override
public boolean hasChildren(Object element) {
if (element instanceof TreeParent) {
TreeParent parent = (TreeParent) element;
@@ -279,6 +295,7 @@ public class EnvironmentPreferencePage {
return false;
}
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java
index 97ab975e70..cf2ae5ef03 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/ClassServerInst.java
@@ -55,12 +55,12 @@ public class ClassServerInst {
try {
InetAddress useHostAddress = CorePreferences.getDefaultInetAddress();
classServer = new ClassServer(0, useHostAddress)//;
- {
- @Override
- protected void fileDownloaded(String fp, InetAddress addr) {
- System.out.println("ClassServerInst: File " + fp + " downloaded to " + addr);
- }
- };
+ {
+ @Override
+ protected void fileDownloaded(String fp, InetAddress addr) {
+ System.out.println("ClassServerInst: File " + fp + " downloaded to " + addr);
+ }
+ };
pathResourceFinder = new PathResourceFinder(new String[] {}, false);
classServer.addResourceFinder(new UserLibResourceFinder());
classServer.addResourceFinder(pathResourceFinder);
@@ -84,10 +84,10 @@ public class ClassServerInst {
job.schedule();
} catch (BindException ex) {
OseeLog.log(
- ClassServerInst.class,
- Level.SEVERE,
- "Class Server not started. Likely the IP address used is not local. Set your IP address in the advanced page.",
- ex);
+ ClassServerInst.class,
+ Level.SEVERE,
+ "Class Server not started. Likely the IP address used is not local. Set your IP address in the advanced page.",
+ ex);
} catch (Exception ex) {
OseeLog.log(ClassServerInst.class, Level.SEVERE, "Class Server not started.", ex);
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialog.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialog.java
index 0162b3c22d..9fbd5a766d 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialog.java
@@ -74,10 +74,12 @@ public class EnvVariableDetailsDialog extends MessageDialog {
okButton.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
selectionOk = true;
@@ -86,10 +88,12 @@ public class EnvVariableDetailsDialog extends MessageDialog {
cancelButton.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
selectionOk = false;
}
@@ -150,6 +154,7 @@ public class EnvVariableDetailsDialog extends MessageDialog {
textArea.setText((selection != null ? selection : ""));
textArea.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
selection = textArea.getText();
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialogHelper.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialogHelper.java
index 873286cd19..25b96be5cf 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialogHelper.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDetailsDialogHelper.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.window.Window;
*/
public class EnvVariableDetailsDialogHelper implements Runnable {
- private String nameOfVariableToSet;
+ private final String nameOfVariableToSet;
private int result;
private String selection;
@@ -35,9 +35,11 @@ public class EnvVariableDetailsDialogHelper implements Runnable {
return selection;
}
+ @Override
public void run() {
- EnvVariableDetailsDialog dlg = new EnvVariableDetailsDialog(null, "Edit " + nameOfVariableToSet, null,
- nameOfVariableToSet + " Value:", MessageDialog.NONE, new String[] {"OK", "Cancel"}, 0, selection);
+ EnvVariableDetailsDialog dlg =
+ new EnvVariableDetailsDialog(null, "Edit " + nameOfVariableToSet, null, nameOfVariableToSet + " Value:",
+ MessageDialog.NONE, new String[] {"OK", "Cancel"}, 0, selection);
result = dlg.open();
@@ -46,8 +48,7 @@ public class EnvVariableDetailsDialogHelper implements Runnable {
String info = dlg.getSelection();
if (info != null) {
selection = info;
- }
- else {
+ } else {
selection = "";
}
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialog.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialog.java
index 425cb05790..a2e3acd19a 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialog.java
@@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Shell;
public class EnvVariableDialog extends MessageDialog {
private Button cancelButton;
- private String dialogMessage;
+ private final String dialogMessage;
private Button okButton;
@@ -40,8 +40,7 @@ public class EnvVariableDialog extends MessageDialog {
private boolean selectionOk;
private StyledText textArea;
- public EnvVariableDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
- int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
+ public EnvVariableDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
super(parentShell, dialogTitle, dialogTitleImage, null, dialogImageType, dialogButtonLabels, defaultIndex);
this.dialogMessage = dialogMessage;
this.selectionOk = false;
@@ -63,10 +62,12 @@ public class EnvVariableDialog extends MessageDialog {
okButton.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
selectionOk = true;
@@ -75,10 +76,12 @@ public class EnvVariableDialog extends MessageDialog {
cancelButton.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
selectionOk = false;
}
@@ -100,7 +103,7 @@ public class EnvVariableDialog extends MessageDialog {
addView.setLayout(gridLayout);
addView.setLayoutData(gd);
- (new Label(addView, SWT.NONE)).setText(dialogMessage);
+ new Label(addView, SWT.NONE).setText(dialogMessage);
GridData gd1 = new GridData(SWT.FILL);
gd1.minimumWidth = 200;
@@ -110,6 +113,7 @@ public class EnvVariableDialog extends MessageDialog {
textArea.setLayoutData(gd1);
textArea.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
selection = textArea.getText();
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialogHelper.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialogHelper.java
index 871f439e02..153d3bc976 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialogHelper.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/EnvVariableDialogHelper.java
@@ -33,9 +33,11 @@ public class EnvVariableDialogHelper implements Runnable {
return selection;
}
+ @Override
public void run() {
- EnvVariableDialog dlg = new EnvVariableDialog(null, "Add Environment Variable", null, "Enter Name:",
- MessageDialog.NONE, new String[] {"OK", "Cancel"}, 0);
+ EnvVariableDialog dlg =
+ new EnvVariableDialog(null, "Add Environment Variable", null, "Enter Name:", MessageDialog.NONE, new String[] {
+ "OK", "Cancel"}, 0);
result = dlg.open();
@@ -44,8 +46,7 @@ public class EnvVariableDialogHelper implements Runnable {
String info = dlg.getSelection();
if (info != null) {
selection = info;
- }
- else {
+ } else {
selection = "";
}
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/TestManagerSelectDialog.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/TestManagerSelectDialog.java
index b39b43dc8e..1b3d52d57f 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/TestManagerSelectDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/TestManagerSelectDialog.java
@@ -39,8 +39,7 @@ public class TestManagerSelectDialog {
};
TestManagerEditor[] input = PluginUtil.getTestManagers();
this.listSelectionDialog =
- new ListSelectionDialog(Displays.getActiveShell(), input, new ArrayContentProvider(),
- labelProvider, MESSAGE);
+ new ListSelectionDialog(Displays.getActiveShell(), input, new ArrayContentProvider(), labelProvider, MESSAGE);
this.listSelectionDialog.setTitle(MESSAGE);
if (input.length > 0) {
this.listSelectionDialog.setInitialSelections(new Object[] {input[0]});
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/WidgetFactory.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/WidgetFactory.java
index 553e560547..fe1a5e612a 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/WidgetFactory.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/util/WidgetFactory.java
@@ -36,8 +36,7 @@ public class WidgetFactory {
}
/**
- * Creates a <code>Label</code> for use on a GridLayout. The <code>Label</code> will only
- * span 1 column in the grid.
+ * Creates a <code>Label</code> for use on a GridLayout. The <code>Label</code> will only span 1 column in the grid.
*
* @param comp The composite this label will be on.
* @param str The text for the label
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizard.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizard.java
index 42af5f0aec..c2e410efd1 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizard.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizard.java
@@ -38,11 +38,10 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
/**
- * This is a sample new wizard. Its role is to create a new file resource in the provided container.
- * If the container resource (a folder or a project) is selected in the workspace when the wizard is
- * opened, it will accept it as the target container. The wizard creates one file with the extension
- * "mpe". If a sample multi-page editor (also available as a template) is registered for the same
- * extension, it will be able to open it.
+ * This is a sample new wizard. Its role is to create a new file resource in the provided container. If the container
+ * resource (a folder or a project) is selected in the workspace when the wizard is opened, it will accept it as the
+ * target container. The wizard creates one file with the extension "mpe". If a sample multi-page editor (also available
+ * as a template) is registered for the same extension, it will be able to open it.
*/
public class TestManagerNewWizard extends Wizard implements INewWizard {
@@ -62,6 +61,7 @@ public class TestManagerNewWizard extends Wizard implements INewWizard {
* Adding the page to the wizard.
*/
+ @Override
public void addPages() {
page = new TestManagerNewWizardPage(selection);
addPage(page);
@@ -72,37 +72,36 @@ public class TestManagerNewWizard extends Wizard implements INewWizard {
*
* @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
*/
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.selection = selection;
}
/**
- * This method is called when 'Finish' button is pressed in the wizard. We will create an
- * operation and run it using wizard as execution context.
+ * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using
+ * wizard as execution context.
*/
+ @Override
public boolean performFinish() {
final String containerName = page.getContainerName();
final String fileName = page.getFileName();
IRunnableWithProgress op = new IRunnableWithProgress() {
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
doFinish(containerName, fileName, monitor);
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
throw new InvocationTargetException(e);
- }
- finally {
+ } finally {
monitor.done();
}
}
};
try {
getContainer().run(true, false, op);
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
return false;
- }
- catch (InvocationTargetException e) {
+ } catch (InvocationTargetException e) {
Throwable realException = e.getTargetException();
MessageDialog.openError(getShell(), "Error", realException.getMessage());
return false;
@@ -111,8 +110,8 @@ public class TestManagerNewWizard extends Wizard implements INewWizard {
}
/**
- * The worker method. It will find the container, create the file if missing or just replace its
- * contents, and open the editor on the newly created file.
+ * The worker method. It will find the container, create the file if missing or just replace its contents, and open
+ * the editor on the newly created file.
*/
private void doFinish(String containerName, String fileName, IProgressMonitor monitor) throws CoreException {
@@ -129,23 +128,21 @@ public class TestManagerNewWizard extends Wizard implements INewWizard {
InputStream stream = openContentStream();
if (file.exists()) {
file.setContents(stream, true, true, monitor);
- }
- else {
+ } else {
file.create(stream, true, monitor);
}
stream.close();
- }
- catch (IOException e) {
+ } catch (IOException e) {
}
monitor.worked(1);
monitor.setTaskName("Opening file for editing...");
getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IDE.openEditor(page, file, true);
- }
- catch (PartInitException e) {
+ } catch (PartInitException e) {
}
}
});
@@ -157,9 +154,8 @@ public class TestManagerNewWizard extends Wizard implements INewWizard {
*/
private InputStream openContentStream() {
- String contents = "<testManager>\n"
- + "<contact></contact>\n"
- + "<description>Find those bugs</description>\n</testManager>\n";
+ String contents =
+ "<testManager>\n" + "<contact></contact>\n" + "<description>Find those bugs</description>\n</testManager>\n";
return new ByteArrayInputStream(contents.getBytes());
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizardPage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizardPage.java
index 5c2003f7c9..7e04abe37f 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizardPage.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/wizards/TestManagerNewWizardPage.java
@@ -21,6 +21,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -36,9 +37,8 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
/**
- * The "New" wizard page allows setting the container for the new file as well as the file name. The
- * page will only accept file name without the extension OR with the extension that matches the
- * expected one (mpe).
+ * The "New" wizard page allows setting the container for the new file as well as the file name. The page will only
+ * accept file name without the extension OR with the extension that matches the expected one (mpe).
*/
public class TestManagerNewWizardPage extends WizardPage {
@@ -46,7 +46,7 @@ public class TestManagerNewWizardPage extends WizardPage {
private Text fileText;
- private ISelection selection;
+ private final ISelection selection;
/**
* Constructor for SampleNewWizardPage.
@@ -63,6 +63,7 @@ public class TestManagerNewWizardPage extends WizardPage {
/**
* @see IDialogPage#createControl(Composite)
*/
+ @Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
@@ -76,6 +77,7 @@ public class TestManagerNewWizardPage extends WizardPage {
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
containerText.setLayoutData(gd);
containerText.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
@@ -84,6 +86,7 @@ public class TestManagerNewWizardPage extends WizardPage {
Button button = new Button(container, SWT.PUSH);
button.setText("Browse...");
button.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
handleBrowse();
}
@@ -95,6 +98,7 @@ public class TestManagerNewWizardPage extends WizardPage {
gd = new GridData(GridData.FILL_HORIZONTAL);
fileText.setLayoutData(gd);
fileText.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
@@ -133,7 +137,7 @@ public class TestManagerNewWizardPage extends WizardPage {
}
// verify extension isn't there
- if ((fileName.endsWith("tmc") == true) || (fileName.endsWith(".")) == true) {
+ if (fileName.endsWith("tmc") == true || fileName.endsWith(".") == true) {
updateStatus("Do not add .tmc extenstion.");
return;
}
@@ -169,9 +173,10 @@ public class TestManagerNewWizardPage extends WizardPage {
*/
private void handleBrowse() {
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
- ResourcesPlugin.getWorkspace().getRoot(), false, "Select new file container");
- if (dialog.open() == ContainerSelectionDialog.OK) {
+ ContainerSelectionDialog dialog =
+ new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
+ "Select new file container");
+ if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
if (result.length == 1) {
containerText.setText(((Path) result[0]).toOSString());
@@ -186,15 +191,17 @@ public class TestManagerNewWizardPage extends WizardPage {
private void initialize() {
if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) {
IStructuredSelection ssel = (IStructuredSelection) selection;
- if (ssel.size() > 1)
+ if (ssel.size() > 1) {
return;
+ }
Object obj = ssel.getFirstElement();
if (obj instanceof IResource) {
IContainer container;
- if (obj instanceof IContainer)
+ if (obj instanceof IContainer) {
container = (IContainer) obj;
- else
+ } else {
container = ((IResource) obj).getParent();
+ }
containerText.setText(container.getFullPath().toString());
}
}

Back to the top