diff options
author | Ed Willink | 2016-02-09 10:47:37 +0000 |
---|---|---|
committer | Ed Willink | 2016-02-09 11:43:30 +0000 |
commit | 8c3867b58bdb125dd2a7f0be082e0ced2134cd5b (patch) | |
tree | d6fd718754206ccbadd1eb38306aad8d05b2dd3f | |
parent | 299f60653f9f287785e419d6a31324580eac5c0e (diff) | |
download | org.eclipse.qvtd-8c3867b58bdb125dd2a7f0be082e0ced2134cd5b.tar.gz org.eclipse.qvtd-8c3867b58bdb125dd2a7f0be082e0ced2134cd5b.tar.xz org.eclipse.qvtd-8c3867b58bdb125dd2a7f0be082e0ced2134cd5b.zip |
[unrelated] Add missing QVTc/QVTr facades
7 files changed, 170 insertions, 2 deletions
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcore/META-INF/MANIFEST.MF b/plugins/org.eclipse.qvtd.pivot.qvtcore/META-INF/MANIFEST.MF index d3290ed5b..3ed196b79 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtcore/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.qvtd.pivot.qvtcore/META-INF/MANIFEST.MF @@ -13,7 +13,8 @@ Export-Package: org.eclipse.qvtd.pivot.qvtcore, org.eclipse.qvtd.pivot.qvtcore.scoping, org.eclipse.qvtd.pivot.qvtcore.util, org.eclipse.qvtd.pivot.qvtcore.utilities -Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", +Require-Bundle: org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)", + org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", org.eclipse.qvtd.pivot.qvtcorebase;bundle-version="[0.13.0,0.14.0)";visibility:=reexport Bundle-ActivationPolicy: lazy Import-Package: com.google.inject diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcore/src/org/eclipse/qvtd/pivot/qvtcore/utilities/QVTcEnvironmentFactory.java b/plugins/org.eclipse.qvtd.pivot.qvtcore/src/org/eclipse/qvtd/pivot/qvtcore/utilities/QVTcEnvironmentFactory.java new file mode 100644 index 000000000..3f8e222d2 --- /dev/null +++ b/plugins/org.eclipse.qvtd.pivot.qvtcore/src/org/eclipse/qvtd/pivot/qvtcore/utilities/QVTcEnvironmentFactory.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2016 Willink Transformations and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * E.D.Willink - initial API and implementation + ******************************************************************************/ +package org.eclipse.qvtd.pivot.qvtcore.utilities; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.eclipse.ocl.pivot.Type; +import org.eclipse.ocl.pivot.internal.manager.TemplateParameterSubstitutionVisitor; +import org.eclipse.ocl.pivot.resource.ProjectManager; +import org.eclipse.qvtd.pivot.qvtbase.model.QVTbaseLibrary; +import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseEnvironmentFactory; + +public class QVTcEnvironmentFactory extends QVTbaseEnvironmentFactory +{ + public QVTcEnvironmentFactory(@NonNull ProjectManager projectMap, @Nullable ResourceSet externalResourceSet) { + super(projectMap, externalResourceSet); + getStandardLibrary().setDefaultStandardLibraryURI(QVTbaseLibrary.STDLIB_URI); + } + + @Override + public @NonNull TemplateParameterSubstitutionVisitor createTemplateParameterSubstitutionVisitor( + @Nullable Type selfType, @Nullable Type selfTypeValue) { + return new QVTcoreTemplateParameterSubstitutionVisitor(this, selfType, selfTypeValue); + } + + public boolean keepDebug() { + return false; + } +} diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcore/src/org/eclipse/qvtd/pivot/qvtcore/utilities/QVTcore.java b/plugins/org.eclipse.qvtd.pivot.qvtcore/src/org/eclipse/qvtd/pivot/qvtcore/utilities/QVTcore.java new file mode 100644 index 000000000..2fc43a23a --- /dev/null +++ b/plugins/org.eclipse.qvtd.pivot.qvtcore/src/org/eclipse/qvtd/pivot/qvtcore/utilities/QVTcore.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2016 Willink Transformations and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * E.D.Willink - initial API and implementation + *******************************************************************************/ +package org.eclipse.qvtd.pivot.qvtcore.utilities; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.eclipse.ocl.pivot.resource.ProjectManager; +import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbase; + +/** + * The QVTcore facade refines the QVTbase and OCL facades to enforce use of the QVTbase Standard Library. + */ +public class QVTcore extends QVTbase +{ + public static @NonNull QVTcore newInstance(@NonNull ProjectManager projectManager, @Nullable ResourceSet externalResourceSet) { + QVTcEnvironmentFactory environmentFactory = new QVTcEnvironmentFactory(projectManager, externalResourceSet); + QVTcore qvt = new QVTcore(environmentFactory); + if (externalResourceSet != null) { + environmentFactory.adapt(externalResourceSet); + } + return qvt; + } + + public QVTcore(@NonNull QVTcEnvironmentFactory environmentFactory) { + super(environmentFactory); + } + + @Override + public @NonNull QVTcEnvironmentFactory getEnvironmentFactory() { + return (QVTcEnvironmentFactory) super.getEnvironmentFactory(); + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.pivot.qvtrelation/META-INF/MANIFEST.MF b/plugins/org.eclipse.qvtd.pivot.qvtrelation/META-INF/MANIFEST.MF index 1af905b30..2ac84d19c 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtrelation/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.qvtd.pivot.qvtrelation/META-INF/MANIFEST.MF @@ -13,7 +13,8 @@ Export-Package: org.eclipse.qvtd.pivot.qvtrelation, org.eclipse.qvtd.pivot.qvtrelation.scoping, org.eclipse.qvtd.pivot.qvtrelation.util, org.eclipse.qvtd.pivot.qvtrelation.utilities -Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", +Require-Bundle: org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)", + org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", org.eclipse.qvtd.pivot.qvttemplate;bundle-version="[0.13.0,0.14.0)";visibility:=reexport Bundle-ActivationPolicy: lazy Import-Package: com.google.inject diff --git a/plugins/org.eclipse.qvtd.pivot.qvtrelation/src/org/eclipse/qvtd/pivot/qvtrelation/utilities/QVTrEnvironmentFactory.java b/plugins/org.eclipse.qvtd.pivot.qvtrelation/src/org/eclipse/qvtd/pivot/qvtrelation/utilities/QVTrEnvironmentFactory.java new file mode 100644 index 000000000..ee1abf25a --- /dev/null +++ b/plugins/org.eclipse.qvtd.pivot.qvtrelation/src/org/eclipse/qvtd/pivot/qvtrelation/utilities/QVTrEnvironmentFactory.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2016 Willink Transformations and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * E.D.Willink - initial API and implementation + ******************************************************************************/ +package org.eclipse.qvtd.pivot.qvtrelation.utilities; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.eclipse.ocl.pivot.Type; +import org.eclipse.ocl.pivot.internal.manager.TemplateParameterSubstitutionVisitor; +import org.eclipse.ocl.pivot.resource.ProjectManager; +import org.eclipse.qvtd.pivot.qvtbase.model.QVTbaseLibrary; +import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseEnvironmentFactory; + +public class QVTrEnvironmentFactory extends QVTbaseEnvironmentFactory +{ + public QVTrEnvironmentFactory(@NonNull ProjectManager projectMap, @Nullable ResourceSet externalResourceSet) { + super(projectMap, externalResourceSet); + getStandardLibrary().setDefaultStandardLibraryURI(QVTbaseLibrary.STDLIB_URI); + } + + @Override + public @NonNull TemplateParameterSubstitutionVisitor createTemplateParameterSubstitutionVisitor( + @Nullable Type selfType, @Nullable Type selfTypeValue) { + return new QVTrelationTemplateParameterSubstitutionVisitor(this, selfType, selfTypeValue); + } + + public boolean keepDebug() { + return false; + } +} diff --git a/plugins/org.eclipse.qvtd.pivot.qvtrelation/src/org/eclipse/qvtd/pivot/qvtrelation/utilities/QVTrelation.java b/plugins/org.eclipse.qvtd.pivot.qvtrelation/src/org/eclipse/qvtd/pivot/qvtrelation/utilities/QVTrelation.java new file mode 100644 index 000000000..577cf1dba --- /dev/null +++ b/plugins/org.eclipse.qvtd.pivot.qvtrelation/src/org/eclipse/qvtd/pivot/qvtrelation/utilities/QVTrelation.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2016 Willink Transformations and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * E.D.Willink - initial API and implementation + *******************************************************************************/ +package org.eclipse.qvtd.pivot.qvtrelation.utilities; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.eclipse.ocl.pivot.resource.ProjectManager; +import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbase; + +/** + * The QVTcore facade refines the QVTbase and OCL facades to enforce use of the QVTbase Standard Library. + */ +public class QVTrelation extends QVTbase +{ + public static @NonNull QVTrelation newInstance(@NonNull ProjectManager projectManager, @Nullable ResourceSet externalResourceSet) { + QVTrEnvironmentFactory environmentFactory = new QVTrEnvironmentFactory(projectManager, externalResourceSet); + QVTrelation qvt = new QVTrelation(environmentFactory); + if (externalResourceSet != null) { + environmentFactory.adapt(externalResourceSet); + } + return qvt; + } + + public QVTrelation(@NonNull QVTrEnvironmentFactory environmentFactory) { + super(environmentFactory); + } + + @Override + public @NonNull QVTrEnvironmentFactory getEnvironmentFactory() { + return (QVTrEnvironmentFactory) super.getEnvironmentFactory(); + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.qvtd.xtext.qvtcore.ui/src/org/eclipse/qvtd/xtext/qvtcore/ui/model/QVTcoreDocumentProvider.java b/plugins/org.eclipse.qvtd.xtext.qvtcore.ui/src/org/eclipse/qvtd/xtext/qvtcore/ui/model/QVTcoreDocumentProvider.java index 301ecd343..ebe4026ac 100644 --- a/plugins/org.eclipse.qvtd.xtext.qvtcore.ui/src/org/eclipse/qvtd/xtext/qvtcore/ui/model/QVTcoreDocumentProvider.java +++ b/plugins/org.eclipse.qvtd.xtext.qvtcore.ui/src/org/eclipse/qvtd/xtext/qvtcore/ui/model/QVTcoreDocumentProvider.java @@ -12,7 +12,10 @@ package org.eclipse.qvtd.xtext.qvtcore.ui.model; import org.eclipse.emf.common.util.URI; import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.ocl.pivot.internal.utilities.OCLInternal; +import org.eclipse.ocl.pivot.resource.BasicProjectManager; import org.eclipse.ocl.xtext.base.ui.model.BaseCSorASDocumentProvider; +import org.eclipse.qvtd.pivot.qvtcore.utilities.QVTcore; import org.eclipse.qvtd.xtext.qvtcorecs.QVTcoreCSPackage; /** @@ -22,6 +25,11 @@ import org.eclipse.qvtd.xtext.qvtcorecs.QVTcoreCSPackage; public class QVTcoreDocumentProvider extends BaseCSorASDocumentProvider { @Override + protected @NonNull OCLInternal createOCL() { + return QVTcore.newInstance(BasicProjectManager.createDefaultProjectManager(), null); + } + + @Override protected @NonNull String createTestDocument(@NonNull URI uri, @NonNull String lastSegment) { return ""; } |