Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the definition of subsystems and the creation of systems from existing launch files #211

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions plugins/de.fraunhofer.ipa.rossystem.edit/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,6 @@ _UI_RosActionConnection_from_feature = From
_UI_RosActionConnection_to_feature = To
_UI_RosServiceClientReference_type = Ros Service Client Reference
_UI_RosServiceClientReference_from_feature = From
_UI_System_fromFile_feature = From File
_UI_SubSystem_type = Sub System
_UI_SubSystem_system_feature = System
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,29 @@ public Adapter createRosActionConnectionAdapter() {
}

/**
* This keeps track of the one adapter used for all {@link system.SubSystem} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SubSystemItemProvider subSystemItemProvider;

/**
* This creates an adapter for a {@link system.SubSystem}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createSubSystemAdapter() {
if (subSystemItemProvider == null) {
subSystemItemProvider = new SubSystemItemProvider(this);
}

return subSystemItemProvider;
}

/**
* This returns the root adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down Expand Up @@ -632,6 +655,7 @@ public void dispose() {
if (rosTopicConnectionItemProvider != null) rosTopicConnectionItemProvider.dispose();
if (rosServiceConnectionItemProvider != null) rosServiceConnectionItemProvider.dispose();
if (rosActionConnectionItemProvider != null) rosActionConnectionItemProvider.dispose();
if (subSystemItemProvider != null) subSystemItemProvider.dispose();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/**
*/
package system.provider;


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.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;

import system.RossystemPackage;

/**
* This is the item provider adapter for a {@link system.SubSystem} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class SubSystemItemProvider extends ComponentItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SubSystemItemProvider(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);

addSystemPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}

/**
* This adds a property descriptor for the System feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addSystemPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SubSystem_system_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_SubSystem_system_feature", "_UI_SubSystem_type"),
RossystemPackage.Literals.SUB_SYSTEM__SYSTEM,
true,
false,
true,
null,
null,
null));
}

/**
* This returns SubSystem.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/SubSystem"));
}

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


/**
* 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 @@ -8,20 +8,11 @@

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.ecore.EStructuralFeature;

import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import ros.RosFactory;
import system.RossystemFactory;
Expand All @@ -34,13 +25,7 @@
* @generated
*/
public class SystemItemProvider
extends ItemProviderAdapter
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
extends ComponentItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
Expand All @@ -63,6 +48,7 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
super.getPropertyDescriptors(object);

addNamePropertyDescriptor(object);
addFromFilePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
Expand Down Expand Up @@ -90,6 +76,28 @@ protected void addNamePropertyDescriptor(Object object) {
}

/**
* This adds a property descriptor for the From File feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addFromFilePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_System_fromFile_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_System_fromFile_feature", "_UI_System_type"),
RossystemPackage.Literals.SYSTEM__FROM_FILE,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}

/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
Expand Down Expand Up @@ -161,6 +169,7 @@ public void notifyChanged(Notification notification) {

switch (notification.getFeatureID(system.System.class)) {
case RossystemPackage.SYSTEM__NAME:
case RossystemPackage.SYSTEM__FROM_FILE:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case RossystemPackage.SYSTEM__PROCESSES:
Expand Down Expand Up @@ -189,11 +198,26 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
(RossystemPackage.Literals.SYSTEM__PROCESSES,
RossystemFactory.eINSTANCE.createProcess()));

newChildDescriptors.add
(createChildParameter
(RossystemPackage.Literals.SYSTEM__COMPONENTS,
RossystemFactory.eINSTANCE.createSystem()));

newChildDescriptors.add
(createChildParameter
(RossystemPackage.Literals.SYSTEM__COMPONENTS,
RossystemFactory.eINSTANCE.createRossystem()));

newChildDescriptors.add
(createChildParameter
(RossystemPackage.Literals.SYSTEM__COMPONENTS,
RossystemFactory.eINSTANCE.createRosNode()));

newChildDescriptors.add
(createChildParameter
(RossystemPackage.Literals.SYSTEM__COMPONENTS,
RossystemFactory.eINSTANCE.createSubSystem()));

newChildDescriptors.add
(createChildParameter
(RossystemPackage.Literals.SYSTEM__CONNECTIONS,
Expand Down Expand Up @@ -225,15 +249,4 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
RosFactory.eINSTANCE.createParameter()));
}

/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return RossystemEditPlugin.INSTANCE;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public String getRuleName(AbstractElement element) {
}

private static void init(ImmutableMap.Builder<AbstractElement, String> builder, RosSystemGrammarAccess grammarAccess) {
builder.put(grammarAccess.getRosSystemAccess().getAlternatives_3(), "rule__RosSystem__Alternatives_3");
builder.put(grammarAccess.getRosSystemAccess().getAlternatives_4(), "rule__RosSystem__Alternatives_4");
builder.put(grammarAccess.getInterfaceReferenceAccess().getAlternatives(), "rule__InterfaceReference__Alternatives");
builder.put(grammarAccess.getConnectionAccess().getAlternatives(), "rule__Connection__Alternatives");
builder.put(grammarAccess.getRosConnectionAccess().getAlternatives(), "rule__RosConnection__Alternatives");
Expand All @@ -47,10 +47,12 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
builder.put(grammarAccess.getEStringAccess().getAlternatives(), "rule__EString__Alternatives");
builder.put(grammarAccess.getRosNamesAccess().getAlternatives(), "rule__RosNames__Alternatives");
builder.put(grammarAccess.getRosSystemAccess().getGroup(), "rule__RosSystem__Group__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_3_0(), "rule__RosSystem__Group_3_0__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_3_1(), "rule__RosSystem__Group_3_1__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_3_2(), "rule__RosSystem__Group_3_2__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_3_3(), "rule__RosSystem__Group_3_3__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_3(), "rule__RosSystem__Group_3__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_4_0(), "rule__RosSystem__Group_4_0__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_4_1(), "rule__RosSystem__Group_4_1__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_4_2(), "rule__RosSystem__Group_4_2__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_4_3(), "rule__RosSystem__Group_4_3__0");
builder.put(grammarAccess.getRosSystemAccess().getGroup_4_4(), "rule__RosSystem__Group_4_4__0");
builder.put(grammarAccess.getProcessAccess().getGroup(), "rule__Process__Group__0");
builder.put(grammarAccess.getProcessAccess().getGroup_4(), "rule__Process__Group_4__0");
builder.put(grammarAccess.getProcessAccess().getGroup_4_3(), "rule__Process__Group_4_3__0");
Expand Down Expand Up @@ -145,10 +147,13 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
builder.put(grammarAccess.getHeaderAccess().getGroup(), "rule__Header__Group__0");
builder.put(grammarAccess.getArraySpecRefAccess().getGroup(), "rule__ArraySpecRef__Group__0");
builder.put(grammarAccess.getRosSystemAccess().getNameAssignment_0(), "rule__RosSystem__NameAssignment_0");
builder.put(grammarAccess.getRosSystemAccess().getProcessesAssignment_3_0_2(), "rule__RosSystem__ProcessesAssignment_3_0_2");
builder.put(grammarAccess.getRosSystemAccess().getComponentsAssignment_3_1_2(), "rule__RosSystem__ComponentsAssignment_3_1_2");
builder.put(grammarAccess.getRosSystemAccess().getParameterAssignment_3_2_2(), "rule__RosSystem__ParameterAssignment_3_2_2");
builder.put(grammarAccess.getRosSystemAccess().getConnectionsAssignment_3_3_2(), "rule__RosSystem__ConnectionsAssignment_3_3_2");
builder.put(grammarAccess.getRosSystemAccess().getFromFileAssignment_3_1(), "rule__RosSystem__FromFileAssignment_3_1");
builder.put(grammarAccess.getRosSystemAccess().getComponentsAssignment_4_0_2(), "rule__RosSystem__ComponentsAssignment_4_0_2");
builder.put(grammarAccess.getRosSystemAccess().getProcessesAssignment_4_1_2(), "rule__RosSystem__ProcessesAssignment_4_1_2");
builder.put(grammarAccess.getRosSystemAccess().getComponentsAssignment_4_2_2(), "rule__RosSystem__ComponentsAssignment_4_2_2");
builder.put(grammarAccess.getRosSystemAccess().getParameterAssignment_4_3_2(), "rule__RosSystem__ParameterAssignment_4_3_2");
builder.put(grammarAccess.getRosSystemAccess().getConnectionsAssignment_4_4_2(), "rule__RosSystem__ConnectionsAssignment_4_4_2");
builder.put(grammarAccess.getSubSystemAccess().getSystemAssignment(), "rule__SubSystem__SystemAssignment");
builder.put(grammarAccess.getProcessAccess().getNameAssignment_1(), "rule__Process__NameAssignment_1");
builder.put(grammarAccess.getProcessAccess().getComponentsAssignment_4_2(), "rule__Process__ComponentsAssignment_4_2");
builder.put(grammarAccess.getProcessAccess().getComponentsAssignment_4_3_1(), "rule__Process__ComponentsAssignment_4_3_1");
Expand Down
Loading
Loading