diff options
author | donald.g.dunne | 2014-10-07 20:44:33 +0000 |
---|---|---|
committer | donald.g.dunne | 2014-10-13 16:04:09 +0000 |
commit | f5bb5367a99c31e64ba0d7883a62cdccc2dbd4a2 (patch) | |
tree | 169fbe02b764da220964a9e5aa4b2fdd15d3addf /plugins | |
parent | 097385c65996b00b6fd1f39537cbf21785bfbc27 (diff) | |
download | org.eclipse.osee-f5bb5367a99c31e64ba0d7883a62cdccc2dbd4a2.tar.gz org.eclipse.osee-f5bb5367a99c31e64ba0d7883a62cdccc2dbd4a2.tar.xz org.eclipse.osee-f5bb5367a99c31e64ba0d7883a62cdccc2dbd4a2.zip |
bug[ats_7FT15]: OSEE ATS Export does not generate files
Change-Id: Iaa3e729c72b76cfb7a37a73e52c2e56a629d000f
Signed-off-by: donald.g.dunne <donald.g.dunne@boeing.com>
Diffstat (limited to 'plugins')
20 files changed, 695 insertions, 609 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.client.integration.tests/META-INF/MANIFEST.MF index 8f0731f9728..8495362b471 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/META-INF/MANIFEST.MF @@ -70,6 +70,7 @@ Import-Package: com.google.gson;version="2.1.0", org.eclipse.osee.ats.editor, org.eclipse.osee.ats.editor.renderer, org.eclipse.osee.ats.editor.stateItem, + org.eclipse.osee.ats.export, org.eclipse.osee.ats.health, org.eclipse.osee.ats.mocks, org.eclipse.osee.ats.navigate, @@ -94,6 +95,7 @@ Import-Package: com.google.gson;version="2.1.0", org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.logging, + org.eclipse.osee.framework.plugin.core.util, org.eclipse.osee.framework.skynet.core, org.eclipse.osee.framework.skynet.core.artifact, org.eclipse.osee.framework.skynet.core.artifact.search, diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/AtsTest_AllAts_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/AtsTest_AllAts_Suite.java index 73181527896..6fa512a254f 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/AtsTest_AllAts_Suite.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/AtsTest_AllAts_Suite.java @@ -32,7 +32,10 @@ import org.junit.runners.Suite; * @author Donald G. Dunne */ @RunWith(Suite.class) -@Suite.SuiteClasses({AtsCoreClient_Suite.class, AtsTest_Ats_Suite.class}) +@Suite.SuiteClasses({// +AtsCoreClient_Suite.class, // + AtsTest_Ats_Suite.class // +}) public class AtsTest_AllAts_Suite { @BeforeClass diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/DemoDbPopulateSuite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/DemoDbPopulateSuite.java index 7f069887b15..1d5866db359 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/DemoDbPopulateSuite.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/DemoDbPopulateSuite.java @@ -22,11 +22,12 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ +@Suite.SuiteClasses({// PopulateDemoDatabaseTest.class, DemoDbGroupsTest.class, PopulateDemoActionsTest.class, - DemoDbPopulateValidateAtsDatabaseTest.class}) + DemoDbPopulateValidateAtsDatabaseTest.class // +}) /** * @author Donald G. Dunne */ diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/AtsTest_Ats_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/AtsTest_Ats_Suite.java index efc426216ef..786acf3357b 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/AtsTest_Ats_Suite.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/AtsTest_Ats_Suite.java @@ -16,6 +16,7 @@ import org.eclipse.osee.ats.client.integration.tests.ats.column.AtsTest_Column_S import org.eclipse.osee.ats.client.integration.tests.ats.config.AtsTest_Config_Suite; import org.eclipse.osee.ats.client.integration.tests.ats.editor.AtsTest_Editor_Suite; import org.eclipse.osee.ats.client.integration.tests.ats.ev.AtsTest_EV_TestSuite; +import org.eclipse.osee.ats.client.integration.tests.ats.export.AtsTest_Export_Suite; import org.eclipse.osee.ats.client.integration.tests.ats.health.AtsTest_Health_Suite; import org.eclipse.osee.ats.client.integration.tests.ats.navigate.AtsTest_Navigate_Suite; import org.eclipse.osee.ats.client.integration.tests.ats.render.AtsTest_Renderer_Suite; @@ -41,13 +42,15 @@ import org.junit.runners.Suite; AtsTest_Config_Suite.class, AtsTest_Editor_Suite.class, AtsTest_EV_TestSuite.class, + AtsTest_Export_Suite.class, AtsTest_Health_Suite.class, AtsTest_Navigate_Suite.class, AtsTest_Renderer_Suite.class, AtsTest_Review_Suite.class, AtsTest_Util_Suite.class, AtsTest_Workflow_Suite.class, - AtsTest_World_Search_Suite.class}) + AtsTest_World_Search_Suite.class // +}) public class AtsTest_Ats_Suite { @BeforeClass public static void setUp() throws Exception { diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsExportActionTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsExportActionTest.java new file mode 100644 index 00000000000..f24aaad740d --- /dev/null +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsExportActionTest.java @@ -0,0 +1,153 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.client.integration.tests.ats.export; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.osee.ats.client.demo.DemoUtil; +import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact; +import org.eclipse.osee.ats.export.AtsExportAction; +import org.eclipse.osee.ats.export.AtsExportAction.ExportOption; +import org.eclipse.osee.framework.core.util.Result; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.framework.plugin.core.util.OseeData; +import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor; +import org.eclipse.ui.IEditorPart; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Test unit for {@link AtsExportAction} + * + * @author Donald G. Dunne + */ +public class AtsExportActionTest { + + @Before + @After + public void cleanup() throws CoreException { + IFolder toDir = getTestFolder(); + if (toDir.exists()) { + toDir.delete(true, null); + } + Assert.assertFalse(toDir.exists()); + ResultsEditor.closeAll(); + } + + private IFolder getTestFolder() { + return OseeData.getFolder(AtsExportActionTest.class.getSimpleName()); + } + + private IFolder getTestFolderOrCreate() throws CoreException { + IFolder toDir = getTestFolder(); + if (!toDir.exists()) { + toDir.create(true, false, null); + } + return toDir; + } + + @Test + public void testExport_asHtmlMerged() throws CoreException, IOException { + AtsExportAction exporter = new AtsExportAction(); + exporter.setPopup(false); + TeamWorkFlowArtifact codeWf1 = DemoUtil.getSawCodeCommittedWf(); + TeamWorkFlowArtifact codeWf2 = DemoUtil.getSawCodeNoBranchWf(); + List<ExportOption> exportOptions = + Arrays.asList(ExportOption.MERGE_INTO_SINGLE_FILE, ExportOption.AS_HTML_TO_FILE); + IFolder toDir = getTestFolderOrCreate(); + Result result = exporter.export(Arrays.asList(codeWf1, codeWf2), exportOptions, toDir.getLocation().toOSString()); + Assert.assertTrue(result.getText(), result.isTrue()); + String html = + Lib.fileToString(new File(toDir.getFile(AtsExportAction.ATS_EXPORT_HTML_FILE).getLocation().toOSString())); + Assert.assertTrue("Does not contain codeWf1 title", html.contains(codeWf1.getName())); + Assert.assertTrue("Does not contain codeWf2 title", html.contains(codeWf2.getName())); + } + + @Test + public void testExport_asHtmlSingle() throws CoreException, IOException { + AtsExportAction exporter = new AtsExportAction(); + exporter.setPopup(false); + TeamWorkFlowArtifact codeWf1 = DemoUtil.getSawCodeCommittedWf(); + TeamWorkFlowArtifact codeWf2 = DemoUtil.getSawCodeNoBranchWf(); + List<ExportOption> exportOptions = + Arrays.asList(ExportOption.SAVE_INTO_SEPARATE_FILES, ExportOption.AS_HTML_TO_FILE); + IFolder toDir = getTestFolderOrCreate(); + Result result = exporter.export(Arrays.asList(codeWf1, codeWf2), exportOptions, toDir.getLocation().toOSString()); + Assert.assertTrue(result.getText(), result.isTrue()); + String html1 = Lib.fileToString(new File(toDir.getFile(codeWf1.getAtsId() + ".html").getLocation().toOSString())); + Assert.assertTrue("Does not contain codeWf1 title", html1.contains(codeWf1.getName())); + String html2 = Lib.fileToString(new File(toDir.getFile(codeWf2.getAtsId() + ".html").getLocation().toOSString())); + Assert.assertTrue("Does not contain codeWf2 title", html2.contains(codeWf2.getName())); + } + + @Test + public void testExport_asHtmlSingleWithTasks() throws CoreException, IOException { + AtsExportAction exporter = new AtsExportAction(); + exporter.setPopup(false); + TeamWorkFlowArtifact codeWf1 = DemoUtil.getSawCodeCommittedWf(); + List<ExportOption> exportOptions = + Arrays.asList(ExportOption.SAVE_INTO_SEPARATE_FILES, ExportOption.AS_HTML_TO_FILE, + ExportOption.INCLUDE_TASKLIST); + IFolder toDir = getTestFolderOrCreate(); + Result result = exporter.export(Arrays.asList(codeWf1), exportOptions, toDir.getLocation().toOSString()); + Assert.assertTrue(result.getText(), result.isTrue()); + String html1 = Lib.fileToString(new File(toDir.getFile(codeWf1.getAtsId() + ".html").getLocation().toOSString())); + Assert.assertTrue("Does not contain codeWf1 title", html1.contains(codeWf1.getName())); + Matcher m = Pattern.compile("<b>Tasks<\\/b>").matcher(html1); + Assert.assertTrue("Does not contain Tasks table", m.find()); + m = Pattern.compile("<td>Create development plan<\\/td>").matcher(html1); + Assert.assertTrue("Does not contain task 1 in table", m.find()); + } + + @Test + public void testExport_asHtmlResultsEditorSingle() { + AtsExportAction exporter = new AtsExportAction(); + exporter.setPopup(false); + TeamWorkFlowArtifact codeWf1 = DemoUtil.getSawCodeCommittedWf(); + TeamWorkFlowArtifact codeWf2 = DemoUtil.getSawCodeNoBranchWf(); + List<ExportOption> exportOptions = + Arrays.asList(ExportOption.SAVE_INTO_SEPARATE_FILES, ExportOption.AS_HTML_TO_RESULT_EDITOR); + Result result = exporter.export(Arrays.asList(codeWf1, codeWf2), exportOptions, null); + Assert.assertTrue(result.getText(), result.isTrue()); + Collection<ResultsEditor> editors = ResultsEditor.getEditors(); + Assert.assertEquals(2, editors.size()); + List<String> expectedTitles = Arrays.asList("Export " + codeWf1.getAtsId(), "Export " + codeWf2.getAtsId()); + for (IEditorPart part : editors) { + Assert.assertTrue(expectedTitles.contains(part.getTitle())); + } + } + + @Test + public void testExport_asHtmlResultsEditorMerge() { + AtsExportAction exporter = new AtsExportAction(); + exporter.setPopup(false); + TeamWorkFlowArtifact codeWf1 = DemoUtil.getSawCodeCommittedWf(); + TeamWorkFlowArtifact codeWf2 = DemoUtil.getSawCodeNoBranchWf(); + List<ExportOption> exportOptions = + Arrays.asList(ExportOption.MERGE_INTO_SINGLE_FILE, ExportOption.AS_HTML_TO_RESULT_EDITOR); + Result result = exporter.export(Arrays.asList(codeWf1, codeWf2), exportOptions, null); + Assert.assertTrue(result.getText(), result.isTrue()); + Collection<ResultsEditor> editors = ResultsEditor.getEditors(); + Assert.assertEquals(1, editors.size()); + IEditorPart part = editors.iterator().next(); + Assert.assertEquals("Export ATS Artifacts", part.getTitle()); + } + +} diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsExportBlamTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsExportBlamTest.java new file mode 100644 index 00000000000..ccb25278407 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsExportBlamTest.java @@ -0,0 +1,137 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.client.integration.tests.ats.export; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import org.eclipse.osee.ats.client.demo.DemoUtil; +import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact; +import org.eclipse.osee.ats.export.AtsExportAction.ExportOption; +import org.eclipse.osee.ats.export.AtsExportBlam; +import org.eclipse.osee.framework.core.util.Result; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.ui.skynet.XWidgetParser; +import org.eclipse.osee.framework.ui.skynet.blam.BlamEditor; +import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; +import org.eclipse.osee.framework.ui.skynet.widgets.util.XWidgetRendererItem; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Donald G. Dunne + */ +public class AtsExportBlamTest { + + @Before + @After + public void setupCleanup() { + BlamEditor.closeAll(); + } + + @Test + public void testGetXWidgetsXml() { + AtsExportBlam blam = new AtsExportBlam(new ArrayList<AbstractWorkflowArtifact>()); + String xml = blam.getXWidgetsXml(); + Assert.assertNotNull(xml); + SwtXWidgetRenderer renderer = new SwtXWidgetRenderer(); + List<XWidgetRendererItem> layoutDatas = XWidgetParser.extractWorkAttributes(renderer, xml); + Assert.assertEquals(8, layoutDatas.size()); + } + + @Test + public void testOpenAtsExportBlam() { + BlamEditor.closeAll(); + AtsExportBlam.openAtsExportBlam(null); + Collection<BlamEditor> editors = BlamEditor.getEditors(); + Assert.assertEquals(1, editors.size()); + } + + @Test + public void testIsEntryValid() { + AtsExportBlam blam = new AtsExportBlam(new ArrayList<AbstractWorkflowArtifact>()); + VariableMap variableMap = new VariableMap(); + + // test nothing selected + variableMap.setValue(AtsExportBlam.ARTIFACTS, new ArrayList<Artifact>()); + Result result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isFalse()); + Assert.assertEquals(AtsExportBlam.NO_ARTIFACTS_SELECTED, result.getText()); + + // test artifacts + variableMap.setValue(AtsExportBlam.ARTIFACTS, Arrays.asList(DemoUtil.getSawCodeCommittedWf())); + result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isFalse()); + Assert.assertEquals(AtsExportBlam.MUST_SELECT_AT_LEAST_ONE_EXPORT_AS_OPTION, result.getText()); + + // detfault ExportOptions to false + for (ExportOption option : ExportOption.values()) { + variableMap.setValue(option.name(), Boolean.FALSE); + } + + // test AS_HTML_TO_FILE or AS_HTML_TO_RESULT_EDITOR + variableMap.setValue(ExportOption.AS_HTML_TO_FILE.name(), Boolean.TRUE); + result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isFalse()); + Assert.assertEquals(AtsExportBlam.MUST_SELECT_MERGE_INTO_SINGLE_FILE_OR_SAVE_INTO_SEPARATE_FILES, + result.getText()); + + variableMap.setValue(ExportOption.AS_HTML_TO_FILE.name(), Boolean.FALSE); + variableMap.setValue(ExportOption.AS_HTML_TO_RESULT_EDITOR.name(), Boolean.TRUE); + result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isFalse()); + Assert.assertEquals(AtsExportBlam.MUST_SELECT_MERGE_INTO_SINGLE_FILE_OR_SAVE_INTO_SEPARATE_FILES, + result.getText()); + + // test MERGE_INTO_SINGLE_FILE or SAVE_INTO_SEPARATE_FILES + variableMap.setValue(ExportOption.MERGE_INTO_SINGLE_FILE.name(), Boolean.TRUE); + result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isTrue()); + + variableMap.setValue(ExportOption.MERGE_INTO_SINGLE_FILE.name(), Boolean.FALSE); + variableMap.setValue(ExportOption.SAVE_INTO_SEPARATE_FILES.name(), Boolean.TRUE); + result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isTrue()); + + // test export location + variableMap.setValue(ExportOption.AS_HTML_TO_FILE.name(), Boolean.TRUE); + variableMap.setValue(ExportOption.AS_HTML_TO_RESULT_EDITOR.name(), Boolean.FALSE); + result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isFalse()); + Assert.assertEquals(AtsExportBlam.MUST_SELECT_EXPORT_LOCATION, result.getText()); + + variableMap.setValue(AtsExportBlam.EXPORT_LOCATION, "asdf"); + result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isFalse()); + Assert.assertEquals(AtsExportBlam.INVALID_DIRECTORY, result.getText()); + + variableMap.setValue(AtsExportBlam.EXPORT_LOCATION, System.getProperty("user.home")); + result = blam.isEntryValid(variableMap); + Assert.assertTrue(result.isTrue()); + } + + @Test + public void testGetExportOptions() { + AtsExportBlam blam = new AtsExportBlam(new ArrayList<AbstractWorkflowArtifact>()); + VariableMap variableMap = new VariableMap(); + Collection<ExportOption> exportOptions = blam.getExportOptions(variableMap); + Assert.assertEquals(0, exportOptions.size()); + + variableMap.setValue(ExportOption.AS_HTML_TO_FILE.name(), Boolean.TRUE); + exportOptions = blam.getExportOptions(variableMap); + Assert.assertEquals(1, exportOptions.size()); + Assert.assertEquals(ExportOption.AS_HTML_TO_FILE, exportOptions.iterator().next()); + } +} diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsTest_Export_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsTest_Export_Suite.java new file mode 100644 index 00000000000..afc1b7aeedb --- /dev/null +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/export/AtsTest_Export_Suite.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.client.integration.tests.ats.export; + +import org.eclipse.osee.ats.client.integration.tests.util.DemoTestUtil; +import org.eclipse.osee.framework.jdk.core.util.OseeProperties; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * @author Donald G. Dunne + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({AtsExportActionTest.class, AtsExportBlamTest.class}) +public class AtsTest_Export_Suite { + + @BeforeClass + public static void setUp() throws Exception { + OseeProperties.setIsInTest(true); + System.out.println("\n\nBegin " + AtsTest_Export_Suite.class.getSimpleName()); + DemoTestUtil.setUpTest(); + } + + @AfterClass + public static void tearDown() throws Exception { + System.out.println("End " + AtsTest_Export_Suite.class.getSimpleName()); + } +} diff --git a/plugins/org.eclipse.osee.ats/plugin.xml b/plugins/org.eclipse.osee.ats/plugin.xml index 4c9cb36118e..e80bf2281eb 100644 --- a/plugins/org.eclipse.osee.ats/plugin.xml +++ b/plugins/org.eclipse.osee.ats/plugin.xml @@ -180,9 +180,6 @@ classname="org.eclipse.osee.ats.world.AtsWorldEditorRenderer"> </Renderer> <Renderer - classname="org.eclipse.osee.ats.export.AtsExportRenderer"> - </Renderer> - <Renderer classname="org.eclipse.osee.ats.workdef.viewer.AtsWorkDefConfigRenderer"> </Renderer> </extension> @@ -243,10 +240,6 @@ name="ATS World Editor"> </command> <command - id="org.eclipse.osee.framework.ui.skynet.atsexport.command" - name="ATS Artifact Export"> - </command> - <command id="org.eclipse.osee.ats.atsworkdefviewer.command" name="ATS Work Definition Viewer"> </command> @@ -369,32 +362,6 @@ </activeWhen> </handler> <handler - class="org.eclipse.osee.ats.export.AtsExportHandler" - commandId="org.eclipse.osee.framework.ui.skynet.atsexport.command"> - <activeWhen> - <or> - <with - variable="activePartId"> - <equals - value="org.eclipse.osee.ats.world.WorldEditor"> - </equals> - </with> - <with - variable="activePartId"> - <equals - value="org.eclipse.osee.ats.editor.TaskEditor"> - </equals> - </with> - <with - variable="activePartId"> - <equals - value="org.eclipse.osee.ats.editor.SMAEditor"> - </equals> - </with> - </or> - </activeWhen> - </handler> - <handler class="org.eclipse.osee.framework.ui.skynet.commandHandlers.ShowArtifactInResourceHandler" commandId="org.eclipse.osee.framework.ui.skynet.resource.command"> <activeWhen> @@ -488,25 +455,11 @@ icon="images/globe.gif"> </image> <image - commandId="org.eclipse.osee.framework.ui.skynet.atsexport.command" - icon="images/export.gif"> - </image> - <image commandId="org.eclipse.osee.ats.atsworkdefviewer.command" icon="images/workDef.gif"> </image> </extension> <extension - point="org.eclipse.ui.exportWizards"> - <wizard - category="org.eclipse.osee.framework.ui.skynet.export" - class="org.eclipse.osee.ats.export.AtsExportWizard" - icon="images/export.gif" - id="org.eclipse.osee.ats.exportWizard" - name="OSEE ATS Export"> - </wizard> - </extension> - <extension point="org.eclipse.osee.framework.skynet.core.ClientLoopbackCmd"> <ClientLoopbackCmd className="org.eclipse.osee.ats.util.OpenInAtsLoopbackCmd"> diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportAction.java new file mode 100644 index 00000000000..65246454b62 --- /dev/null +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportAction.java @@ -0,0 +1,147 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.export; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import org.eclipse.jface.action.Action; +import org.eclipse.osee.ats.core.client.actions.ISelectedAtsArtifacts; +import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact; +import org.eclipse.osee.ats.editor.SMAPrint; +import org.eclipse.osee.framework.core.util.Result; +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.util.AHTML; +import org.eclipse.osee.framework.jdk.core.util.Collections; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.ui.plugin.util.AWorkbench; +import org.eclipse.osee.framework.ui.skynet.FrameworkImage; +import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor; +import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; +import org.eclipse.osee.framework.ui.swt.ImageManager; + +/** + * @author Donald G. Dunne + */ +public class AtsExportAction extends Action { + + private static final String AS_PDF_NOT_IMPLEMENTED_YET = "AS_PDF Not Implemented Yet"; + public static final String ATS_EXPORT_HTML_FILE = "ATS_Export.html"; + private final ISelectedAtsArtifacts selected; + private boolean popup = true; + + public AtsExportAction() { + this(null); + } + + public AtsExportAction(ISelectedAtsArtifacts selected) { + this.selected = selected; + setText("Export Selected ATS Artifacts"); + setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.EXPORT_DATA)); + } + + public enum ExportOption { + AS_HTML_TO_RESULT_EDITOR, + AS_HTML_TO_FILE, + AS_PDF, + MERGE_INTO_SINGLE_FILE, + SAVE_INTO_SEPARATE_FILES, + INCLUDE_TASKLIST; + }; + + public Result export(Collection<? extends Artifact> artifacts, Collection<ExportOption> exportOption, String fileLocation) throws OseeCoreException { + Result result = Result.TrueResult; + boolean singleFile = exportOption.contains(ExportOption.MERGE_INTO_SINGLE_FILE); + boolean asHtmlToFile = exportOption.contains(ExportOption.AS_HTML_TO_FILE); + boolean asHtmlToResultEditor = exportOption.contains(ExportOption.AS_HTML_TO_RESULT_EDITOR); + boolean multipleFile = exportOption.contains(ExportOption.SAVE_INTO_SEPARATE_FILES); + boolean includeTaskList = exportOption.contains(ExportOption.INCLUDE_TASKLIST); + if (asHtmlToFile || asHtmlToResultEditor) { + StringBuffer singleSb = new StringBuffer(); + for (Artifact artifact : artifacts) { + if (artifact instanceof AbstractWorkflowArtifact) { + AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) artifact; + SMAPrint smaPrint = new SMAPrint(awa); + smaPrint.setIncludeTaskList(includeTaskList); + String html = XResultDataUI.getReport(smaPrint.getResultData(), "").getManipulatedHtml(); + if (multipleFile) { + try { + if (asHtmlToFile) { + File file = new File(getFileLocation(fileLocation, awa.getAtsId() + ".html")); + Lib.writeStringToFile(html, file); + } + if (asHtmlToResultEditor) { + ResultsEditor.open("Output", "Export " + awa.getAtsId(), html); + } + } catch (IOException ex) { + throw new OseeCoreException("Error writing to html file", ex); + } + } + if (singleFile) { + singleSb.append(html + AHTML.newline(3)); + } + } + } + if (singleFile) { + try { + if (asHtmlToFile) { + File file = new File(getFileLocation(fileLocation, ATS_EXPORT_HTML_FILE)); + Lib.writeStringToFile(singleSb.toString(), file); + } + if (asHtmlToResultEditor) { + ResultsEditor.open("Output", "Export ATS Artifacts", singleSb.toString()); + } + } catch (IOException ex) { + throw new OseeCoreException("Error writing to html file", ex); + } + } + if (popup) { + AWorkbench.popup("Export Completed", "Export Completed"); + } + } + if (exportOption.contains(ExportOption.AS_PDF)) { + if (popup) { + AWorkbench.popup("ERROR", AS_PDF_NOT_IMPLEMENTED_YET); + } else { + result = new Result(false, AS_PDF_NOT_IMPLEMENTED_YET); + } + } + return result; + } + + private String getFileLocation(String fileLocation, String filename) { + if (fileLocation == null) { + fileLocation = System.getProperty("user.home"); + } + return fileLocation + System.getProperty("file.separator") + filename; + } + + @Override + public void run() { + if (selected == null) { + AtsExportBlam.openAtsExportBlam(new ArrayList<AbstractWorkflowArtifact>()); + } else { + AtsExportBlam.openAtsExportBlam(Collections.castAll(AbstractWorkflowArtifact.class, + selected.getSelectedSMAArtifacts())); + } + } + + public boolean isPopup() { + return popup; + } + + public void setPopup(boolean popup) { + this.popup = popup; + } + +} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportBlam.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportBlam.java new file mode 100644 index 00000000000..a184084c358 --- /dev/null +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportBlam.java @@ -0,0 +1,170 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.export; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact; +import org.eclipse.osee.ats.export.AtsExportAction.ExportOption; +import org.eclipse.osee.ats.internal.Activator; +import org.eclipse.osee.framework.core.operation.AbstractOperation; +import org.eclipse.osee.framework.core.operation.IOperation; +import org.eclipse.osee.framework.core.operation.OperationLogger; +import org.eclipse.osee.framework.core.util.Result; +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.logging.OseeLevel; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; +import org.eclipse.osee.framework.ui.skynet.blam.BlamEditor; +import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer; +import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; +import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; +import org.eclipse.ui.forms.widgets.FormToolkit; + +/** + * @author Donald G. Dunne + */ + +public class AtsExportBlam extends AbstractBlam { + public static final String INVALID_DIRECTORY = "Invalid Directory"; + public static final String MUST_SELECT_EXPORT_LOCATION = + "Must select \"Export Location\" for \"" + ExportOption.AS_HTML_TO_FILE + "\" or \"" + ExportOption.AS_PDF + "\" options."; + public static final String MUST_SELECT_MERGE_INTO_SINGLE_FILE_OR_SAVE_INTO_SEPARATE_FILES = + "Must select \"MERGE_INTO_SINGLE_FILE\" or \"SAVE_INTO_SEPARATE_FILES\""; + public static final String MUST_SELECT_AT_LEAST_ONE_EXPORT_AS_OPTION = "Must select at least one export AS_ option."; + public static final String NO_ARTIFACTS_SELECTED = "No Artifacts selected. Cancel wizard and try again."; + public static final String ARTIFACTS = "Drag in ATS objects to export"; + public static final String EXPORT_LOCATION = "Export Location"; + private final Collection<AbstractWorkflowArtifact> defaultArtifacts; + + public AtsExportBlam(Collection<AbstractWorkflowArtifact> defaultArtifacts) { + this.defaultArtifacts = defaultArtifacts; + } + + @Override + public String getDescriptionUsage() { + return "Export ATS objects to PDF or HTML."; + } + + @Override + public String getXWidgetsXml() { + StringBuilder sb = new StringBuilder(); + sb.append("<xWidgets>"); + sb.append("<XWidget xwidgetType=\"XListDropViewer\" displayName=\""); + sb.append(ARTIFACTS); + sb.append("\" />"); + + List<ExportOption> validExportOptions = new ArrayList<ExportOption>(); + validExportOptions.addAll(Arrays.asList(ExportOption.values())); + + for (ExportOption exportOption : validExportOptions) { + sb.append("<XWidget xwidgetType=\"XCheckBox\" displayName=\""); + sb.append(exportOption.name()); + sb.append("\" labelAfter=\"true\" horizontalLabel=\"true\" />"); + } + + sb.append("<XWidget xwidgetType=\"XDirectorySelectionDialog\" displayName=\""); + sb.append(EXPORT_LOCATION); + sb.append("\" multiSelect=\"false\" />"); + + sb.append("</xWidgets>"); + return sb.toString(); + } + + @Override + public Collection<String> getCategories() { + return Arrays.asList("ATS"); + } + + public Result isEntryValid(VariableMap variableMap) { + + List<Artifact> artifacts = variableMap.getArtifacts(ARTIFACTS); + if (artifacts == null || artifacts.isEmpty()) { + return new Result(NO_ARTIFACTS_SELECTED); + } + + Collection<ExportOption> exportOtions = getExportOptions(variableMap); + if (!exportOtions.contains(ExportOption.AS_HTML_TO_FILE) && !exportOtions.contains(ExportOption.AS_HTML_TO_RESULT_EDITOR) && !exportOtions.contains(ExportOption.AS_PDF)) { + return new Result(MUST_SELECT_AT_LEAST_ONE_EXPORT_AS_OPTION); + } + if (!exportOtions.contains(ExportOption.MERGE_INTO_SINGLE_FILE) && !exportOtions.contains(ExportOption.SAVE_INTO_SEPARATE_FILES)) { + return new Result(MUST_SELECT_MERGE_INTO_SINGLE_FILE_OR_SAVE_INTO_SEPARATE_FILES); + } + if (exportOtions.contains(ExportOption.AS_HTML_TO_FILE) || exportOtions.contains(ExportOption.AS_PDF)) { + String fileSelection = variableMap.getString(EXPORT_LOCATION); + if (!Strings.isValid(fileSelection)) { + return new Result(MUST_SELECT_EXPORT_LOCATION); + } + if (!new File(fileSelection).isDirectory()) { + return new Result(INVALID_DIRECTORY); + } + } + return Result.TrueResult; + } + + @Override + public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) throws OseeCoreException { + super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, modListener, isEditable); + if (xWidget.getLabel().equals(ARTIFACTS) && defaultArtifacts != null) { + XListDropViewer viewer = (XListDropViewer) xWidget; + viewer.setInput(defaultArtifacts); + } + } + + public Collection<ExportOption> getExportOptions(VariableMap variableMap) { + List<ExportOption> options = new ArrayList<AtsExportAction.ExportOption>(); + for (ExportOption exportOption : ExportOption.values()) { + boolean checked = variableMap.getBoolean(exportOption.name()); + if (checked) { + options.add(exportOption); + } + } + return options; + } + + @Override + public IOperation createOperation(final VariableMap variableMap, OperationLogger logger) throws Exception { + + Result result = isEntryValid(variableMap); + if (result.isFalse()) { + return null; + } + + final Collection<ExportOption> exportOptions = getExportOptions(variableMap); + IOperation export = new AbstractOperation(getName(), Activator.PLUGIN_ID) { + + @Override + protected void doWork(IProgressMonitor monitor) throws Exception { + AtsExportAction exporter = new AtsExportAction(); + exporter.export(variableMap.getArtifacts(ARTIFACTS), exportOptions, variableMap.getString(EXPORT_LOCATION)); + } + }; + return export; + } + + public static void openAtsExportBlam(Collection<AbstractWorkflowArtifact> defaultArtifacts) { + try { + AtsExportBlam blam = new AtsExportBlam(defaultArtifacts); + BlamEditor.edit(blam); + } catch (OseeCoreException ex) { + OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); + } + } + +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportHandler.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportHandler.java deleted file mode 100644 index 913cf155dbb..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportHandler.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.export; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers.AbstractEditorHandler; -import org.eclipse.osee.framework.ui.skynet.render.PresentationType; - -/** - * @author Jeff C. Phillips - */ -public class AtsExportHandler extends AbstractEditorHandler { - - @Override - public Object executeWithException(ExecutionEvent event, IStructuredSelection selection) throws OseeCoreException { - if (!artifacts.isEmpty()) { - AtsExportRenderer renderer = new AtsExportRenderer(); - renderer.open(artifacts, PresentationType.SPECIALIZED_EDIT); - } - return null; - } -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportManager.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportManager.java deleted file mode 100644 index d046816374c..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportManager.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.export; - -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.osee.ats.api.data.AtsArtifactTypes; -import org.eclipse.osee.ats.core.client.action.ActionManager; -import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact; -import org.eclipse.osee.ats.editor.SMAPrint; -import org.eclipse.osee.ats.internal.Activator; -import org.eclipse.osee.ats.world.WorldEditor; -import org.eclipse.osee.framework.core.util.Result; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.util.AHTML; -import org.eclipse.osee.framework.jdk.core.util.Collections; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.logging.OseeLevel; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.utility.Artifacts; -import org.eclipse.osee.framework.ui.plugin.util.AWorkbench; -import org.eclipse.osee.framework.ui.skynet.FrameworkImage; -import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor; -import org.eclipse.osee.framework.ui.skynet.results.XResultDataUI; -import org.eclipse.osee.framework.ui.swt.ImageManager; -import org.eclipse.search.ui.text.Match; -import org.eclipse.ui.PlatformUI; - -/** - * @author Donald G. Dunne - */ -public class AtsExportManager extends Action { - - private final TreeViewer treeViewer; - - public AtsExportManager(WorldEditor worldEditor) { - this(worldEditor.getWorldComposite().getXViewer()); - } - - public AtsExportManager(TreeViewer treeViewer) { - setText("Export Selected ATS Artifacts"); - setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.EXPORT_DATA)); - this.treeViewer = treeViewer; - } - - public enum ExportOption { - NONE, - POPUP_DIALOG, - AS_HTML_TO_RESULT_EDITOR, - AS_HTML_TO_FILE, - AS_PDF, - MERGE_INTO_SINGLE_FILE, - SAVE_INTO_SEPARATE_FILES, - INCLUDE_TASKLIST; - - }; - - public static Collection<AbstractWorkflowArtifact> getSmaArts(Collection<? extends Artifact> artifacts) throws OseeCoreException { - Set<AbstractWorkflowArtifact> smaArts = new HashSet<AbstractWorkflowArtifact>(); - for (Artifact artifact : artifacts) { - if (artifact instanceof AbstractWorkflowArtifact) { - smaArts.add((AbstractWorkflowArtifact) artifact); - } else if (artifact.isOfType(AtsArtifactTypes.Action)) { - smaArts.addAll(ActionManager.getTeams(artifact)); - } - } - return smaArts; - } - - public static Collection<AbstractWorkflowArtifact> getSmaArts(ISelection selection) throws OseeCoreException { - Set<AbstractWorkflowArtifact> smaArts = new HashSet<AbstractWorkflowArtifact>(); - if (selection != null) { - Iterator<?> selectionIterator = ((IStructuredSelection) selection).iterator(); - while (selectionIterator.hasNext()) { - Object selectedObject = selectionIterator.next(); - - if (selectedObject instanceof Match) { - selectedObject = ((Match) selectedObject).getElement(); - } else if (selectedObject instanceof IAdaptable) { - selectedObject = ((IAdaptable) selectedObject).getAdapter(Artifact.class); - } - - if (selectedObject instanceof AbstractWorkflowArtifact) { - smaArts.add((AbstractWorkflowArtifact) selectedObject); - } else if (Artifacts.isOfType(selectedObject, AtsArtifactTypes.Action)) { - smaArts.addAll(ActionManager.getTeams(selectedObject)); - } else { - OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Expected selection to be of type Artifact"); - } - } - } - return smaArts; - } - - public static Result export(ISelection selection, ExportOption... exportOption) throws OseeCoreException { - return export(getSmaArts(selection), exportOption); - } - - public static Result export(Collection<? extends Artifact> artifacts, ExportOption... exportOption) throws OseeCoreException { - Collection<ExportOption> exportOptions = Collections.getAggregate(exportOption); - if (exportOptions.contains(ExportOption.POPUP_DIALOG)) { - AtsExportWizard exportWizard = new AtsExportWizard(getSmaArts(artifacts)); - WizardDialog dialog = - new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), exportWizard); - if (dialog.open() == Window.OK) { - Collection<ExportOption> selectedExportOptions = exportWizard.getSelectedExportOptions(); - boolean singleFile = selectedExportOptions.contains(ExportOption.MERGE_INTO_SINGLE_FILE); - boolean asHtmlToFile = selectedExportOptions.contains(ExportOption.AS_HTML_TO_FILE); - boolean asHtmlToResultEditor = selectedExportOptions.contains(ExportOption.AS_HTML_TO_RESULT_EDITOR); - boolean multipleFile = selectedExportOptions.contains(ExportOption.SAVE_INTO_SEPARATE_FILES); - boolean includeTaskList = selectedExportOptions.contains(ExportOption.INCLUDE_TASKLIST); - if (asHtmlToFile || asHtmlToResultEditor) { - StringBuffer singleSb = new StringBuffer(); - for (Artifact artifact : artifacts) { - if (artifact instanceof AbstractWorkflowArtifact) { - AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) artifact; - SMAPrint smaPrint = new SMAPrint(awa); - smaPrint.setIncludeTaskList(includeTaskList); - String html = XResultDataUI.getReport(smaPrint.getResultData(), "").getManipulatedHtml(); - if (multipleFile) { - try { - if (asHtmlToFile) { - File file = - new File(exportWizard.getFileLocation() + "\\" + awa.getAtsId() + ".html"); - Lib.writeStringToFile(html, file); - } - if (asHtmlToResultEditor) { - ResultsEditor.open("Output", "Export " + awa.getAtsId(), html); - } - } catch (IOException ex) { - throw new OseeCoreException("Error writing to html file", ex); - } - } - if (singleFile) { - singleSb.append(html + AHTML.newline(3)); - } - } - } - if (singleFile) { - try { - if (asHtmlToFile) { - File file = new File(exportWizard.getFileLocation() + "\\ATS_Export.html"); - Lib.writeStringToFile(singleSb.toString(), file); - } - if (asHtmlToResultEditor) { - ResultsEditor.open("Output", "Export ATS Artifacts", singleSb.toString()); - } - } catch (IOException ex) { - throw new OseeCoreException("Error writing to html file", ex); - } - } - AWorkbench.popup("Export Completed", "Export Completed"); - } - if (selectedExportOptions.contains(ExportOption.AS_PDF)) { - AWorkbench.popup("ERROR", "AS_PDF Not Implemented Yet"); - } - } - } - return Result.TrueResult; - } - - @Override - public void run() { - if (treeViewer != null) { - try { - AtsExportManager.export(treeViewer.getSelection(), ExportOption.POPUP_DIALOG); - } catch (OseeCoreException ex) { - OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); - } - } - } -} diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportPage.java deleted file mode 100644 index 142faeff897..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportPage.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ - -package org.eclipse.osee.ats.export; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.osee.ats.export.AtsExportManager.ExportOption; -import org.eclipse.osee.framework.core.util.Result; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox; -import org.eclipse.osee.framework.ui.skynet.widgets.XFileTextWithSelectionDialog; -import org.eclipse.osee.framework.ui.skynet.widgets.XFileTextWithSelectionDialog.Type; -import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; -import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; -import org.eclipse.osee.framework.ui.swt.Displays; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.dialogs.WizardDataTransferPage; - -/** - * @author Donald G. Dunne - */ -public class AtsExportPage extends WizardDataTransferPage { - private final List<XCheckBox> checkBoxes = new ArrayList<XCheckBox>(); - private XFileTextWithSelectionDialog xFileSel; - private String fileLocation; - private final Collection<ExportOption> selectedExportOptions = new ArrayList<ExportOption>(); - private final Collection<? extends Artifact> artifacts; - - public AtsExportPage(IStructuredSelection selection) throws OseeCoreException { - super("Main"); - this.artifacts = AtsExportManager.getSmaArts(selection); - } - - public AtsExportPage(Collection<? extends Artifact> artifacts) { - super("Main"); - this.artifacts = artifacts; - } - - @Override - protected boolean allowNewContainerName() { - return false; - } - - @Override - public void handleEvent(Event event) { - // do nothing - } - - @Override - public void createControl(Composite parent) { - initializeDialogUnits(parent); - setTitle("Export ATS Artifacts"); - setMessage("Select export options and export location."); - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout(2, false)); - composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); - composite.setFont(parent.getFont()); - - Label label = new Label(composite, SWT.NONE); - if (artifacts.isEmpty()) { - label.setText("Error: No ATS Artifacts input. Close wizard and re-perform selection."); - label.setBackground(Displays.getSystemColor(SWT.COLOR_RED)); - } else { - label.setText("Selected " + artifacts.size() + " ATS Artifact to export."); - } - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.horizontalSpan = 2; - label.setLayoutData(gridData); - - XModifiedListener modifyListener = new XModifiedListener() { - @Override - public void widgetModified(XWidget widget) { - handleModified(); - } - }; - - List<ExportOption> validExportOptions = new ArrayList<ExportOption>(); - validExportOptions.addAll(Arrays.asList(ExportOption.values())); - validExportOptions.remove(ExportOption.POPUP_DIALOG); - validExportOptions.remove(ExportOption.NONE); - - for (ExportOption exportOption : validExportOptions) { - XCheckBox checkBox = new XCheckBox(exportOption.name()); - checkBox.setLabelAfter(true); - checkBox.createWidgets(composite, 2); - if (selectedExportOptions.contains(exportOption)) { - checkBox.set(true); - } - checkBox.addXModifiedListener(modifyListener); - checkBoxes.add(checkBox); - } - - xFileSel = new XFileTextWithSelectionDialog("Export Location", Type.Directory); - xFileSel.createWidgets(composite, 2); - xFileSel.addXModifiedListener(modifyListener); - - setPageComplete(determinePageCompletion()); - setControl(composite); - } - - public Result isEntryValid() { - if (artifacts.isEmpty()) { - return new Result("No Artifacts selected. Cancel wizard and try again."); - } - if (!selectedExportOptions.contains(ExportOption.AS_HTML_TO_FILE) && !selectedExportOptions.contains(ExportOption.AS_HTML_TO_RESULT_EDITOR) && !selectedExportOptions.contains(ExportOption.AS_PDF)) { - return new Result("Must select at least one export AS_ option."); - } - if (!selectedExportOptions.contains(ExportOption.MERGE_INTO_SINGLE_FILE) && !selectedExportOptions.contains(ExportOption.SAVE_INTO_SEPARATE_FILES)) { - return new Result("Must select \"MERGE_INTO_SINGLE_FILE\" or \"SAVE_INTO_SEPARATE_FILES\""); - } - if (selectedExportOptions.contains(ExportOption.AS_HTML_TO_FILE) || selectedExportOptions.contains(ExportOption.AS_PDF)) { - if (xFileSel.get().equals("")) { - return new Result( - "Must select \"Export Location\" for \"" + ExportOption.AS_HTML_TO_FILE + "\" or \"" + ExportOption.AS_PDF + "\" options."); - } - if (!new File(xFileSel.get()).isDirectory()) { - return new Result("Invalid Directory"); - } - } - return Result.TrueResult; - } - - public void handleModified() { - for (XCheckBox checkBox : checkBoxes) { - ExportOption exportOption = ExportOption.valueOf(checkBox.getLabel()); - if (checkBox.isSelected()) { - selectedExportOptions.add(exportOption); - } else { - selectedExportOptions.remove(exportOption); - } - } - fileLocation = xFileSel.get(); - } - - public Collection<ExportOption> getSelectedExportOptions() { - return selectedExportOptions; - } - - public String getFileLocation() { - return fileLocation; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportRenderer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportRenderer.java deleted file mode 100644 index e568096d456..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportRenderer.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ats.export; - -import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.GENERALIZED_EDIT; -import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.PRODUCE_ATTRIBUTE; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.commands.Command; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.osee.ats.api.data.AtsArtifactTypes; -import org.eclipse.osee.ats.editor.renderer.AbstractAtsRenderer; -import org.eclipse.osee.ats.export.AtsExportManager.ExportOption; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; -import org.eclipse.osee.framework.ui.skynet.FrameworkImage; -import org.eclipse.osee.framework.ui.skynet.render.PresentationType; -import org.eclipse.osee.framework.ui.swt.ImageManager; - -/** - * @author Ryan D. Brooks - */ -public class AtsExportRenderer extends AbstractAtsRenderer { - private static final String COMMAND_ID = "org.eclipse.osee.framework.ui.skynet.atsexport.command"; - - @Override - public List<String> getCommandIds(CommandGroup commandGroup) { - ArrayList<String> commandIds = new ArrayList<String>(1); - - if (commandGroup.isEdit()) { - commandIds.add(COMMAND_ID); - } - - return commandIds; - } - - @Override - public ImageDescriptor getCommandImageDescriptor(Command command, Artifact artifact) { - return ImageManager.getImageDescriptor(FrameworkImage.EXPORT_DATA); - } - - @Override - public String getName() { - return "ATS Artifact Export"; - } - - @Override - public AtsExportRenderer newInstance() { - return new AtsExportRenderer(); - } - - @Override - public int getApplicabilityRating(PresentationType presentationType, IArtifact artifact) throws OseeCoreException { - Artifact aArtifact = artifact.getFullArtifact(); - if (aArtifact.isOfType(AtsArtifactTypes.AtsArtifact) && !aArtifact.isHistorical() && !presentationType.matches( - GENERALIZED_EDIT, PRODUCE_ATTRIBUTE)) { - return PRESENTATION_SUBTYPE_MATCH; - } - return NO_MATCH; - } - - @Override - public void open(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException { - AtsExportManager.export(artifacts, ExportOption.POPUP_DIALOG); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportWizard.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportWizard.java deleted file mode 100644 index 85cd71bb120..00000000000 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/export/AtsExportWizard.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ - -package org.eclipse.osee.ats.export; - -import java.util.Collection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.osee.ats.export.AtsExportManager.ExportOption; -import org.eclipse.osee.ats.internal.Activator; -import org.eclipse.osee.framework.core.util.Result; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.logging.OseeLevel; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.ui.plugin.util.AWorkbench; -import org.eclipse.ui.IExportWizard; -import org.eclipse.ui.IWorkbench; - -/** - * @author Donald G. Dunne - */ -public class AtsExportWizard extends Wizard implements IExportWizard { - private AtsExportPage mainPage; - private final Collection<? extends Artifact> artifacts; - - public AtsExportWizard() { - this.artifacts = null; - } - - public AtsExportWizard(Collection<? extends Artifact> artifacts) { - this.artifacts = artifacts; - } - - /** - * @return the fileLocation - */ - public String getFileLocation() { - return mainPage.getFileLocation(); - } - - /** - * @return the selectedExportOptions - */ - public Collection<ExportOption> getSelectedExportOptions() { - return mainPage.getSelectedExportOptions(); - } - - @Override - public boolean performFinish() { - - Result result = mainPage.isEntryValid(); - if (result.isFalse()) { - AWorkbench.popup(result); - return false; - } - try { - AtsExportManager.export(artifacts, - mainPage.getSelectedExportOptions().toArray(new ExportOption[mainPage.getSelectedExportOptions().size()])); - } catch (OseeCoreException ex) { - OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); - } - return true; - } - - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - try { - mainPage = new AtsExportPage(selection); - } catch (OseeCoreException ex) { - OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); - } - } - - @Override - public void addPages() { - if (mainPage == null) { - mainPage = new AtsExportPage(artifacts); - } - addPage(mainPage); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java index cff967133aa..3d23914ea78 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java @@ -34,6 +34,7 @@ import org.eclipse.osee.ats.config.ValidateAtsConfiguration; import org.eclipse.osee.ats.config.editor.AtsConfigResultsEditorNavigateItem; import org.eclipse.osee.ats.core.client.util.AtsUtilClient; import org.eclipse.osee.ats.ev.EvNavigateItems; +import org.eclipse.osee.ats.export.AtsExportAction; import org.eclipse.osee.ats.goal.GoalSearchWorkflowSearchItem; import org.eclipse.osee.ats.health.ValidateAtsDatabase; import org.eclipse.osee.ats.internal.ATSPerspective; @@ -245,6 +246,7 @@ public final class AtsNavigateViewItems implements XNavigateViewItems, IXNavigat new ToggleAtsAdmin(utilItems); new XNavigateItemBlam(utilItems, new ImportActionsViaSpreadsheetBlam()); new XNavigateItemAction(utilItems, new CompareTwoStringsAction(), FrameworkImage.EDIT); + new XNavigateItemAction(utilItems, new AtsExportAction(), FrameworkImage.EXPORT_DATA); new GenerateGuid(utilItems); new XNavigateItemOperation(utilItems, FrameworkImage.ARTIFACT_MASS_EDITOR, MassEditDirtyArtifactOperation.NAME, new MassEditDirtyArtifactOperation()); diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java index 00b335b6828..64f13398e80 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskEditorXWidgetActionPage.java @@ -25,7 +25,7 @@ import org.eclipse.osee.ats.actions.NewAction; import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorAction; import org.eclipse.osee.ats.actions.OpenNewAtsTaskEditorSelected; import org.eclipse.osee.ats.core.client.task.AbstractTaskableArtifact; -import org.eclipse.osee.ats.export.AtsExportManager; +import org.eclipse.osee.ats.export.AtsExportAction; import org.eclipse.osee.ats.help.ui.AtsHelpContext; import org.eclipse.osee.ats.internal.Activator; import org.eclipse.osee.ats.util.WorkflowMetrics; @@ -180,7 +180,7 @@ public class TaskEditorXWidgetActionPage extends AtsXWidgetActionFormPage { addActionToMenu(fMenu, filterMyAssigneeAction); new MenuItem(fMenu, SWT.SEPARATOR); addActionToMenu(fMenu, exportMetricsReportAction); - addActionToMenu(fMenu, new AtsExportManager(taskComposite.getTaskXViewer())); + addActionToMenu(fMenu, new AtsExportAction(taskComposite.getTaskXViewer())); try { if (taskComposite.getIXTaskViewer().isTasksEditable()) { addActionToMenu(fMenu, new ImportTasksViaSpreadsheet( diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java index 1991645a3e5..0b25a7deafd 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskTabXWidgetActionPage.java @@ -30,7 +30,7 @@ import org.eclipse.osee.ats.core.client.task.AbstractTaskableArtifact; import org.eclipse.osee.ats.core.client.task.TaskArtifact; import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact; import org.eclipse.osee.ats.editor.SMAEditor; -import org.eclipse.osee.ats.export.AtsExportManager; +import org.eclipse.osee.ats.export.AtsExportAction; import org.eclipse.osee.ats.help.ui.AtsHelpContext; import org.eclipse.osee.ats.internal.Activator; import org.eclipse.osee.ats.world.AtsXWidgetActionFormPage; @@ -195,7 +195,7 @@ public class TaskTabXWidgetActionPage extends AtsXWidgetActionFormPage { addActionToMenu(fMenu, filterCompletedAction); addActionToMenu(fMenu, filterMyAssigneeAction); new MenuItem(fMenu, SWT.SEPARATOR); - addActionToMenu(fMenu, new AtsExportManager(taskComposite.getTaskXViewer())); + addActionToMenu(fMenu, new AtsExportAction(taskComposite.getTaskXViewer())); try { if (taskComposite.getIXTaskViewer().isTasksEditable()) { addActionToMenu(fMenu, new ImportTasksViaSpreadsheet( diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java index 90cb58efa28..ac8bf69e269 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/AtsWorldEditorItem.java @@ -14,7 +14,7 @@ import java.util.Arrays; import java.util.List; import org.eclipse.jface.action.Action; import org.eclipse.osee.ats.actions.DuplicateWorkflowViaWorldEditorAction; -import org.eclipse.osee.ats.export.AtsExportManager; +import org.eclipse.osee.ats.export.AtsExportAction; /** * @author Donald G. Dunne @@ -23,8 +23,8 @@ public class AtsWorldEditorItem extends AtsWorldEditorItemBase { @Override public List<? extends Action> getWorldEditorMenuActions(IWorldEditorProvider worldEditorProvider, WorldEditor worldEditor) { - return Arrays.asList(new AtsExportManager(worldEditor), new DuplicateWorkflowViaWorldEditorAction( - worldEditor.getWorldComposite().getWorldXViewer())); + return Arrays.asList(new AtsExportAction(worldEditor.getWorldComposite().getWorldXViewer()), + new DuplicateWorkflowViaWorldEditorAction(worldEditor.getWorldComposite().getWorldXViewer())); } } diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java index 68b677f2ec1..18ed5b551f4 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamEditor.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.osee.framework.ui.skynet.blam; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.JobChangeAdapter; @@ -23,6 +26,7 @@ import org.eclipse.osee.framework.ui.skynet.internal.Activator; import org.eclipse.osee.framework.ui.swt.Displays; import org.eclipse.osee.framework.ui.swt.IDirtiableEditor; import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorReference; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.forms.editor.FormEditor; @@ -151,4 +155,28 @@ public class BlamEditor extends FormEditor implements IDirtiableEditor { public String getButtonText() { return getEditorInput().getBlamOperation().getRunText(); } + + public static Collection<BlamEditor> getEditors() { + final List<BlamEditor> editors = new ArrayList<BlamEditor>(); + Displays.pendInDisplayThread(new Runnable() { + @Override + public void run() { + for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) { + editors.add((BlamEditor) editor.getEditor(false)); + } + } + }); + return editors; + } + + public static void closeAll() { + Displays.ensureInDisplayThread(new Runnable() { + @Override + public void run() { + for (IEditorReference editor : AWorkbench.getEditors(EDITOR_ID)) { + AWorkbench.getActivePage().closeEditor(editor.getEditor(false), false); + } + } + }); + } }
\ No newline at end of file |