Skip to content

Commit

Permalink
Merge pull request #5 from arsysop/4-1
Browse files Browse the repository at this point in the history
Improve Decl domain to cover vector example #4
  • Loading branch information
ruspl-afed authored Jan 30, 2022
2 parents 4afe831 + 73a1d9a commit 5b0f853
Show file tree
Hide file tree
Showing 18 changed files with 1,123 additions and 46 deletions.
6 changes: 5 additions & 1 deletion bundles/ru.arsysop.loft.cast.decl.ecore/model/decl.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ClassTemplateDecl" eSuperTypes="#//NamedDecl">
<eStructuralFeatures xsi:type="ecore:EReference" name="methods" upperBound="-1"
eType="#//FunctionDecl"/>
eType="#//CxxMethodTemplateDecl" containment="true" eOpposite="#//CxxMethodTemplateDecl/classTemplate"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="CxxMethodTemplateDecl" eSuperTypes="#//NamedDecl">
<eStructuralFeatures xsi:type="ecore:EReference" name="classTemplate" lowerBound="1"
eType="#//ClassTemplateDecl" eOpposite="#//ClassTemplateDecl/methods"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FunctionDecl" eSuperTypes="#//NamedDecl"/>
</ecore:EPackage>
425 changes: 417 additions & 8 deletions bundles/ru.arsysop.loft.cast.decl.ecore/representations.aird

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion bundles/ru.arsysop.loft.cast.decl.edit/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ Export-Package: ru.arsysop.loft.cast.decl.edit,
ru.arsysop.loft.cast.decl.edit.providers
Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0",
org.eclipse.emf.ecore.edit;bundle-version="0.0.0",
ru.arsysop.loft.cast.decl.model;bundle-version="0.1.0"
ru.arsysop.loft.cast.decl.model;bundle-version="0.1.0";visibility:=reexport,
org.eclipse.emf.edit;visibility:=reexport
Bundle-ActivationPolicy: lazy
2 changes: 2 additions & 0 deletions bundles/ru.arsysop.loft.cast.decl.edit/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ _UI_NamedDecl_name_feature = Name
_UI_TranslationUnitDecl_declarations_feature = Declarations
_UI_NamespaceDecl_declarations_feature = Declarations
_UI_ClassTemplateDecl_methods_feature = Methods
_UI_CxxMethodTemplateDecl_type = Cxx Method Template Decl
_UI_CxxMethodTemplateDecl_classTemplate_feature = Class Template
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.eclipse.emf.common.util.ResourceLocator;

/**
* This is the central singleton for the Cast edit plugin.
* This is the central singleton for the Decl edit plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/**
* Copyright (c) 2022 ArSysOp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* SPDX-License-Identifier: Apache-2.0
* Contributors:
* ArSysOp - initial API and implementation
*
*/
package ru.arsysop.loft.cast.decl.edit.providers;


import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.StyledString;

import ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl;

/**
* This is the item provider adapter for a {@link ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class CxxMethodTemplateDeclItemProvider extends NamedDeclItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CxxMethodTemplateDeclItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}

/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);

}
return itemPropertyDescriptors;
}

/**
* @generated NOT
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, EcoreEditPlugin.INSTANCE.getImage("full/obj16/EObject")); //$NON-NLS-1$
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean shouldComposeCreationImage() {
return true;
}

/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
return ((StyledString)getStyledText(object)).getString();
}

/**
* This returns the label styled text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getStyledText(Object object) {
String label = ((CxxMethodTemplateDecl)object).getName();
StyledString styledLabel = new StyledString();
if (label == null || label.length() == 0) {
styledLabel.append(getString("_UI_CxxMethodTemplateDecl_type"), StyledString.Style.QUALIFIER_STYLER); //$NON-NLS-1$
} else {
styledLabel.append(getString("_UI_CxxMethodTemplateDecl_type"), StyledString.Style.QUALIFIER_STYLER).append(" " + label); //$NON-NLS-1$ //$NON-NLS-2$
}
return styledLabel;
}

/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
}

/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,29 @@ public Adapter createClassTemplateDeclAdapter() {
return classTemplateDeclItemProvider;
}

/**
* This keeps track of the one adapter used for all {@link ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CxxMethodTemplateDeclItemProvider cxxMethodTemplateDeclItemProvider;

/**
* This creates an adapter for a {@link ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createCxxMethodTemplateDeclAdapter() {
if (cxxMethodTemplateDeclItemProvider == null) {
cxxMethodTemplateDeclItemProvider = new CxxMethodTemplateDeclItemProvider(this);
}

return cxxMethodTemplateDeclItemProvider;
}

/**
* This keeps track of the one adapter used for all {@link ru.arsysop.loft.cast.decl.model.api.FunctionDecl} instances.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -343,6 +366,7 @@ public void dispose() {
if (translationUnitDeclItemProvider != null) translationUnitDeclItemProvider.dispose();
if (namespaceDeclItemProvider != null) namespaceDeclItemProvider.dispose();
if (classTemplateDeclItemProvider != null) classTemplateDeclItemProvider.dispose();
if (cxxMethodTemplateDeclItemProvider != null) cxxMethodTemplateDeclItemProvider.dispose();
if (functionDeclItemProvider != null) functionDeclItemProvider.dispose();
}

Expand Down
3 changes: 3 additions & 0 deletions bundles/ru.arsysop.loft.cast.decl.model/model/decl.genmodel
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<genClasses image="false" ecoreClass="../../ru.arsysop.loft.cast.decl.ecore/model/decl.ecore#//ClassTemplateDecl">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference ../../ru.arsysop.loft.cast.decl.ecore/model/decl.ecore#//ClassTemplateDecl/methods"/>
</genClasses>
<genClasses image="false" ecoreClass="../../ru.arsysop.loft.cast.decl.ecore/model/decl.ecore#//CxxMethodTemplateDecl">
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference ../../ru.arsysop.loft.cast.decl.ecore/model/decl.ecore#//CxxMethodTemplateDecl/classTemplate"/>
</genClasses>
<genClasses image="false" ecoreClass="../../ru.arsysop.loft.cast.decl.ecore/model/decl.ecore#//FunctionDecl"/>
</genPackages>
</genmodel:GenModel>
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@
*/
public interface ClassTemplateDecl extends NamedDecl {
/**
* Returns the value of the '<em><b>Methods</b></em>' reference list.
* The list contents are of type {@link ru.arsysop.loft.cast.decl.model.api.FunctionDecl}.
* Returns the value of the '<em><b>Methods</b></em>' containment reference list.
* The list contents are of type {@link ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl}.
* It is bidirectional and its opposite is '{@link ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl#getClassTemplate <em>Class Template</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Methods</em>' reference list.
* @return the value of the '<em>Methods</em>' containment reference list.
* @see ru.arsysop.loft.cast.decl.model.meta.DeclPackage#getClassTemplateDecl_Methods()
* @model
* @see ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl#getClassTemplate
* @model opposite="classTemplate" containment="true"
* @generated
*/
EList<FunctionDecl> getMethods();
EList<CxxMethodTemplateDecl> getMethods();

} // ClassTemplateDecl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright (c) 2022 ArSysOp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* SPDX-License-Identifier: Apache-2.0
* Contributors:
* ArSysOp - initial API and implementation
*
*/
package ru.arsysop.loft.cast.decl.model.api;


/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Cxx Method Template Decl</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl#getClassTemplate <em>Class Template</em>}</li>
* </ul>
*
* @see ru.arsysop.loft.cast.decl.model.meta.DeclPackage#getCxxMethodTemplateDecl()
* @model
* @generated
*/
public interface CxxMethodTemplateDecl extends NamedDecl {
/**
* Returns the value of the '<em><b>Class Template</b></em>' container reference.
* It is bidirectional and its opposite is '{@link ru.arsysop.loft.cast.decl.model.api.ClassTemplateDecl#getMethods <em>Methods</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Class Template</em>' container reference.
* @see #setClassTemplate(ClassTemplateDecl)
* @see ru.arsysop.loft.cast.decl.model.meta.DeclPackage#getCxxMethodTemplateDecl_ClassTemplate()
* @see ru.arsysop.loft.cast.decl.model.api.ClassTemplateDecl#getMethods
* @model opposite="methods" required="true" transient="false"
* @generated
*/
ClassTemplateDecl getClassTemplate();

/**
* Sets the value of the '{@link ru.arsysop.loft.cast.decl.model.api.CxxMethodTemplateDecl#getClassTemplate <em>Class Template</em>}' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Class Template</em>' container reference.
* @see #getClassTemplate()
* @generated
*/
void setClassTemplate(ClassTemplateDecl value);

} // CxxMethodTemplateDecl
Loading

0 comments on commit 5b0f853

Please sign in to comment.