Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2010-07-24 13:38:31 -0400
committerrbrooks2010-07-24 13:38:31 -0400
commit4081f04850d3eff9eb1bd7241763707bfbb43a45 (patch)
tree258620df94d4b24077ff103a6c4dea9cb78493fb /plugins/org.eclipse.osee.framework.core.dsl.ui.integration
parent4ed8bddc791fda93940f238c5135556a07041dc0 (diff)
downloadorg.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.gz
org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.tar.xz
org.eclipse.osee-4081f04850d3eff9eb1bd7241763707bfbb43a45.zip
applied Eclipse source cleanup
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.dsl.ui.integration')
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/Activator.java48
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeAccessModelInterpreter.java255
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java114
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ExcelToEMFModel.java612
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesExportOperation.java51
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java157
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ResolveImportsOperation.java118
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/XtextOseeTypesHandler.java28
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/NewOseeTypesFilePage.java228
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesExportWizard.java48
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportPage.java418
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportWizard.java68
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesViewerFilter.java80
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/ResourceSelectionPage.java1
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/SelectOseeTypesPanel.java110
15 files changed, 1166 insertions, 1170 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/Activator.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/Activator.java
index 197161e449..fceb8cc910 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/Activator.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/Activator.java
@@ -6,32 +6,32 @@ import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
public class Activator implements BundleActivator {
- public static final String PLUGIN_ID = "org.eclipse.osee.framework.core.dsl.ui.integration";
- private static BundleContext context;
- private static Activator instance;
- private ServiceTracker cacheServiceTracker;
+ public static final String PLUGIN_ID = "org.eclipse.osee.framework.core.dsl.ui.integration";
+ private static BundleContext context;
+ private static Activator instance;
+ private ServiceTracker cacheServiceTracker;
- static BundleContext getContext() {
- return context;
- }
+ static BundleContext getContext() {
+ return context;
+ }
- @Override
- public void start(BundleContext bundleContext) throws Exception {
- Activator.instance = this;
- Activator.context = bundleContext;
- cacheServiceTracker = new ServiceTracker(context, IOseeCachingService.class.getName(), null);
- cacheServiceTracker.open(true);
- }
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.instance = this;
+ Activator.context = bundleContext;
+ cacheServiceTracker = new ServiceTracker(context, IOseeCachingService.class.getName(), null);
+ cacheServiceTracker.open(true);
+ }
- @Override
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- if (cacheServiceTracker != null) {
- cacheServiceTracker.close();
- }
- }
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ if (cacheServiceTracker != null) {
+ cacheServiceTracker.close();
+ }
+ }
- public static IOseeCachingService getOseeCacheService() {
- return (IOseeCachingService) Activator.instance.cacheServiceTracker.getService();
- }
+ public static IOseeCachingService getOseeCacheService() {
+ return (IOseeCachingService) Activator.instance.cacheServiceTracker.getService();
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeAccessModelInterpreter.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeAccessModelInterpreter.java
index 423c848bc8..a7099bdaf3 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeAccessModelInterpreter.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeAccessModelInterpreter.java
@@ -26,7 +26,6 @@ import org.eclipse.osee.framework.core.dsl.oseeDsl.HierarchyRestriction;
import org.eclipse.osee.framework.core.dsl.oseeDsl.ObjectRestriction;
import org.eclipse.osee.framework.core.dsl.oseeDsl.PermissionRule;
import org.eclipse.osee.framework.core.dsl.oseeDsl.RelationTypeRestriction;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XArtifactRef;
import org.eclipse.osee.framework.core.dsl.oseeDsl.util.OseeDslSwitch;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -37,131 +36,131 @@ import org.eclipse.osee.framework.core.model.access.AccessDetail;
*/
public class OseeAccessModelInterpreter implements AccessModelInterpreter {
- public static interface ObjectDataAccessor {
-
- Collection<Identity> getHierarchy(Object object);
-
- Collection<IAttributeType> getAttributeTypes(Object object);
-
- Collection<IArtifactType> getArtifactSuperTypes(Object object);
- }
-
- public OseeAccessModelInterpreter() {
- }
-
- @Override
- public AccessContext getContext(Collection<AccessContext> contexts, AccessContextId contextId) {
- AccessContext toReturn = null;
- for (AccessContext accessContext : contexts) {
- if (contextId.equals(accessContext.getTypeGuid())) {
- toReturn = accessContext;
- }
- }
- return toReturn;
- }
-
- @Override
- public void computeAccessDetails(AccessContext context, Object objectToCheck, Collection<AccessDetail<?>> details) {
- computeAccess(context, objectToCheck, details);
- for (AccessContext superContext : context.getSuperAccessContexts()) {
- computeAccess(superContext, objectToCheck, details);
- }
- }
-
- private void computeAccess(AccessContext context, Object objectToCheck, Collection<AccessDetail<?>> details) {
- context.getAccessRules();
-
- Collection<HierarchyRestriction> restrictions = context.getHierarchyRestrictions();
- for (HierarchyRestriction restriction : restrictions) {
- XArtifactRef artifactRef = restriction.getArtifact();
- // Apply childrenOf Rule;
- boolean isApplicable = false;
- if (isApplicable) {
- restriction.getAccessRules();
- }
- }
-
- }
-
- private AccessPermissionEnum getLeastRestrictive(AccessPermissionEnum permission1, AccessPermissionEnum permission2) {
- if (permission1 == AccessPermissionEnum.ALLOW) {
-
- }
- return permission1;
- }
-
- public static void checkRuleConflict(Collection<PermissionRule> rules) throws OseeCoreException {
- ObjectRestrictionSwitch checker = new ObjectRestrictionSwitch();
- for (PermissionRule rule : rules) {
- ObjectRestriction restriction = rule.getObjectRestriction();
- checker.doSwitch(restriction);
- }
- if (checker.hasConflicts()) {
-
- }
- }
-
- public static PermissionEnum toCorePermission(AccessPermissionEnum modelPermission) {
- PermissionEnum toReturn = PermissionEnum.READ;
- if (modelPermission == AccessPermissionEnum.ALLOW) {
- toReturn = PermissionEnum.WRITE;
- }
- return toReturn;
- }
-
- private static final class ObjectRestrictionSwitch extends OseeDslSwitch<Object> {
- Collection<Identity> artifactInstances;
-
- // Collection<Identity>
- @Override
- public Object caseArtifactInstanceRestriction(ArtifactInstanceRestriction object) {
- return object;
- }
-
- @Override
- public Object caseArtifactTypeRestriction(ArtifactTypeRestriction object) {
- return object;
- }
-
- @Override
- public Object caseRelationTypeRestriction(RelationTypeRestriction object) {
- return object;
- }
-
- @Override
- public Object caseAttributeTypeRestriction(AttributeTypeRestriction object) {
- return object;
- }
-
- @Override
- public Object caseAttributeTypeOfArtifactTypeRestriction(AttributeTypeOfArtifactTypeRestriction object) {
- object.getArtifactType();
- object.getAttributeType();
-
- return object;
- }
-
- public boolean hasConflicts() {
- return false;
- }
- }
-
- //
- // RequirementFolder1 art
- //
- // art.getParent...
- // if not matches SoftwareRequirements --
- // PermissionEnum - Full --- Store what?
- // else
- // if ( art.getArtifactType isOfType("SoftwareRequirements")){
- // data.add(art, new Access<IAttributeType>(QualificationMethod), DENY);
- // } else {
- //
- // }
- // endif
- //
- // Branch allows Type
- // deny contextId "lba.requirementer" edit
- // attributeType "Qualification Method" of artifactType "Software Requirement"
- // under "Software Requirements"
+ public static interface ObjectDataAccessor {
+
+ Collection<Identity> getHierarchy(Object object);
+
+ Collection<IAttributeType> getAttributeTypes(Object object);
+
+ Collection<IArtifactType> getArtifactSuperTypes(Object object);
+ }
+
+ public OseeAccessModelInterpreter() {
+ }
+
+ @Override
+ public AccessContext getContext(Collection<AccessContext> contexts, AccessContextId contextId) {
+ AccessContext toReturn = null;
+ for (AccessContext accessContext : contexts) {
+ if (contextId.equals(accessContext.getTypeGuid())) {
+ toReturn = accessContext;
+ }
+ }
+ return toReturn;
+ }
+
+ @Override
+ public void computeAccessDetails(AccessContext context, Object objectToCheck, Collection<AccessDetail<?>> details) {
+ computeAccess(context, objectToCheck, details);
+ for (AccessContext superContext : context.getSuperAccessContexts()) {
+ computeAccess(superContext, objectToCheck, details);
+ }
+ }
+
+ private void computeAccess(AccessContext context, Object objectToCheck, Collection<AccessDetail<?>> details) {
+ context.getAccessRules();
+
+ Collection<HierarchyRestriction> restrictions = context.getHierarchyRestrictions();
+ for (HierarchyRestriction restriction : restrictions) {
+ restriction.getArtifact();
+ // Apply childrenOf Rule;
+ boolean isApplicable = false;
+ if (isApplicable) {
+ restriction.getAccessRules();
+ }
+ }
+
+ }
+
+ private AccessPermissionEnum getLeastRestrictive(AccessPermissionEnum permission1, AccessPermissionEnum permission2) {
+ if (permission1 == AccessPermissionEnum.ALLOW) {
+
+ }
+ return permission1;
+ }
+
+ public static void checkRuleConflict(Collection<PermissionRule> rules) throws OseeCoreException {
+ ObjectRestrictionSwitch checker = new ObjectRestrictionSwitch();
+ for (PermissionRule rule : rules) {
+ ObjectRestriction restriction = rule.getObjectRestriction();
+ checker.doSwitch(restriction);
+ }
+ if (checker.hasConflicts()) {
+
+ }
+ }
+
+ public static PermissionEnum toCorePermission(AccessPermissionEnum modelPermission) {
+ PermissionEnum toReturn = PermissionEnum.READ;
+ if (modelPermission == AccessPermissionEnum.ALLOW) {
+ toReturn = PermissionEnum.WRITE;
+ }
+ return toReturn;
+ }
+
+ private static final class ObjectRestrictionSwitch extends OseeDslSwitch<Object> {
+ Collection<Identity> artifactInstances;
+
+ // Collection<Identity>
+ @Override
+ public Object caseArtifactInstanceRestriction(ArtifactInstanceRestriction object) {
+ return object;
+ }
+
+ @Override
+ public Object caseArtifactTypeRestriction(ArtifactTypeRestriction object) {
+ return object;
+ }
+
+ @Override
+ public Object caseRelationTypeRestriction(RelationTypeRestriction object) {
+ return object;
+ }
+
+ @Override
+ public Object caseAttributeTypeRestriction(AttributeTypeRestriction object) {
+ return object;
+ }
+
+ @Override
+ public Object caseAttributeTypeOfArtifactTypeRestriction(AttributeTypeOfArtifactTypeRestriction object) {
+ object.getArtifactType();
+ object.getAttributeType();
+
+ return object;
+ }
+
+ public boolean hasConflicts() {
+ return false;
+ }
+ }
+
+ //
+ // RequirementFolder1 art
+ //
+ // art.getParent...
+ // if not matches SoftwareRequirements --
+ // PermissionEnum - Full --- Store what?
+ // else
+ // if ( art.getArtifactType isOfType("SoftwareRequirements")){
+ // data.add(art, new Access<IAttributeType>(QualificationMethod), DENY);
+ // } else {
+ //
+ // }
+ // endif
+ //
+ // Branch allows Type
+ // deny contextId "lba.requirementer" edit
+ // attributeType "Qualification Method" of artifactType "Software Requirement"
+ // under "Software Requirements"
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java
index d501a0716d..0adc493100 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java
@@ -36,69 +36,69 @@ import org.eclipse.ui.progress.UIJob;
* @author Roberto E. Escobar
*/
public class CreateEditorReportOperation extends AbstractOperation {
- private final Collection<TableData> tableData;
- private final String reportName;
+ private final Collection<TableData> tableData;
+ private final String reportName;
- public CreateEditorReportOperation(String reportName, Collection<TableData> tableData) {
- super("Generate Report", Activator.PLUGIN_ID);
- this.tableData = tableData;
- this.reportName = reportName;
- }
+ public CreateEditorReportOperation(String reportName, Collection<TableData> tableData) {
+ super("Generate Report", Activator.PLUGIN_ID);
+ this.tableData = tableData;
+ this.reportName = reportName;
+ }
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- List<IResultsEditorTab> tabs = new ArrayList<IResultsEditorTab>();
- for (TableData data : tableData) {
- List<XViewerColumn> columns = new ArrayList<XViewerColumn>();
- for (String name : data.getColumns()) {
- columns.add(new XViewerColumn(name, name, 80, SWT.LEFT, true, SortDataType.String, false, ""));
- }
- List<IResultsXViewerRow> rows = new ArrayList<IResultsXViewerRow>();
- for (String[] row : data.getRows()) {
- rows.add(new ResultsXViewerRow(row));
- }
- tabs.add(new ResultsEditorTableTab(data.getTitle(), columns, rows));
- }
- openReport(tabs);
- }
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ List<IResultsEditorTab> tabs = new ArrayList<IResultsEditorTab>();
+ for (TableData data : tableData) {
+ List<XViewerColumn> columns = new ArrayList<XViewerColumn>();
+ for (String name : data.getColumns()) {
+ columns.add(new XViewerColumn(name, name, 80, SWT.LEFT, true, SortDataType.String, false, ""));
+ }
+ List<IResultsXViewerRow> rows = new ArrayList<IResultsXViewerRow>();
+ for (String[] row : data.getRows()) {
+ rows.add(new ResultsXViewerRow(row));
+ }
+ tabs.add(new ResultsEditorTableTab(data.getTitle(), columns, rows));
+ }
+ openReport(tabs);
+ }
- private void openReport(final List<IResultsEditorTab> resultsTabs) {
- Job job = new UIJob(reportName) {
+ private void openReport(final List<IResultsEditorTab> resultsTabs) {
+ Job job = new UIJob(reportName) {
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IStatus status;
- try {
- ResultsEditor.open(new ReportProvider(getName(), resultsTabs));
- status = Status.OK_STATUS;
- } catch (Exception ex) {
- status =
- new Status(IStatus.ERROR, Activator.PLUGIN_ID, String.format("Error creating %s Report",
- reportName), ex);
- }
- return status;
- }
- };
- Operations.scheduleJob(job, true, Job.SHORT, null);
- }
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ IStatus status;
+ try {
+ ResultsEditor.open(new ReportProvider(getName(), resultsTabs));
+ status = Status.OK_STATUS;
+ } catch (Exception ex) {
+ status =
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, String.format("Error creating %s Report", reportName),
+ ex);
+ }
+ return status;
+ }
+ };
+ Operations.scheduleJob(job, true, Job.SHORT, null);
+ }
- private static final class ReportProvider implements IResultsEditorProvider {
- private final List<IResultsEditorTab> resultsTabs;
- private final String editorName;
+ private static final class ReportProvider implements IResultsEditorProvider {
+ private final List<IResultsEditorTab> resultsTabs;
+ private final String editorName;
- public ReportProvider(String editorName, List<IResultsEditorTab> resultsTabs) {
- this.resultsTabs = resultsTabs;
- this.editorName = editorName;
- }
+ public ReportProvider(String editorName, List<IResultsEditorTab> resultsTabs) {
+ this.resultsTabs = resultsTabs;
+ this.editorName = editorName;
+ }
- @Override
- public String getEditorName() {
- return editorName;
- }
+ @Override
+ public String getEditorName() {
+ return editorName;
+ }
- @Override
- public List<IResultsEditorTab> getResultsEditorTabs() {
- return resultsTabs;
- }
- }
+ @Override
+ public List<IResultsEditorTab> getResultsEditorTabs() {
+ return resultsTabs;
+ }
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ExcelToEMFModel.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ExcelToEMFModel.java
index d053b21b9f..f9b6f8f238 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ExcelToEMFModel.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ExcelToEMFModel.java
@@ -50,310 +50,310 @@ import org.w3c.dom.NodeList;
* @author Roberto E. Escobar
*/
public class ExcelToEMFModel implements IOseeDataTypeProcessor {
- private final OseeDslFactory factory;
- private final Map<String, OseeDsl> oseeModels;
- private OseeDsl currentModel;
-
- public ExcelToEMFModel(Map<String, OseeDsl> oseeModels) {
- this.factory = OseeDslFactory.eINSTANCE;
- this.oseeModels = oseeModels;
- }
-
- public void createModel(String name) {
- currentModel = factory.createOseeDsl();
- oseeModels.put(name, currentModel);
- }
-
- private OseeDsl getCurrentModel() {
- return currentModel;
- }
-
- private String toQualifiedName(String name) {
- return "\"" + name + "\"";
- }
-
- private OseeType getObject(String name, Class<? extends OseeType> classToLookFor) throws OseeArgumentException {
- EList<? extends OseeType> types;
-
- if (classToLookFor.equals(XArtifactType.class)) {
- types = getCurrentModel().getArtifactTypes();
- } else if (classToLookFor.equals(XAttributeType.class)) {
- types = getCurrentModel().getAttributeTypes();
- } else if (classToLookFor.equals(XRelationType.class)) {
- types = getCurrentModel().getRelationTypes();
- } else if (classToLookFor.equals(XOseeEnumType.class)) {
- types = getCurrentModel().getEnumTypes();
- } else {
- throw new OseeArgumentException(classToLookFor.getName() + " not a supported type");
- }
- for (OseeType oseeTypes : types) {
- if (name.equals(oseeTypes.getName())) {
- return classToLookFor.cast(oseeTypes);
- }
- }
- return null;
- }
-
- @Override
- public void onArtifactTypeInheritance(String ancestor, Collection<String> descendants) throws OseeCoreException {
- XArtifactType ancestorType = (XArtifactType) getObject(ancestor, XArtifactType.class);
- if (ancestorType == null) {
- throw new OseeInvalidInheritanceException("Ancestor [%s]");
- }
-
- // if (superArtifactTypeName != null) {
- // ArtifactType superArtifactType = (ArtifactType) getObject(superArtifactTypeName, ArtifactType.class);
- // if (superArtifactType == null) {
- // boolean isAbstractSuper = false;
- // onArtifactType(isAbstractSuper, superArtifactTypeName, null);
- // superArtifactType = (ArtifactType) getObject(superArtifactTypeName, ArtifactType.class);
- // }
- // artifactType.setSuperArtifactType(superArtifactType);
- // }
- }
-
- @Override
- public void onArtifactType(boolean isAbstract, String name) throws OseeCoreException {
- String id = toQualifiedName(name);
- OseeType types = getObject(id, XArtifactType.class);
- if (types == null) {
- XArtifactType artifactType = factory.createXArtifactType();
- artifactType.setName(id);
- getCurrentModel().getArtifactTypes().add(artifactType);
- }
- }
-
- @Override
- public void onAttributeType(String attributeBaseType, String attributeProviderTypeName, String fileTypeExtension, String name, String defaultValue, String validityXml, int minOccurrence, int maxOccurrence, String toolTipText, String taggerId) throws OseeCoreException {
- String id = toQualifiedName(name);
- OseeType types = getObject(id, XAttributeType.class);
- if (types == null) {
- XAttributeType attributeType = factory.createXAttributeType();
- attributeType.setName(id);
- attributeType.setBaseAttributeType(Lib.getExtension(attributeBaseType));
- attributeType.setDataProvider(Lib.getExtension(attributeProviderTypeName));
- attributeType.setMin(String.valueOf(minOccurrence));
-
- String maxValue;
- if (maxOccurrence == Integer.MAX_VALUE) {
- maxValue = "unlimited";
- } else {
- maxValue = String.valueOf(maxOccurrence);
- }
- attributeType.setMax(maxValue);
-
- if (Strings.isValid(fileTypeExtension)) {
- attributeType.setFileExtension(fileTypeExtension);
- }
- if (Strings.isValid(defaultValue)) {
- attributeType.setDefaultValue(defaultValue);
- }
- if (Strings.isValid(toolTipText)) {
- attributeType.setDescription(toolTipText);
- }
- if (Strings.isValid(taggerId)) {
- attributeType.setTaggerId(taggerId);
- }
-
- XOseeEnumType enumType = getEnumType(attributeBaseType, attributeProviderTypeName, name, validityXml);
- if (enumType != null) {
- attributeType.setEnumType(enumType);
- }
- getCurrentModel().getAttributeTypes().add(attributeType);
- }
- }
-
- @Override
- public boolean doesArtifactSuperTypeExist(String artifactSuperTypeName) throws OseeCoreException {
- return getObject(artifactSuperTypeName, XArtifactType.class) != null;
- }
-
- @Override
- public void onAttributeValidity(String attributeName, String artifactSuperTypeName, Collection<String> concreteTypes) throws OseeCoreException {
- XArtifactType superArtifactType =
- (XArtifactType) getObject(toQualifiedName(artifactSuperTypeName), XArtifactType.class);
- XAttributeType attributeType = (XAttributeType) getObject(toQualifiedName(attributeName), XAttributeType.class);
-
- if (superArtifactType == null && "Artifact".equals(artifactSuperTypeName)) {
- onArtifactType(false, "Artifact");
- superArtifactType = (XArtifactType) getObject(toQualifiedName(artifactSuperTypeName), XArtifactType.class);
- }
-
- if (superArtifactType == null || attributeType == null) {
- throw new OseeStateException(String.format("Type Missing: %s - %s", artifactSuperTypeName, attributeName));
- }
- XAttributeTypeRef reference = factory.createXAttributeTypeRef();
- reference.setValidAttributeType(attributeType);
- superArtifactType.getValidAttributeTypes().add(reference);
- }
-
- @Override
- public void onRelationType(String name, String sideAName, String sideBName, String artifactTypeSideA, String artifactTypeSideB, String multiplicity, String ordered, String defaultOrderTypeGuid) throws OseeCoreException {
- String id = toQualifiedName(name);
- OseeType types = getObject(id, XRelationType.class);
- if (types == null) {
- XRelationType relationType = factory.createXRelationType();
- relationType.setName(id);
- relationType.setSideAName(sideAName);
- relationType.setSideBName(sideBName);
-
- String arranger;
- if ("Yes".equals(ordered)) {
- arranger = "Lexicographical_Ascending";
- } else {
- arranger = "Unordered";
- }
- relationType.setDefaultOrderType(arranger);
- getCurrentModel().getRelationTypes().add(relationType);
- }
- }
-
- @Override
- public void onRelationValidity(String artifactTypeName, String relationTypeName, int sideAMax, int sideBMax) throws OseeCoreException {
- XRelationType relationType = (XRelationType) getObject(toQualifiedName(relationTypeName), XRelationType.class);
- XArtifactType artifactType = (XArtifactType) getObject(toQualifiedName(artifactTypeName), XArtifactType.class);
-
- if (sideAMax > 0) {
- relationType.setSideAArtifactType(artifactType);
- }
- if (sideBMax > 0) {
- relationType.setSideBArtifactType(artifactType);
- }
-
- RelationMultiplicityEnum multiplicity = relationType.getMultiplicity();
- if (sideAMax == Integer.MAX_VALUE && sideBMax == 1) {
- multiplicity = RelationMultiplicityEnum.ONE_TO_MANY;
-
- } else if (sideAMax == 1 && sideBMax == Integer.MAX_VALUE) {
- multiplicity = RelationMultiplicityEnum.MANY_TO_ONE;
-
- } else if (sideAMax == Integer.MAX_VALUE && sideBMax == Integer.MAX_VALUE) {
- multiplicity = RelationMultiplicityEnum.MANY_TO_MANY;
- } else if (sideAMax == 1 && sideBMax == 1) {
- multiplicity = RelationMultiplicityEnum.ONE_TO_ONE;
- } else {
- System.out.println("None detected - " + relationTypeName);
- }
-
- if (multiplicity != null && !multiplicity.equals(relationType.getMultiplicity())) {
- relationType.setMultiplicity(multiplicity);
- } else {
- System.out.println("Null multiplicity - " + relationTypeName);
- }
- }
-
- private static void checkEnumTypeName(String enumTypeName) throws OseeCoreException {
- if (!Strings.isValid(enumTypeName)) {
- throw new OseeArgumentException("Osee Enum Type Name cannot be null.");
- }
- }
-
- private XOseeEnumType getEnumType(String attributeBaseType, String attributeProviderTypeName, String name, String validityXml) throws OseeCoreException {
- Class<? extends Attribute<?>> baseAttributeClass =
- AttributeExtensionManager.getAttributeClassFor(attributeBaseType);
-
- XOseeEnumType oseeEnumType = null;
- if (EnumeratedAttribute.class.isAssignableFrom(baseAttributeClass)) {
- createEnumTypeFromXml(toQualifiedEnumName(name), validityXml);
- }
- return oseeEnumType;
- }
-
- private String toQualifiedEnumName(String name) {
- return "\"" + name + ".enum\"";
- }
-
- private XOseeEnumType createEnumTypeFromXml(String attributeTypeName, String xmlDefinition) throws OseeCoreException {
- List<Pair<String, Integer>> entries = new ArrayList<Pair<String, Integer>>();
- String enumTypeName = "";
-
- if (!Strings.isValid(xmlDefinition)) {
- throw new OseeArgumentException("The enum xml definition must not be null or empty");
- }
-
- Document document = null;
- try {
- document = Jaxp.readXmlDocument(xmlDefinition);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- enumTypeName = attributeTypeName;
- Element choicesElement = document.getDocumentElement();
- NodeList enumerations = choicesElement.getChildNodes();
- Set<String> choices = new LinkedHashSet<String>();
-
- for (int i = 0; i < enumerations.getLength(); i++) {
- Node node = enumerations.item(i);
- if (node.getNodeName().equalsIgnoreCase("Enum")) {
- choices.add(node.getTextContent());
- } else {
- throw new OseeArgumentException("Validity Xml not of excepted enum format");
- }
- }
-
- int ordinal = 0;
- for (String choice : choices) {
- entries.add(new Pair<String, Integer>(choice, ordinal++));
- }
-
- return createEnumType(enumTypeName, entries);
- }
-
- private XOseeEnumType createEnumType(String enumTypeName, List<Pair<String, Integer>> entries) throws OseeCoreException {
- checkEnumTypeName(enumTypeName);
- checkEntryIntegrity(enumTypeName, entries);
-
- XOseeEnumType oseeEnumType = null;
-
- OseeType types = getObject(enumTypeName, XOseeEnumType.class);
- if (types == null) {
- oseeEnumType = factory.createXOseeEnumType();
- oseeEnumType.setName(enumTypeName);
-
- for (Pair<String, Integer> entry : entries) {
- XOseeEnumEntry oseeEnum = factory.createXOseeEnumEntry();
- oseeEnum.setName(entry.getFirst());
- oseeEnum.setOrdinal(String.valueOf(entry.getSecond()));
- oseeEnumType.getEnumEntries().add(oseeEnum);
- }
- getCurrentModel().getEnumTypes().add(oseeEnumType);
- } else {
- oseeEnumType = (XOseeEnumType) types;
- }
- return oseeEnumType;
- }
-
- private static void checkEntryIntegrity(String enumTypeName, List<Pair<String, Integer>> entries) throws OseeCoreException {
- if (entries == null) {
- throw new OseeArgumentException(String.format("Osee Enum Type [%s] had null entries", enumTypeName));
- }
-
- // if (entries.size() <= 0) throw new OseeArgumentException(String.format("Osee Enum Type [%s] had 0 entries",
- // enumTypeName));
- Map<String, Integer> values = new HashMap<String, Integer>();
- for (Pair<String, Integer> entry : entries) {
- String name = entry.getFirst();
- int ordinal = entry.getSecond();
- if (!Strings.isValid(name)) {
- throw new OseeArgumentException("Enum entry name cannot be null");
- }
- if (ordinal < 0) {
- throw new OseeArgumentException("Enum entry ordinal cannot be of negative value");
- }
- if (values.containsKey(name)) {
- throw new OseeArgumentException(String.format("Unique enum entry name violation - [%s] already exists.",
- name));
- }
- if (values.containsValue(ordinal)) {
- throw new OseeArgumentException(String.format("Unique enum entry ordinal violation - [%s] already exists.",
- ordinal));
- }
- values.put(name, ordinal);
- }
- }
-
- @Override
- public void onFinish() {
-
- }
+ private final OseeDslFactory factory;
+ private final Map<String, OseeDsl> oseeModels;
+ private OseeDsl currentModel;
+
+ public ExcelToEMFModel(Map<String, OseeDsl> oseeModels) {
+ this.factory = OseeDslFactory.eINSTANCE;
+ this.oseeModels = oseeModels;
+ }
+
+ public void createModel(String name) {
+ currentModel = factory.createOseeDsl();
+ oseeModels.put(name, currentModel);
+ }
+
+ private OseeDsl getCurrentModel() {
+ return currentModel;
+ }
+
+ private String toQualifiedName(String name) {
+ return "\"" + name + "\"";
+ }
+
+ private OseeType getObject(String name, Class<? extends OseeType> classToLookFor) throws OseeArgumentException {
+ EList<? extends OseeType> types;
+
+ if (classToLookFor.equals(XArtifactType.class)) {
+ types = getCurrentModel().getArtifactTypes();
+ } else if (classToLookFor.equals(XAttributeType.class)) {
+ types = getCurrentModel().getAttributeTypes();
+ } else if (classToLookFor.equals(XRelationType.class)) {
+ types = getCurrentModel().getRelationTypes();
+ } else if (classToLookFor.equals(XOseeEnumType.class)) {
+ types = getCurrentModel().getEnumTypes();
+ } else {
+ throw new OseeArgumentException(classToLookFor.getName() + " not a supported type");
+ }
+ for (OseeType oseeTypes : types) {
+ if (name.equals(oseeTypes.getName())) {
+ return classToLookFor.cast(oseeTypes);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void onArtifactTypeInheritance(String ancestor, Collection<String> descendants) throws OseeCoreException {
+ XArtifactType ancestorType = (XArtifactType) getObject(ancestor, XArtifactType.class);
+ if (ancestorType == null) {
+ throw new OseeInvalidInheritanceException("Ancestor [%s]");
+ }
+
+ // if (superArtifactTypeName != null) {
+ // ArtifactType superArtifactType = (ArtifactType) getObject(superArtifactTypeName, ArtifactType.class);
+ // if (superArtifactType == null) {
+ // boolean isAbstractSuper = false;
+ // onArtifactType(isAbstractSuper, superArtifactTypeName, null);
+ // superArtifactType = (ArtifactType) getObject(superArtifactTypeName, ArtifactType.class);
+ // }
+ // artifactType.setSuperArtifactType(superArtifactType);
+ // }
+ }
+
+ @Override
+ public void onArtifactType(boolean isAbstract, String name) throws OseeCoreException {
+ String id = toQualifiedName(name);
+ OseeType types = getObject(id, XArtifactType.class);
+ if (types == null) {
+ XArtifactType artifactType = factory.createXArtifactType();
+ artifactType.setName(id);
+ getCurrentModel().getArtifactTypes().add(artifactType);
+ }
+ }
+
+ @Override
+ public void onAttributeType(String attributeBaseType, String attributeProviderTypeName, String fileTypeExtension, String name, String defaultValue, String validityXml, int minOccurrence, int maxOccurrence, String toolTipText, String taggerId) throws OseeCoreException {
+ String id = toQualifiedName(name);
+ OseeType types = getObject(id, XAttributeType.class);
+ if (types == null) {
+ XAttributeType attributeType = factory.createXAttributeType();
+ attributeType.setName(id);
+ attributeType.setBaseAttributeType(Lib.getExtension(attributeBaseType));
+ attributeType.setDataProvider(Lib.getExtension(attributeProviderTypeName));
+ attributeType.setMin(String.valueOf(minOccurrence));
+
+ String maxValue;
+ if (maxOccurrence == Integer.MAX_VALUE) {
+ maxValue = "unlimited";
+ } else {
+ maxValue = String.valueOf(maxOccurrence);
+ }
+ attributeType.setMax(maxValue);
+
+ if (Strings.isValid(fileTypeExtension)) {
+ attributeType.setFileExtension(fileTypeExtension);
+ }
+ if (Strings.isValid(defaultValue)) {
+ attributeType.setDefaultValue(defaultValue);
+ }
+ if (Strings.isValid(toolTipText)) {
+ attributeType.setDescription(toolTipText);
+ }
+ if (Strings.isValid(taggerId)) {
+ attributeType.setTaggerId(taggerId);
+ }
+
+ XOseeEnumType enumType = getEnumType(attributeBaseType, attributeProviderTypeName, name, validityXml);
+ if (enumType != null) {
+ attributeType.setEnumType(enumType);
+ }
+ getCurrentModel().getAttributeTypes().add(attributeType);
+ }
+ }
+
+ @Override
+ public boolean doesArtifactSuperTypeExist(String artifactSuperTypeName) throws OseeCoreException {
+ return getObject(artifactSuperTypeName, XArtifactType.class) != null;
+ }
+
+ @Override
+ public void onAttributeValidity(String attributeName, String artifactSuperTypeName, Collection<String> concreteTypes) throws OseeCoreException {
+ XArtifactType superArtifactType =
+ (XArtifactType) getObject(toQualifiedName(artifactSuperTypeName), XArtifactType.class);
+ XAttributeType attributeType = (XAttributeType) getObject(toQualifiedName(attributeName), XAttributeType.class);
+
+ if (superArtifactType == null && "Artifact".equals(artifactSuperTypeName)) {
+ onArtifactType(false, "Artifact");
+ superArtifactType = (XArtifactType) getObject(toQualifiedName(artifactSuperTypeName), XArtifactType.class);
+ }
+
+ if (superArtifactType == null || attributeType == null) {
+ throw new OseeStateException(String.format("Type Missing: %s - %s", artifactSuperTypeName, attributeName));
+ }
+ XAttributeTypeRef reference = factory.createXAttributeTypeRef();
+ reference.setValidAttributeType(attributeType);
+ superArtifactType.getValidAttributeTypes().add(reference);
+ }
+
+ @Override
+ public void onRelationType(String name, String sideAName, String sideBName, String artifactTypeSideA, String artifactTypeSideB, String multiplicity, String ordered, String defaultOrderTypeGuid) throws OseeCoreException {
+ String id = toQualifiedName(name);
+ OseeType types = getObject(id, XRelationType.class);
+ if (types == null) {
+ XRelationType relationType = factory.createXRelationType();
+ relationType.setName(id);
+ relationType.setSideAName(sideAName);
+ relationType.setSideBName(sideBName);
+
+ String arranger;
+ if ("Yes".equals(ordered)) {
+ arranger = "Lexicographical_Ascending";
+ } else {
+ arranger = "Unordered";
+ }
+ relationType.setDefaultOrderType(arranger);
+ getCurrentModel().getRelationTypes().add(relationType);
+ }
+ }
+
+ @Override
+ public void onRelationValidity(String artifactTypeName, String relationTypeName, int sideAMax, int sideBMax) throws OseeCoreException {
+ XRelationType relationType = (XRelationType) getObject(toQualifiedName(relationTypeName), XRelationType.class);
+ XArtifactType artifactType = (XArtifactType) getObject(toQualifiedName(artifactTypeName), XArtifactType.class);
+
+ if (sideAMax > 0) {
+ relationType.setSideAArtifactType(artifactType);
+ }
+ if (sideBMax > 0) {
+ relationType.setSideBArtifactType(artifactType);
+ }
+
+ RelationMultiplicityEnum multiplicity = relationType.getMultiplicity();
+ if (sideAMax == Integer.MAX_VALUE && sideBMax == 1) {
+ multiplicity = RelationMultiplicityEnum.ONE_TO_MANY;
+
+ } else if (sideAMax == 1 && sideBMax == Integer.MAX_VALUE) {
+ multiplicity = RelationMultiplicityEnum.MANY_TO_ONE;
+
+ } else if (sideAMax == Integer.MAX_VALUE && sideBMax == Integer.MAX_VALUE) {
+ multiplicity = RelationMultiplicityEnum.MANY_TO_MANY;
+ } else if (sideAMax == 1 && sideBMax == 1) {
+ multiplicity = RelationMultiplicityEnum.ONE_TO_ONE;
+ } else {
+ System.out.println("None detected - " + relationTypeName);
+ }
+
+ if (multiplicity != null && !multiplicity.equals(relationType.getMultiplicity())) {
+ relationType.setMultiplicity(multiplicity);
+ } else {
+ System.out.println("Null multiplicity - " + relationTypeName);
+ }
+ }
+
+ private static void checkEnumTypeName(String enumTypeName) throws OseeCoreException {
+ if (!Strings.isValid(enumTypeName)) {
+ throw new OseeArgumentException("Osee Enum Type Name cannot be null.");
+ }
+ }
+
+ private XOseeEnumType getEnumType(String attributeBaseType, String attributeProviderTypeName, String name, String validityXml) throws OseeCoreException {
+ Class<? extends Attribute<?>> baseAttributeClass =
+ AttributeExtensionManager.getAttributeClassFor(attributeBaseType);
+
+ XOseeEnumType oseeEnumType = null;
+ if (EnumeratedAttribute.class.isAssignableFrom(baseAttributeClass)) {
+ createEnumTypeFromXml(toQualifiedEnumName(name), validityXml);
+ }
+ return oseeEnumType;
+ }
+
+ private String toQualifiedEnumName(String name) {
+ return "\"" + name + ".enum\"";
+ }
+
+ private XOseeEnumType createEnumTypeFromXml(String attributeTypeName, String xmlDefinition) throws OseeCoreException {
+ List<Pair<String, Integer>> entries = new ArrayList<Pair<String, Integer>>();
+ String enumTypeName = "";
+
+ if (!Strings.isValid(xmlDefinition)) {
+ throw new OseeArgumentException("The enum xml definition must not be null or empty");
+ }
+
+ Document document = null;
+ try {
+ document = Jaxp.readXmlDocument(xmlDefinition);
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ enumTypeName = attributeTypeName;
+ Element choicesElement = document.getDocumentElement();
+ NodeList enumerations = choicesElement.getChildNodes();
+ Set<String> choices = new LinkedHashSet<String>();
+
+ for (int i = 0; i < enumerations.getLength(); i++) {
+ Node node = enumerations.item(i);
+ if (node.getNodeName().equalsIgnoreCase("Enum")) {
+ choices.add(node.getTextContent());
+ } else {
+ throw new OseeArgumentException("Validity Xml not of excepted enum format");
+ }
+ }
+
+ int ordinal = 0;
+ for (String choice : choices) {
+ entries.add(new Pair<String, Integer>(choice, ordinal++));
+ }
+
+ return createEnumType(enumTypeName, entries);
+ }
+
+ private XOseeEnumType createEnumType(String enumTypeName, List<Pair<String, Integer>> entries) throws OseeCoreException {
+ checkEnumTypeName(enumTypeName);
+ checkEntryIntegrity(enumTypeName, entries);
+
+ XOseeEnumType oseeEnumType = null;
+
+ OseeType types = getObject(enumTypeName, XOseeEnumType.class);
+ if (types == null) {
+ oseeEnumType = factory.createXOseeEnumType();
+ oseeEnumType.setName(enumTypeName);
+
+ for (Pair<String, Integer> entry : entries) {
+ XOseeEnumEntry oseeEnum = factory.createXOseeEnumEntry();
+ oseeEnum.setName(entry.getFirst());
+ oseeEnum.setOrdinal(String.valueOf(entry.getSecond()));
+ oseeEnumType.getEnumEntries().add(oseeEnum);
+ }
+ getCurrentModel().getEnumTypes().add(oseeEnumType);
+ } else {
+ oseeEnumType = (XOseeEnumType) types;
+ }
+ return oseeEnumType;
+ }
+
+ private static void checkEntryIntegrity(String enumTypeName, List<Pair<String, Integer>> entries) throws OseeCoreException {
+ if (entries == null) {
+ throw new OseeArgumentException(String.format("Osee Enum Type [%s] had null entries", enumTypeName));
+ }
+
+ // if (entries.size() <= 0) throw new OseeArgumentException(String.format("Osee Enum Type [%s] had 0 entries",
+ // enumTypeName));
+ Map<String, Integer> values = new HashMap<String, Integer>();
+ for (Pair<String, Integer> entry : entries) {
+ String name = entry.getFirst();
+ int ordinal = entry.getSecond();
+ if (!Strings.isValid(name)) {
+ throw new OseeArgumentException("Enum entry name cannot be null");
+ }
+ if (ordinal < 0) {
+ throw new OseeArgumentException("Enum entry ordinal cannot be of negative value");
+ }
+ if (values.containsKey(name)) {
+ throw new OseeArgumentException(String.format("Unique enum entry name violation - [%s] already exists.",
+ name));
+ }
+ if (values.containsValue(ordinal)) {
+ throw new OseeArgumentException(String.format("Unique enum entry ordinal violation - [%s] already exists.",
+ ordinal));
+ }
+ values.put(name, ordinal);
+ }
+ }
+
+ @Override
+ public void onFinish() {
+
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesExportOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesExportOperation.java
index f2d269fa24..fb96fc122d 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesExportOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesExportOperation.java
@@ -32,35 +32,34 @@ import org.eclipse.osee.framework.jdk.core.util.Lib;
* @author Roberto E. Escobar
*/
public class OseeTypesExportOperation extends AbstractOperation {
- private final File folder;
+ private final File folder;
- public OseeTypesExportOperation(File folder) {
- super("Export Osee Types Model", Activator.PLUGIN_ID);
- this.folder = folder;
- }
+ public OseeTypesExportOperation(File folder) {
+ super("Export Osee Types Model", Activator.PLUGIN_ID);
+ this.folder = folder;
+ }
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("sessionId", ClientSessionManager.getSessionId());
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("sessionId", ClientSessionManager.getSessionId());
- String url =
- HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.OSEE_MODEL_CONTEXT,
- parameters);
+ String url =
+ HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.OSEE_MODEL_CONTEXT, parameters);
- OutputStream outputStream = null;
- try {
- outputStream = new BufferedOutputStream(new FileOutputStream(new File(folder, getOseeFileName())));
- AcquireResult results = HttpProcessor.acquire(new URL(url), outputStream);
- if (!results.wasSuccessful()) {
- throw new OseeCoreException("Error exporting osee types");
- }
- } finally {
- Lib.close(outputStream);
- }
- }
+ OutputStream outputStream = null;
+ try {
+ outputStream = new BufferedOutputStream(new FileOutputStream(new File(folder, getOseeFileName())));
+ AcquireResult results = HttpProcessor.acquire(new URL(url), outputStream);
+ if (!results.wasSuccessful()) {
+ throw new OseeCoreException("Error exporting osee types");
+ }
+ } finally {
+ Lib.close(outputStream);
+ }
+ }
- private String getOseeFileName() {
- return "OseeTypes_" + Lib.getDateTimeString() + ".osee";
- }
+ private String getOseeFileName() {
+ return "OseeTypes_" + Lib.getDateTimeString() + ".osee";
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java
index ba067d38b6..097370e7a5 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java
@@ -47,95 +47,94 @@ import org.eclipse.ui.progress.UIJob;
* @author Roberto E. Escobar
*/
public class OseeTypesImportOperation extends AbstractOperation {
- private final IOseeCachingService cacheService;
- private final URI model;
- private final boolean isPersistAllowed;
- private final boolean createTypeChangeReport;
- private final boolean createCompareReport;
+ private final IOseeCachingService cacheService;
+ private final URI model;
+ private final boolean isPersistAllowed;
+ private final boolean createTypeChangeReport;
+ private final boolean createCompareReport;
- public OseeTypesImportOperation(IOseeCachingService cacheService, URI model, boolean createTypeChangeReport, boolean createCompareReport, boolean isPersistAllowed) {
- super("Import Osee Types Model", Activator.PLUGIN_ID);
- this.cacheService = cacheService;
- this.model = model;
- this.isPersistAllowed = isPersistAllowed;
- this.createCompareReport = createCompareReport;
- this.createTypeChangeReport = createTypeChangeReport;
- }
+ public OseeTypesImportOperation(IOseeCachingService cacheService, URI model, boolean createTypeChangeReport, boolean createCompareReport, boolean isPersistAllowed) {
+ super("Import Osee Types Model", Activator.PLUGIN_ID);
+ this.cacheService = cacheService;
+ this.model = model;
+ this.isPersistAllowed = isPersistAllowed;
+ this.createCompareReport = createCompareReport;
+ this.createTypeChangeReport = createTypeChangeReport;
+ }
- private String getModel(URL url) throws IOException {
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(url.openStream());
- return Lib.inputStreamToString(inputStream);
- } finally {
- Lib.close(inputStream);
- }
- }
+ private String getModel(URL url) throws IOException {
+ InputStream inputStream = null;
+ try {
+ inputStream = new BufferedInputStream(url.openStream());
+ return Lib.inputStreamToString(inputStream);
+ } finally {
+ Lib.close(inputStream);
+ }
+ }
- private String getName(URI uri) {
- String name = uri.toASCIIString();
- int index = name.lastIndexOf("/");
- if (index > 0) {
- name = name.substring(index + 1, name.length());
- }
- return name;
- }
+ private String getName(URI uri) {
+ String name = uri.toASCIIString();
+ int index = name.lastIndexOf("/");
+ if (index > 0) {
+ name = name.substring(index + 1, name.length());
+ }
+ return name;
+ }
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Map<String, String> parameters = new HashMap<String, String>();
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ Map<String, String> parameters = new HashMap<String, String>();
- OseeImportModelRequest modelRequest =
- new OseeImportModelRequest(getName(model), getModel(model.toURL()), createTypeChangeReport,
- createCompareReport, isPersistAllowed);
+ OseeImportModelRequest modelRequest =
+ new OseeImportModelRequest(getName(model), getModel(model.toURL()), createTypeChangeReport,
+ createCompareReport, isPersistAllowed);
- OseeImportModelResponse response =
- HttpClientMessage.send(OseeServerContext.OSEE_MODEL_CONTEXT, parameters,
- CoreTranslatorId.OSEE_IMPORT_MODEL_REQUEST, modelRequest,
- CoreTranslatorId.OSEE_IMPORT_MODEL_RESPONSE);
+ OseeImportModelResponse response =
+ HttpClientMessage.send(OseeServerContext.OSEE_MODEL_CONTEXT, parameters,
+ CoreTranslatorId.OSEE_IMPORT_MODEL_REQUEST, modelRequest, CoreTranslatorId.OSEE_IMPORT_MODEL_RESPONSE);
- if (response.wasPersisted()) {
- cacheService.getEnumTypeCache().reloadCache();
- cacheService.getAttributeTypeCache().reloadCache();
- cacheService.getArtifactTypeCache().reloadCache();
- cacheService.getRelationTypeCache().reloadCache();
- }
+ if (response.wasPersisted()) {
+ cacheService.getEnumTypeCache().reloadCache();
+ cacheService.getAttributeTypeCache().reloadCache();
+ cacheService.getArtifactTypeCache().reloadCache();
+ cacheService.getRelationTypeCache().reloadCache();
+ }
- if (createTypeChangeReport) {
- openTabReport(response.getReportData());
- }
+ if (createTypeChangeReport) {
+ openTabReport(response.getReportData());
+ }
- if (createCompareReport) {
- String compareName = response.getComparisonSnapshotModelName();
- String compareData = response.getComparisonSnapshotModel();
- if (Strings.isValid(compareData) && Strings.isValid(compareName)) {
- ComparisonSnapshot snapshot = ModelUtil.loadComparisonSnapshot(compareName, compareData);
- openCompareEditor(snapshot);
- }
- }
- }
+ if (createCompareReport) {
+ String compareName = response.getComparisonSnapshotModelName();
+ String compareData = response.getComparisonSnapshotModel();
+ if (Strings.isValid(compareData) && Strings.isValid(compareName)) {
+ ComparisonSnapshot snapshot = ModelUtil.loadComparisonSnapshot(compareName, compareData);
+ openCompareEditor(snapshot);
+ }
+ }
+ }
- private void openCompareEditor(final ComparisonSnapshot snapshot) {
- Job job = new UIJob("Open Compare") {
+ private void openCompareEditor(final ComparisonSnapshot snapshot) {
+ Job job = new UIJob("Open Compare") {
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IStatus status;
- try {
- CompareEditorInput input = new ModelCompareEditorInput(snapshot);
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- page.openEditor(input, "org.eclipse.compare.CompareEditor", true);
- status = Status.OK_STATUS;
- } catch (Exception ex) {
- status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error opening compare editor", ex);
- }
- return status;
- }
- };
- Jobs.startJob(job);
- }
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ IStatus status;
+ try {
+ CompareEditorInput input = new ModelCompareEditorInput(snapshot);
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ page.openEditor(input, "org.eclipse.compare.CompareEditor", true);
+ status = Status.OK_STATUS;
+ } catch (Exception ex) {
+ status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error opening compare editor", ex);
+ }
+ return status;
+ }
+ };
+ Jobs.startJob(job);
+ }
- private void openTabReport(List<TableData> tableData) {
- Operations.executeAsJob(new CreateEditorReportOperation("Un-Persisted Osee Types", tableData), true);
- }
+ private void openTabReport(List<TableData> tableData) {
+ Operations.executeAsJob(new CreateEditorReportOperation("Un-Persisted Osee Types", tableData), true);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ResolveImportsOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ResolveImportsOperation.java
index 0acc5e337b..44b9670d71 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ResolveImportsOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/ResolveImportsOperation.java
@@ -33,67 +33,67 @@ import org.eclipse.xtext.resource.IClasspathUriResolver;
* @author Roberto E. Escobar
*/
public class ResolveImportsOperation extends AbstractOperation {
- private final Pattern pattern = Pattern.compile("\\s*import\\s+\"(.*?)\"");
- private final List<IFile> selectedItems;
- private final Matcher matcher;
- private final IClasspathUriResolver resolver;
- private final List<LinkNode> dependencyData;
+ private final Pattern pattern = Pattern.compile("\\s*import\\s+\"(.*?)\"");
+ private final List<IFile> selectedItems;
+ private final Matcher matcher;
+ private final IClasspathUriResolver resolver;
+ private final List<LinkNode> dependencyData;
- public ResolveImportsOperation(IClasspathUriResolver resolver, List<IFile> selectedItems, List<LinkNode> dependencyData) {
- super("Extract imports", Activator.PLUGIN_ID);
- this.matcher = pattern.matcher("");
- this.selectedItems = selectedItems;
- this.resolver = resolver;
- this.dependencyData = dependencyData;
- }
+ public ResolveImportsOperation(IClasspathUriResolver resolver, List<IFile> selectedItems, List<LinkNode> dependencyData) {
+ super("Extract imports", Activator.PLUGIN_ID);
+ this.matcher = pattern.matcher("");
+ this.selectedItems = selectedItems;
+ this.resolver = resolver;
+ this.dependencyData = dependencyData;
+ }
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- if (!selectedItems.isEmpty()) {
- double workPercentage = 1.0 / selectedItems.size();
- for (IFile selectedFile : selectedItems) {
- URI uri = URI.createURI(selectedFile.getLocationURI().toASCIIString());
- LinkNode node = new LinkNode(uri);
- dependencyData.add(node);
- resolveImports(node);
- }
- monitor.worked(calculateWork(workPercentage));
- }
- }
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ if (!selectedItems.isEmpty()) {
+ double workPercentage = 1.0 / selectedItems.size();
+ for (IFile selectedFile : selectedItems) {
+ URI uri = URI.createURI(selectedFile.getLocationURI().toASCIIString());
+ LinkNode node = new LinkNode(uri);
+ dependencyData.add(node);
+ resolveImports(node);
+ }
+ monitor.worked(calculateWork(workPercentage));
+ }
+ }
- private void resolveImports(LinkNode node) throws IOException {
- if (node.getUri() != null) {
- Set<String> requiredImports = null;
- try {
- requiredImports = getImports(node.getUri());
- } catch (IOException ex) {
- node.setIsResolved(false);
- throw ex;
- }
- for (String importEntry : requiredImports) {
- URI resolved = resolver.resolve((Object) null, URI.createURI(importEntry));
- LinkMessage message = new LinkMessage(resolved, importEntry);
- node.addChild(message);
- resolveImports(message);
- }
- }
- }
+ private void resolveImports(LinkNode node) throws IOException {
+ if (node.getUri() != null) {
+ Set<String> requiredImports = null;
+ try {
+ requiredImports = getImports(node.getUri());
+ } catch (IOException ex) {
+ node.setIsResolved(false);
+ throw ex;
+ }
+ for (String importEntry : requiredImports) {
+ URI resolved = resolver.resolve((Object) null, URI.createURI(importEntry));
+ LinkMessage message = new LinkMessage(resolved, importEntry);
+ node.addChild(message);
+ resolveImports(message);
+ }
+ }
+ }
- private Set<String> getImports(URI uri) throws IOException {
- Set<String> imports = new HashSet<String>();
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(new URL(uri.toString()).openStream());
- String inputString = Lib.inputStreamToString(inputStream);
- matcher.reset(inputString);
- while (matcher.find()) {
- imports.add(matcher.group(1));
- }
- } finally {
- if (inputStream != null) {
- inputStream.close();
- }
- }
- return imports;
- }
+ private Set<String> getImports(URI uri) throws IOException {
+ Set<String> imports = new HashSet<String>();
+ InputStream inputStream = null;
+ try {
+ inputStream = new BufferedInputStream(new URL(uri.toString()).openStream());
+ String inputString = Lib.inputStreamToString(inputStream);
+ matcher.reset(inputString);
+ while (matcher.find()) {
+ imports.add(matcher.group(1));
+ }
+ } finally {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ }
+ return imports;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/XtextOseeTypesHandler.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/XtextOseeTypesHandler.java
index f3e9502c5d..b2dd95bc70 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/XtextOseeTypesHandler.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/XtextOseeTypesHandler.java
@@ -26,20 +26,20 @@ import org.eclipse.osee.framework.skynet.core.importing.IOseeTypesHandler;
*/
public class XtextOseeTypesHandler implements IOseeTypesHandler {
- @Override
- public void execute(IProgressMonitor monitor, URI uri) throws OseeCoreException {
- try {
- IOseeCachingService cacheService = Activator.getOseeCacheService();
- IOperation operation = new OseeTypesImportOperation(cacheService, uri, false, false, true);
- Operations.executeWorkAndCheckStatus(operation, monitor, -1);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
+ @Override
+ public void execute(IProgressMonitor monitor, URI uri) throws OseeCoreException {
+ try {
+ IOseeCachingService cacheService = Activator.getOseeCacheService();
+ IOperation operation = new OseeTypesImportOperation(cacheService, uri, false, false, true);
+ Operations.executeWorkAndCheckStatus(operation, monitor, -1);
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
- @Override
- public boolean isApplicable(String resource) {
- return Strings.isValid(resource) && resource.endsWith(".osee");
- }
+ @Override
+ public boolean isApplicable(String resource) {
+ return Strings.isValid(resource) && resource.endsWith(".osee");
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/NewOseeTypesFilePage.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/NewOseeTypesFilePage.java
index 3c7b55c614..841613ae02 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/NewOseeTypesFilePage.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/NewOseeTypesFilePage.java
@@ -26,118 +26,118 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.dialogs.WizardDataTransferPage;
public class NewOseeTypesFilePage extends WizardDataTransferPage {
- private static final String PAGE_NAME =
- "org.eclipse.osee.framework.core.dsl.ui.integration.wizards.NewOseeTypeFilePage";
-
- private DirectoryOrFileSelector sourceFileSelector;
- private DirectoryOrFileSelector destinationFileSelector;
- private Button fromExcel;
- private final IResource defaultDestination;
-
- protected NewOseeTypesFilePage(String title, IResource destination) {
- super(PAGE_NAME);
- this.defaultDestination = destination;
- setTitle(title);
- setDescription(title);
- }
-
- @Override
- protected boolean allowNewContainerName() {
- return false;
- }
-
- @Override
- public void handleEvent(Event event) {
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
- }
-
- @Override
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(1, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setFont(parent.getFont());
-
- destinationFileSelector = new DirectoryOrFileSelector(composite, SWT.NONE, "Destination File", this);
- destinationFileSelector.addListener(SWT.Selection, this);
- destinationFileSelector.setDirectorySelected(false);
-
- fromExcel = new Button(composite, SWT.CHECK);
- fromExcel.setText("Based on Excel Osee Types");
- fromExcel.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false));
-
- sourceFileSelector = new DirectoryOrFileSelector(composite, SWT.NONE, "Excel Source File(s)", this);
- sourceFileSelector.addListener(SWT.Selection, this);
- sourceFileSelector.setDirectorySelected(false);
-
- fromExcel.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- sourceFileSelector.setEnabled(fromExcel.getSelection());
- }
- });
-
- restoreWidgetValues();
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
- setControl(composite);
- }
-
- @Override
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- if (defaultDestination != null) {
- destinationFileSelector.setDirectorySelected(true);
- destinationFileSelector.setText(new File(defaultDestination.getLocationURI()).getAbsolutePath());
- } else {
- restoreSelector(settings, "new.osee.types.destination", destinationFileSelector);
- }
-
- restoreSelector(settings, "new.osee.types.source", sourceFileSelector);
- }
- }
-
- private void restoreSelector(IDialogSettings settings, String key, DirectoryOrFileSelector selector) {
- String file = settings.get("key");
- boolean isSelected = settings.getBoolean(key + ".isDir");
- if (Strings.isValid(file)) {
- selector.setText(file);
- selector.setDirectorySelected(isSelected);
- }
- }
-
- private void saveSelector(IDialogSettings settings, String key, DirectoryOrFileSelector selector) {
- File file = selector.getFile();
- if (file != null) {
- settings.put(key, file.getAbsolutePath());
- settings.put(key + ".isDir", file.isDirectory());
- }
- }
-
- @Override
- protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- saveSelector(settings, "new.osee.types.source", sourceFileSelector);
- saveSelector(settings, "new.osee.types.destination", destinationFileSelector);
- }
- }
-
- @Override
- public boolean isPageComplete() {
- return getSourceFile() != null && getDestinationFile() != null && super.isPageComplete();
- }
-
- public File getSourceFile() {
- return sourceFileSelector.getFile();
- }
-
- public File getDestinationFile() {
- return destinationFileSelector.getFile();
- }
+ private static final String PAGE_NAME =
+ "org.eclipse.osee.framework.core.dsl.ui.integration.wizards.NewOseeTypeFilePage";
+
+ private DirectoryOrFileSelector sourceFileSelector;
+ private DirectoryOrFileSelector destinationFileSelector;
+ private Button fromExcel;
+ private final IResource defaultDestination;
+
+ protected NewOseeTypesFilePage(String title, IResource destination) {
+ super(PAGE_NAME);
+ this.defaultDestination = destination;
+ setTitle(title);
+ setDescription(title);
+ }
+
+ @Override
+ protected boolean allowNewContainerName() {
+ return false;
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ updateWidgetEnablements();
+ setPageComplete(determinePageCompletion());
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setFont(parent.getFont());
+
+ destinationFileSelector = new DirectoryOrFileSelector(composite, SWT.NONE, "Destination File", this);
+ destinationFileSelector.addListener(SWT.Selection, this);
+ destinationFileSelector.setDirectorySelected(false);
+
+ fromExcel = new Button(composite, SWT.CHECK);
+ fromExcel.setText("Based on Excel Osee Types");
+ fromExcel.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false));
+
+ sourceFileSelector = new DirectoryOrFileSelector(composite, SWT.NONE, "Excel Source File(s)", this);
+ sourceFileSelector.addListener(SWT.Selection, this);
+ sourceFileSelector.setDirectorySelected(false);
+
+ fromExcel.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ sourceFileSelector.setEnabled(fromExcel.getSelection());
+ }
+ });
+
+ restoreWidgetValues();
+ updateWidgetEnablements();
+ setPageComplete(determinePageCompletion());
+ setControl(composite);
+ }
+
+ @Override
+ protected void restoreWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ if (defaultDestination != null) {
+ destinationFileSelector.setDirectorySelected(true);
+ destinationFileSelector.setText(new File(defaultDestination.getLocationURI()).getAbsolutePath());
+ } else {
+ restoreSelector(settings, "new.osee.types.destination", destinationFileSelector);
+ }
+
+ restoreSelector(settings, "new.osee.types.source", sourceFileSelector);
+ }
+ }
+
+ private void restoreSelector(IDialogSettings settings, String key, DirectoryOrFileSelector selector) {
+ String file = settings.get("key");
+ boolean isSelected = settings.getBoolean(key + ".isDir");
+ if (Strings.isValid(file)) {
+ selector.setText(file);
+ selector.setDirectorySelected(isSelected);
+ }
+ }
+
+ private void saveSelector(IDialogSettings settings, String key, DirectoryOrFileSelector selector) {
+ File file = selector.getFile();
+ if (file != null) {
+ settings.put(key, file.getAbsolutePath());
+ settings.put(key + ".isDir", file.isDirectory());
+ }
+ }
+
+ @Override
+ protected void saveWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ saveSelector(settings, "new.osee.types.source", sourceFileSelector);
+ saveSelector(settings, "new.osee.types.destination", destinationFileSelector);
+ }
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return getSourceFile() != null && getDestinationFile() != null && super.isPageComplete();
+ }
+
+ public File getSourceFile() {
+ return sourceFileSelector.getFile();
+ }
+
+ public File getDestinationFile() {
+ return destinationFileSelector.getFile();
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesExportWizard.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesExportWizard.java
index 77c152c1a5..af27f8af0c 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesExportWizard.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesExportWizard.java
@@ -27,33 +27,33 @@ import org.eclipse.ui.IWorkbench;
* @author Roberto E. Escobar
*/
public class OseeTypesExportWizard extends Wizard implements IImportWizard {
- private ResourceSelectionPage mainPage;
+ private ResourceSelectionPage mainPage;
- public OseeTypesExportWizard() {
- super();
- // setDialogSettings(Activator.getInstance().getDialogSettings());
- setWindowTitle("OSEE Types Export Wizard");
- setNeedsProgressMonitor(true);
- setHelpAvailable(true);
- }
+ public OseeTypesExportWizard() {
+ super();
+ // setDialogSettings(Activator.getInstance().getDialogSettings());
+ setWindowTitle("OSEE Types Export Wizard");
+ setNeedsProgressMonitor(true);
+ setHelpAvailable(true);
+ }
- @Override
- public boolean performFinish() {
- final File folder = mainPage.getFile();
+ @Override
+ public boolean performFinish() {
+ final File folder = mainPage.getFile();
- List<IOperation> ops = new ArrayList<IOperation>();
- ops.add(new OseeTypesExportOperation(folder));
- Operations.executeAsJob(new CompositeOperation("Export Osee Type Model", Activator.PLUGIN_ID, ops), true);
- return true;
- }
+ List<IOperation> ops = new ArrayList<IOperation>();
+ ops.add(new OseeTypesExportOperation(folder));
+ Operations.executeAsJob(new CompositeOperation("Export Osee Type Model", Activator.PLUGIN_ID, ops), true);
+ return true;
+ }
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- mainPage = new ResourceSelectionPage(getWindowTitle());
- }
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ mainPage = new ResourceSelectionPage(getWindowTitle());
+ }
- @Override
- public void addPages() {
- addPage(mainPage);
- }
+ @Override
+ public void addPages() {
+ addPage(mainPage);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportPage.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportPage.java
index 7257dff180..30c2ebc98b 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportPage.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportPage.java
@@ -50,213 +50,213 @@ import org.eclipse.xtext.resource.ClassloaderClasspathUriResolver;
* @author Roberto E. Escobar
*/
public class OseeTypesImportPage extends WizardDataTransferPage {
- private static final String PAGE_NAME =
- "org.eclipse.osee.framework.core.dsl.ui.integration.wizards.OseeTypesImportPage";
-
- private final OseeTypesSetup oseeTypesSetup;
- private File compositeFile;
- private final IStructuredSelection selection;
- private TreeViewer linksViewer;
- private final SelectOseeTypesPanel oseeTypesPanel;
- private final List<LinkNode> messages;
- private Button reportChanges;
- private Button persistChanges;
- private Button useCompareEditor;
-
- protected OseeTypesImportPage(IStructuredSelection selection, String title) {
- super(PAGE_NAME);
- this.selection = selection;
- oseeTypesSetup = new OseeTypesSetup();
- oseeTypesPanel = new SelectOseeTypesPanel();
- oseeTypesPanel.setDefaultItem(getPreselected());
- setTitle(title);
- setDescription("Select *.osee files to import");
- messages = new ArrayList<LinkNode>();
- }
-
- private List<IFile> getPreselected() {
- List<IFile> resources = new ArrayList<IFile>();
- if (selection != null) {
- Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- if (object instanceof IFile) {
- IFile file = (IFile) object;
- if (file.getFileExtension().equals("osee")) {
- resources.add(file);
- }
- }
- }
- }
- return resources;
- }
-
- @Override
- protected boolean allowNewContainerName() {
- return false;
- }
-
- @Override
- public void handleEvent(Event event) {
- updateWidgetEnablements();
- updateExtractedElements();
- }
-
- @Override
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(1, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setFont(parent.getFont());
-
- oseeTypesPanel.createControl(composite);
- oseeTypesPanel.addListener(this);
-
- Label sectionTitle = new Label(composite, SWT.NONE);
- sectionTitle.setText("Resolved dependencies:");
- sectionTitle.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, true, false));
-
- linksViewer = new TreeViewer(composite, SWT.BORDER);
- linksViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- linksViewer.setContentProvider(new LinkNodeContentProvider());
- linksViewer.setLabelProvider(new LinkNodeLabelProvider());
- linksViewer.setInput(messages);
-
- createOptions(composite);
-
- restoreWidgetValues();
- updateWidgetEnablements();
- updateExtractedElements();
- setPageComplete(determinePageCompletion());
- setControl(composite);
- }
-
- private void createOptions(Composite parent) {
- Group composite = new Group(parent, SWT.NULL);
- composite.setLayout(new GridLayout(1, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setFont(parent.getFont());
- composite.setText("Options");
-
- reportChanges = new Button(composite, SWT.CHECK);
- reportChanges.setText("Report Changes");
- reportChanges.setSelection(true);
-
- useCompareEditor = new Button(composite, SWT.CHECK);
- useCompareEditor.setText("Use Compare Editor");
- useCompareEditor.setSelection(false);
-
- persistChanges = new Button(composite, SWT.CHECK);
- persistChanges.setText("Persist Changes");
- persistChanges.setSelection(false);
- }
-
- public boolean isPersistAllowed() {
- return persistChanges.getSelection();
- }
-
- public boolean isReportChanges() {
- return reportChanges.getSelection();
- }
-
- public boolean useCompareEditor() {
- return useCompareEditor.getSelection();
- }
-
- public File getTypesToImport() {
- return compositeFile != null ? compositeFile : null;
- }
-
- private void setCompositeFile(File compositeFile) {
- this.compositeFile = compositeFile;
- }
-
- @Override
- protected boolean validateSourceGroup() {
- return oseeTypesPanel.getSelected() != null;
- }
-
- @Override
- protected boolean validateDestinationGroup() {
- return getTypesToImport() != null;
- }
-
- private synchronized void updateExtractedElements() {
- if (oseeTypesPanel.getSelected() != null) {
- setErrorMessage(null);
- File file = getTypesToImport();
- if (file != null) {
- file.delete();
- setCompositeFile(null);
- }
- OseeLog.log(Activator.class, Level.INFO, "Resolving imports");
-
- final List<IFile> selectedFiles = new ArrayList<IFile>(oseeTypesPanel.getSelected());
- final List<LinkNode> dependencyData = new ArrayList<LinkNode>();
-
- Collection<IOperation> ops = new ArrayList<IOperation>();
- ops.add(new ResolveImportsOperation(new ClassloaderClasspathUriResolver(), selectedFiles, dependencyData));
- ops.add(new CreateCombinedFile(dependencyData));
- if (executeOperation(new CompositeOperation("Resolving imports", Activator.PLUGIN_ID, ops))) {
- messages.clear();
- messages.addAll(dependencyData);
- linksViewer.refresh();
- setPageComplete(determinePageCompletion());
- }
- }
- }
-
- protected boolean executeOperation(final IOperation operation) {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
-
- @Override
- public void run(IProgressMonitor monitor) {
- Operations.executeWork(operation, monitor, -1);
- }
- });
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
-
- IStatus status = operation.getStatus();
- if (status.isOK()) {
- setErrorMessage(null);
- } else {
- setErrorMessage(status.getChildren()[0].getMessage());
- }
- return true;
- }
-
- private final class CreateCombinedFile extends AbstractOperation {
- private final List<LinkNode> dependencyData;
-
- public CreateCombinedFile(List<LinkNode> dependencyData) {
- super("Create combined file", Activator.PLUGIN_ID);
- this.dependencyData = dependencyData;
- }
-
- private void loadMap(LinkNode node, Map<String, URL> map) throws MalformedURLException {
- for (LinkNode child : node.getChildren()) {
- loadMap(child, map);
- }
- String path = node.getUri().toString();
- map.put(path, new URL(node.getUri().toString()));
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Map<String, URL> resolvedEntries = new LinkedHashMap<String, URL>();
- for (LinkNode node : dependencyData) {
- loadMap(node, resolvedEntries);
- }
- File file = oseeTypesSetup.createCombinedFile(resolvedEntries);
- setCompositeFile(file);
- }
- }
+ private static final String PAGE_NAME =
+ "org.eclipse.osee.framework.core.dsl.ui.integration.wizards.OseeTypesImportPage";
+
+ private final OseeTypesSetup oseeTypesSetup;
+ private File compositeFile;
+ private final IStructuredSelection selection;
+ private TreeViewer linksViewer;
+ private final SelectOseeTypesPanel oseeTypesPanel;
+ private final List<LinkNode> messages;
+ private Button reportChanges;
+ private Button persistChanges;
+ private Button useCompareEditor;
+
+ protected OseeTypesImportPage(IStructuredSelection selection, String title) {
+ super(PAGE_NAME);
+ this.selection = selection;
+ oseeTypesSetup = new OseeTypesSetup();
+ oseeTypesPanel = new SelectOseeTypesPanel();
+ oseeTypesPanel.setDefaultItem(getPreselected());
+ setTitle(title);
+ setDescription("Select *.osee files to import");
+ messages = new ArrayList<LinkNode>();
+ }
+
+ private List<IFile> getPreselected() {
+ List<IFile> resources = new ArrayList<IFile>();
+ if (selection != null) {
+ Iterator<?> iterator = selection.iterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object instanceof IFile) {
+ IFile file = (IFile) object;
+ if (file.getFileExtension().equals("osee")) {
+ resources.add(file);
+ }
+ }
+ }
+ }
+ return resources;
+ }
+
+ @Override
+ protected boolean allowNewContainerName() {
+ return false;
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ updateWidgetEnablements();
+ updateExtractedElements();
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setFont(parent.getFont());
+
+ oseeTypesPanel.createControl(composite);
+ oseeTypesPanel.addListener(this);
+
+ Label sectionTitle = new Label(composite, SWT.NONE);
+ sectionTitle.setText("Resolved dependencies:");
+ sectionTitle.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, true, false));
+
+ linksViewer = new TreeViewer(composite, SWT.BORDER);
+ linksViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ linksViewer.setContentProvider(new LinkNodeContentProvider());
+ linksViewer.setLabelProvider(new LinkNodeLabelProvider());
+ linksViewer.setInput(messages);
+
+ createOptions(composite);
+
+ restoreWidgetValues();
+ updateWidgetEnablements();
+ updateExtractedElements();
+ setPageComplete(determinePageCompletion());
+ setControl(composite);
+ }
+
+ private void createOptions(Composite parent) {
+ Group composite = new Group(parent, SWT.NULL);
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setFont(parent.getFont());
+ composite.setText("Options");
+
+ reportChanges = new Button(composite, SWT.CHECK);
+ reportChanges.setText("Report Changes");
+ reportChanges.setSelection(true);
+
+ useCompareEditor = new Button(composite, SWT.CHECK);
+ useCompareEditor.setText("Use Compare Editor");
+ useCompareEditor.setSelection(false);
+
+ persistChanges = new Button(composite, SWT.CHECK);
+ persistChanges.setText("Persist Changes");
+ persistChanges.setSelection(false);
+ }
+
+ public boolean isPersistAllowed() {
+ return persistChanges.getSelection();
+ }
+
+ public boolean isReportChanges() {
+ return reportChanges.getSelection();
+ }
+
+ public boolean useCompareEditor() {
+ return useCompareEditor.getSelection();
+ }
+
+ public File getTypesToImport() {
+ return compositeFile != null ? compositeFile : null;
+ }
+
+ private void setCompositeFile(File compositeFile) {
+ this.compositeFile = compositeFile;
+ }
+
+ @Override
+ protected boolean validateSourceGroup() {
+ return oseeTypesPanel.getSelected() != null;
+ }
+
+ @Override
+ protected boolean validateDestinationGroup() {
+ return getTypesToImport() != null;
+ }
+
+ private synchronized void updateExtractedElements() {
+ if (oseeTypesPanel.getSelected() != null) {
+ setErrorMessage(null);
+ File file = getTypesToImport();
+ if (file != null) {
+ file.delete();
+ setCompositeFile(null);
+ }
+ OseeLog.log(Activator.class, Level.INFO, "Resolving imports");
+
+ final List<IFile> selectedFiles = new ArrayList<IFile>(oseeTypesPanel.getSelected());
+ final List<LinkNode> dependencyData = new ArrayList<LinkNode>();
+
+ Collection<IOperation> ops = new ArrayList<IOperation>();
+ ops.add(new ResolveImportsOperation(new ClassloaderClasspathUriResolver(), selectedFiles, dependencyData));
+ ops.add(new CreateCombinedFile(dependencyData));
+ if (executeOperation(new CompositeOperation("Resolving imports", Activator.PLUGIN_ID, ops))) {
+ messages.clear();
+ messages.addAll(dependencyData);
+ linksViewer.refresh();
+ setPageComplete(determinePageCompletion());
+ }
+ }
+ }
+
+ protected boolean executeOperation(final IOperation operation) {
+ try {
+ getContainer().run(true, true, new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor) {
+ Operations.executeWork(operation, monitor, -1);
+ }
+ });
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ displayErrorDialog(e.getTargetException());
+ return false;
+ }
+
+ IStatus status = operation.getStatus();
+ if (status.isOK()) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(status.getChildren()[0].getMessage());
+ }
+ return true;
+ }
+
+ private final class CreateCombinedFile extends AbstractOperation {
+ private final List<LinkNode> dependencyData;
+
+ public CreateCombinedFile(List<LinkNode> dependencyData) {
+ super("Create combined file", Activator.PLUGIN_ID);
+ this.dependencyData = dependencyData;
+ }
+
+ private void loadMap(LinkNode node, Map<String, URL> map) throws MalformedURLException {
+ for (LinkNode child : node.getChildren()) {
+ loadMap(child, map);
+ }
+ String path = node.getUri().toString();
+ map.put(path, new URL(node.getUri().toString()));
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ Map<String, URL> resolvedEntries = new LinkedHashMap<String, URL>();
+ for (LinkNode node : dependencyData) {
+ loadMap(node, resolvedEntries);
+ }
+ File file = oseeTypesSetup.createCombinedFile(resolvedEntries);
+ setCompositeFile(file);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportWizard.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportWizard.java
index 652de0ddfd..bcf267b227 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportWizard.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesImportWizard.java
@@ -29,43 +29,43 @@ import org.eclipse.ui.IWorkbench;
* @author Roberto E. Escobar
*/
public class OseeTypesImportWizard extends Wizard implements IImportWizard {
- private OseeTypesImportPage mainPage;
+ private OseeTypesImportPage mainPage;
- public OseeTypesImportWizard() {
- super();
- setDialogSettings(SkynetGuiPlugin.getInstance().getDialogSettings());
- setWindowTitle("OSEE Types Import Wizard");
- setNeedsProgressMonitor(true);
- setHelpAvailable(true);
- }
+ public OseeTypesImportWizard() {
+ super();
+ setDialogSettings(SkynetGuiPlugin.getInstance().getDialogSettings());
+ setWindowTitle("OSEE Types Import Wizard");
+ setNeedsProgressMonitor(true);
+ setHelpAvailable(true);
+ }
- @Override
- public boolean performFinish() {
- final File file = mainPage.getTypesToImport();
- boolean isReport = mainPage.isReportChanges();
- boolean useCompareEditor = mainPage.useCompareEditor();
- boolean isPersistAllowed = mainPage.isPersistAllowed();
+ @Override
+ public boolean performFinish() {
+ final File file = mainPage.getTypesToImport();
+ boolean isReport = mainPage.isReportChanges();
+ boolean useCompareEditor = mainPage.useCompareEditor();
+ boolean isPersistAllowed = mainPage.isPersistAllowed();
- IOseeCachingService cacheService = Activator.getOseeCacheService();
- IOperation operation =
- new OseeTypesImportOperation(cacheService, file.toURI(), isReport, useCompareEditor, isPersistAllowed);
- Job job = Operations.executeAsJob(operation, true);
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- file.delete();
- }
- });
- return true;
- }
+ IOseeCachingService cacheService = Activator.getOseeCacheService();
+ IOperation operation =
+ new OseeTypesImportOperation(cacheService, file.toURI(), isReport, useCompareEditor, isPersistAllowed);
+ Job job = Operations.executeAsJob(operation, true);
+ job.addJobChangeListener(new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ file.delete();
+ }
+ });
+ return true;
+ }
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- mainPage = new OseeTypesImportPage(selection, getWindowTitle());
- }
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ mainPage = new OseeTypesImportPage(selection, getWindowTitle());
+ }
- @Override
- public void addPages() {
- addPage(mainPage);
- }
+ @Override
+ public void addPages() {
+ addPage(mainPage);
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesViewerFilter.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesViewerFilter.java
index cf7d491af0..1604076be5 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesViewerFilter.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/OseeTypesViewerFilter.java
@@ -28,46 +28,46 @@ import org.eclipse.osee.framework.logging.OseeLog;
*/
public class OseeTypesViewerFilter extends ViewerFilter {
- private boolean processIFile(Object resource) {
- boolean toReturn = false;
- if (resource instanceof IFile) {
- IFile aFile = (IFile) resource;
- String currentExtension = aFile.getFileExtension();
- if (currentExtension.equalsIgnoreCase("osee")) {
- toReturn = true;
- }
- }
- return toReturn;
- }
+ private boolean processIFile(Object resource) {
+ boolean toReturn = false;
+ if (resource instanceof IFile) {
+ IFile aFile = (IFile) resource;
+ String currentExtension = aFile.getFileExtension();
+ if (currentExtension.equalsIgnoreCase("osee")) {
+ toReturn = true;
+ }
+ }
+ return toReturn;
+ }
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof IProject) {
- if (((IProject) element).isOpen()) {
- return true;
- }
- } else if (element instanceof IContainer) {
- IContainer container = (IContainer) element;
- String name = container.getName();
- if (!name.startsWith(".") && !name.equals("osee")) {
- final MutableBoolean mutable = new MutableBoolean(false);
- try {
- container.accept(new IResourceVisitor() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IProject) {
+ if (((IProject) element).isOpen()) {
+ return true;
+ }
+ } else if (element instanceof IContainer) {
+ IContainer container = (IContainer) element;
+ String name = container.getName();
+ if (!name.startsWith(".") && !name.equals("osee")) {
+ final MutableBoolean mutable = new MutableBoolean(false);
+ try {
+ container.accept(new IResourceVisitor() {
- @Override
- public boolean visit(IResource resource) {
- mutable.setValue(processIFile(resource));
- return mutable.getValue();
- }
- }, IResource.DEPTH_INFINITE, true);
- } catch (CoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return mutable.getValue();
- }
- } else {
- return processIFile(element);
- }
- return false;
- }
+ @Override
+ public boolean visit(IResource resource) {
+ mutable.setValue(processIFile(resource));
+ return mutable.getValue();
+ }
+ }, IResource.DEPTH_INFINITE, true);
+ } catch (CoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return mutable.getValue();
+ }
+ } else {
+ return processIFile(element);
+ }
+ return false;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/ResourceSelectionPage.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/ResourceSelectionPage.java
index 94e7a955c7..a8e6305fee 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/ResourceSelectionPage.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/ResourceSelectionPage.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.framework.core.dsl.ui.integration.wizards;
import java.io.File;
-
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.ui.ws.AWorkspace;
import org.eclipse.swt.SWT;
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/SelectOseeTypesPanel.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/SelectOseeTypesPanel.java
index 1525e12f0e..d7e0364bc7 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/SelectOseeTypesPanel.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/wizards/SelectOseeTypesPanel.java
@@ -31,62 +31,62 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
*/
public class SelectOseeTypesPanel extends AbstractItemSelectPanel<List<IFile>> {
- public SelectOseeTypesPanel() {
- super(new WorkbenchLabelProvider(), new ArrayContentProvider());
- }
+ public SelectOseeTypesPanel() {
+ super(new WorkbenchLabelProvider(), new ArrayContentProvider());
+ }
- @Override
- protected Dialog createSelectDialog(Shell shell, List<IFile> lastSelected) {
- CheckedTreeSelectionDialog dialog =
- new CheckedTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.addFilter(new OseeTypesViewerFilter());
- dialog.setTitle("Select OseeTypes to import");
- dialog.setValidator(new Validator());
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- if (lastSelected != null) {
- dialog.setInitialElementSelections(lastSelected);
- }
- return dialog;
- }
+ @Override
+ protected Dialog createSelectDialog(Shell shell, List<IFile> lastSelected) {
+ CheckedTreeSelectionDialog dialog =
+ new CheckedTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.addFilter(new OseeTypesViewerFilter());
+ dialog.setTitle("Select OseeTypes to import");
+ dialog.setValidator(new Validator());
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ if (lastSelected != null) {
+ dialog.setInitialElementSelections(lastSelected);
+ }
+ return dialog;
+ }
- @Override
- protected boolean updateFromDialogResult(Dialog dialog) {
- boolean updateRequired = false;
- if (dialog instanceof CheckedTreeSelectionDialog) {
- Object[] results = ((CheckedTreeSelectionDialog) dialog).getResult();
- if (results != null && results.length > 0) {
- List<IFile> selected = new ArrayList<IFile>();
- for (Object object : results) {
- if (object instanceof IFile) {
- selected.add((IFile) object);
- }
- }
- if (!selected.isEmpty()) {
- setSelected(selected);
- updateRequired = true;
- }
- }
- }
- return updateRequired;
- }
+ @Override
+ protected boolean updateFromDialogResult(Dialog dialog) {
+ boolean updateRequired = false;
+ if (dialog instanceof CheckedTreeSelectionDialog) {
+ Object[] results = ((CheckedTreeSelectionDialog) dialog).getResult();
+ if (results != null && results.length > 0) {
+ List<IFile> selected = new ArrayList<IFile>();
+ for (Object object : results) {
+ if (object instanceof IFile) {
+ selected.add((IFile) object);
+ }
+ }
+ if (!selected.isEmpty()) {
+ setSelected(selected);
+ updateRequired = true;
+ }
+ }
+ }
+ return updateRequired;
+ }
- private final class Validator implements ISelectionStatusValidator {
- @Override
- public IStatus validate(Object[] selection) {
- IStatus status = Status.OK_STATUS;
- boolean found = false;
- if (selection != null) {
- for (Object object : selection) {
- if (object instanceof IFile) {
- found = true;
- break;
- }
- }
- }
- if (!found) {
- status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "At least (1) must be selected");
- }
- return status;
- }
- }
+ private final class Validator implements ISelectionStatusValidator {
+ @Override
+ public IStatus validate(Object[] selection) {
+ IStatus status = Status.OK_STATUS;
+ boolean found = false;
+ if (selection != null) {
+ for (Object object : selection) {
+ if (object instanceof IFile) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "At least (1) must be selected");
+ }
+ return status;
+ }
+ }
} \ No newline at end of file

Back to the top