Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-07-20 20:54:53 +0000
committerrescobar2010-07-20 20:54:53 +0000
commitcd8503bd2a67b2fbcb5daceb02b7ad1089eb525e (patch)
tree5ccbb5ab8d149dd0b77425a3df0c9a2184d3f47e /plugins/org.eclipse.osee.ote.ui.test.manager
parenta88b295f5a066c21fce3aefc406d1e922ca44733 (diff)
downloadorg.eclipse.osee-cd8503bd2a67b2fbcb5daceb02b7ad1089eb525e.tar.gz
org.eclipse.osee-cd8503bd2a67b2fbcb5daceb02b7ad1089eb525e.tar.xz
org.eclipse.osee-cd8503bd2a67b2fbcb5daceb02b7ad1089eb525e.zip
Refactored to use Displays class
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/batches/TestBatchDecorator.java69
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/batches/TestBatchProjectNature.java399
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/configuration/pages/LoadScriptPage.java229
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/ScriptManager.java127
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java565
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java1060
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/ScriptRunJob.java245
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java232
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/ScriptPage.java834
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/StatusWindowWidget.java236
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageDataViewer.java235
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/preferences/environment/EnvironmentPageEventHandler.java205
12 files changed, 2219 insertions, 2217 deletions
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 a741d8089d..1dbd56c393 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
@@ -20,51 +20,52 @@ import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.ote.ui.test.manager.OteTestManagerImage;
import org.eclipse.osee.ote.ui.test.manager.batches.util.SelectionUtil;
import org.eclipse.osee.ote.ui.test.manager.internal.TestManagerPlugin;
-import org.eclipse.swt.widgets.Display;
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));
- }
- }
+ 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);
- Display.getDefault().asyncExec(new Runnable() {
- 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 2bffb82bef..600a4ad4a3 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
@@ -26,210 +26,215 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.ote.ui.test.manager.batches.navigate.TestBatchRegistry;
import org.eclipse.osee.ote.ui.test.manager.batches.navigate.TestBatchSetupViewItems;
import org.eclipse.osee.ote.ui.test.manager.batches.util.ResourceFinder;
import org.eclipse.osee.ote.ui.test.manager.internal.TestManagerPlugin;
-import org.eclipse.swt.widgets.Display;
/**
* @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() {
- Display.getDefault().asyncExec(new Runnable() {
- 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) {
- Display.getDefault().asyncExec(new Runnable() {
- 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) {
- Display.getDefault().asyncExec(new Runnable() {
- 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) {
- Display.getDefault().asyncExec(new Runnable() {
- 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());
- }
- Display.getDefault().asyncExec(new Runnable() {
- 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/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 b4bb056e16..e0a2b207f3 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
@@ -25,12 +25,12 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.ote.ui.test.manager.configuration.ILoadConfig;
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.scriptTable.ScriptTableViewer;
import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
-import org.eclipse.swt.widgets.Display;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -38,118 +38,119 @@ 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);
-
- Display.getDefault().syncExec(new Runnable() {
- 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(
- Display.getDefault().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);
- Display.getDefault().syncExec(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>();
+ }
+
+ 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;
+ }
+ }
+ }
+ }
}
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 d41059dfbe..83f6edbc1e 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
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.test.manager.connection;
-
+package org.eclipse.osee.ote.ui.test.manager.connection;
+
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.HashSet;
@@ -24,6 +24,7 @@ import java.util.logging.Level;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.ote.core.environment.UserTestSessionKey;
import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;
import org.eclipse.osee.ote.core.environment.status.IServiceStatusListener;
@@ -35,12 +36,11 @@ import org.eclipse.osee.ote.ui.test.manager.jobs.StoreOutfileJob;
import org.eclipse.osee.ote.ui.test.manager.models.OutputModelJob;
import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask.ScriptStatusEnum;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public abstract class ScriptManager implements Runnable {
+
+/**
+ * @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;
@@ -63,80 +63,80 @@ public abstract class ScriptManager implements Runnable {
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 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.
+ * 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) {
-
+ public boolean connect(ConnectionEvent event) {
+
connectedEnv = event.getEnvironment();
sessionKey = event.getSessionKey();
try {
/*
* Setup the status listener for commands
*/
- statusListenerImpl = new TestManagerStatusListener(testManager, this);
-
+ 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.
+ * 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));
+ 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;
- }
-
+ return false;
+ }
+
public ScriptTask getScriptTask(String name) {
- return guidToScriptTask.get(name);
- }
-
+ return guidToScriptTask.get(name);
+ }
+
public void notifyScriptQueued(GUID theGUID, final ScriptTask script) {
guidToScriptTask.put(script.getScriptModel().getTestClass(), script);
script.setStatus(ScriptStatusEnum.IN_QUEUE);
- Display.getDefault().asyncExec(new Runnable() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
public void run() {
if (stv.getControl().isDisposed()) {
return;
@@ -144,10 +144,11 @@ public abstract class ScriptManager implements Runnable {
stv.refresh(script);
}
});
- }
-
+ }
+
public void updateScriptTableViewer(final ScriptTask task) {
- Display.getDefault().asyncExec(new Runnable() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
public void run() {
if (stv.getControl().isDisposed()) {
return;
@@ -155,24 +156,26 @@ public abstract class ScriptManager implements Runnable {
stv.refresh(task);
}
});
- }
-
+ }
+
public void updateScriptTableViewerTimed(ScriptTask task) {
updateScriptTable = true;
synchronized (tasksToUpdate) {
tasksToUpdate.add(task);
}
- }
-
+ }
+
+ @Override
public void run() {
if (updateScriptTable) {
updateScriptTable = false;
- Display.getDefault().asyncExec(new Runnable() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
public void run() {
synchronized (tasksToUpdate) {
if (stv.getControl().isDisposed()) {
return;
- }
+ }
for (ScriptTask task : tasksToUpdate) {
stv.refresh(task);
}
@@ -185,31 +188,33 @@ public abstract class ScriptManager implements Runnable {
protected TestManagerEditor getTestManagerEditor() {
return testManager;
- }
-
- public abstract void addTestsToQueue(List<ScriptTask> scripts);
-
+ }
+
+ public abstract void addTestsToQueue(List<ScriptTask> scripts);
+
/**
* @param task
*/
public void notifyScriptStart(final ScriptTask task) {
task.setStatus(ScriptStatusEnum.RUNNING);
- Display.getDefault().asyncExec(new Runnable() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
public void run() {
stv.refresh(task);
}
});
- }
-
- public void storeOutFile(ScriptTask task, TestComplete testComplete, boolean isValidRun) {
+ }
+
+ 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);
+ Job job =
+ new StoreOutfileJob(connectedEnv, testManager, this, task, testComplete.getClientOutfilePath(),
+ testComplete.getServerOutfilePath(), isValidRun);
StoreOutfileJob.scheduleJob(job);
}
- }
-
- protected UserTestSessionKey getSessionKey() {
+ }
+
+ 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/TestManagerServiceStatusDataVisitor.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/connection/TestManagerServiceStatusDataVisitor.java
index c6c16ba5e0..2da232cbb5 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
@@ -18,6 +18,7 @@ import java.util.logging.Level;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.logging.IHealthStatus;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.ote.core.environment.status.CommandAdded;
import org.eclipse.osee.ote.core.environment.status.CommandEndedStatusEnum;
import org.eclipse.osee.ote.core.environment.status.CommandRemoved;
@@ -37,318 +38,318 @@ 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.scriptTable.ScriptTask;
import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask.ScriptStatusEnum;
-import org.eclipse.swt.widgets.Display;
/**
* @author Roberto E. Escobar
*/
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();
- }
+ 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);
+ 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);
+ 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);
+ 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) {
+ 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();
- }
+ 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) {
- Display.getDefault().asyncExec(new Runnable() {
+ private void disconnectOnError(final String cause) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ TestManagerPlugin.getInstance().getOteConsoleService().writeError(cause);
+ }
+ });
+ }
- 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())) {
- Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void asTestServerCommandComplete(final TestServerCommandComplete end) {
- public void run() {
- testManagerEditor.executionCompleted();
- }
- });
- logExecutorSize();
- // }
- }
+ 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);
+ }
- public void asTestServerCommandComplete(final TestServerCommandComplete end) {
+ notifyExecutionComplete(null);
+ }
+ });
+ logExecutorSize();
+ }
- 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);
- }
+ 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()));
- notifyExecutionComplete(null);
- }
- });
- logExecutorSize();
- }
+ scriptManager.notifyScriptDequeued(testComplete.getClassName());
+ scriptManager.updateScriptTableViewer(task);
- 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()));
+ }
+ }
+ });
+ logExecutorSize();
+ }
- scriptManager.notifyScriptDequeued(testComplete.getClassName());
- scriptManager.updateScriptTableViewer(task);
+ 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();
+ }
- }
- }
- });
- 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();
- }
-
- 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/core/TestManagerEditor.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerEditor.java
index db7d45161c..8d6ed8b4c0 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
@@ -31,6 +31,7 @@ import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.plugin.core.IActionable;
import org.eclipse.osee.framework.plugin.core.util.OseeData;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment;
import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;
@@ -44,7 +45,6 @@ import org.eclipse.osee.ote.ui.test.manager.util.ClassServerInst;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
@@ -64,534 +64,534 @@ 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) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(Display.getDefault().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) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(Display.getDefault().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) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(Display.getDefault().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;
+ }
+
+ 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/jobs/ScriptRunJob.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/ScriptRunJob.java
index 5367e82a33..6a716bbfec 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
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.test.manager.jobs;
-
+package org.eclipse.osee.ote.ui.test.manager.jobs;
+
import java.io.File;
import java.util.LinkedList;
import java.util.List;
@@ -20,128 +20,127 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.swt.Displays;
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.scriptTable.ScriptTask;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @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) {
- Display.getDefault().syncExec(new Runnable() {
-
- @Override
- public void run() {
- ErrorDialog.openError(
- Display.getDefault().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()));
-
- Display.getDefault().syncExec(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);
- // }
- // }
- }
-
-}
+
+/**
+ * @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);
+ // }
+ // }
+ }
+
+}
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 57ccf219a0..1bbecc39ce 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,133 +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();
- }
- // Display.getDefault().asyncExec(new Runnable() {
- // public void run() {
- 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(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;
+ }
- 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/pages/ScriptPage.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/ScriptPage.java
index c41a48b175..3e25d48db1 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
@@ -19,6 +19,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.ui.plugin.OseeUiActivator;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.ote.service.ConnectionEvent;
import org.eclipse.osee.ote.ui.test.manager.OteTestManagerImage;
@@ -39,7 +40,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.CoolBar;
import org.eclipse.swt.widgets.CoolItem;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
@@ -49,421 +49,419 @@ 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(Display.getDefault().getActiveShell(), "Error", "Test Manager Settings Error");
- }
- }
-
- private class EnabledAbortsTimer extends TimerTask {
-
- @Override
- public void run() {
- Display.getDefault().asyncExec(new Runnable() {
- 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);
- Display.getDefault().asyncExec(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);
- Display.getDefault().asyncExec(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();
- Display.getDefault().asyncExec(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() {
+ 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);
+ }
} \ 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 71e656c834..7bf6ea2c99 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
@@ -8,128 +8,128 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.test.manager.pages;
-
+package org.eclipse.osee.ote.ui.test.manager.pages;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.FormattedText;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class StatusWindowWidget {
- private Map<String, Map<EntryAttribute, Object>> labelValueMap;
- private List<String> keys;
- private FormattedText statusTextArea;
-
- 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 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);
- }
-
- 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 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 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 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 refresh() {
- Display.getDefault().asyncExec(new Runnable() {
- 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);
- }
- }
- }
- });
- }
-}
+
+/**
+ * @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 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 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);
+ }
+
+ 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 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 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 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 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/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 c03d0777bb..f177d534e3 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
@@ -8,9 +8,10 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.test.manager.preferences.environment;
-
+package org.eclipse.osee.ote.ui.test.manager.preferences.environment;
+
import java.util.ArrayList;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
@@ -18,120 +19,118 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
-
-/**
- * @author Roberto E. Escobar
- */
-public class EnvironmentPageDataViewer {
-
- private Group environmentVariable;
- private EnvironmentPreferenceNode nodeToDisplay;
- private 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 = Display.getDefault().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 = Display.getDefault().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(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
- textArea.setToolTipText("Select a Value From the Tree to Display");
-
- return parent;
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+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;
+ }
+}
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 0f1b791ce5..e2687135ea 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
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.test.manager.preferences.environment;
-
+package org.eclipse.osee.ote.ui.test.manager.preferences.environment;
+
import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@@ -20,108 +20,105 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.osee.framework.jdk.core.type.TreeObject;
import org.eclipse.osee.framework.jdk.core.type.TreeParent;
+import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.ote.ui.test.manager.util.EnvVariableDetailsDialogHelper;
import org.eclipse.osee.ote.ui.test.manager.util.EnvVariableDialogHelper;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class EnvironmentPageEventHandler {
-
- private EnvironmentPreferenceNode currentSelection;
- private EnvironmentPageDataViewer environmentPageDataViewer;
- private ArrayList<EnvironmentPreferenceNode> treeInputList;
- private CheckboxTreeViewer treeViewer;
-
- 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());
- Display.getDefault().syncExec(selection);
- if (selection.getResult() != Window.CANCEL) {
- node.setValue(selection.getSelection());
- environmentPageDataViewer.update();
- }
- }
-
- public void handleAddEnvironmentVariableEvent() {
- EnvVariableDialogHelper selection = new EnvVariableDialogHelper();
- Display.getDefault().syncExec(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;
-
- 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 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();
-
- EnvironmentPreferenceNode tempSelection = null;
-
- 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);
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class EnvironmentPageEventHandler {
+
+ 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 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 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);
+ }
+ }
+ }
+
+ 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 handleTreeSelectionEvent(SelectionChangedEvent event) {
+ ISelection sel = event.getSelection();
+ if (!sel.isEmpty()) {
+ TreeObject selectedItem = (TreeObject) ((StructuredSelection) sel).getFirstElement();
+
+ EnvironmentPreferenceNode tempSelection = null;
+
+ 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);
+ }
+}

Back to the top