emf

Eclipse Project Explorer filter for XML files

混江龙づ霸主 提交于 2019-12-25 04:47:12
问题 I have many XML files in the workbench Project Explorer, each one an instance of one of ten different ecore models. For each ecore model I would like to contribute a commonFilter to the navigator's navigatorContent extension point to enable the user to show or hide the corresponding XML files. These are external tool files so there is not a way to identify the content merely by observing the file name or the xml extension, and renaming is not feasible. Using perhaps a class deriving from org

EMF Eclipse: enumeration with custom fields (properties)

流过昼夜 提交于 2019-12-23 12:07:27
问题 Ok, so in Java this is possible: import org.eclipse.emf.common.util.Enumerator; public enum MyEnum implements Enumerator { LITERAL1(0, "Name", "Literal", "custom1", "custom2", "custom3"), LITERAL2(0, "Name", "Literal", "custom1", "custom2", "custom3"), LITERAL3(0, "Name", "Literal", "custom1", "custom2", "custom3"), LITERAL4(0, "Name", "Literal", "custom1", "custom2", "custom3"); public static final int LITERAL1_VALUE = 0; public static final int LITERAL2_VALUE = 1; public static final int

How can I repair a damaged eclipse $HOME/.p2 repository?

岁酱吖の 提交于 2019-12-22 09:39:55
问题 I've been working through a long string of issues that apparently started when my Ubuntu VM ran out of disk space a couple of weeks ago. I was able to expand the virtual disk and get past that, but it appears that behind the scenes this caused Eclipse to somehow corrupt some jars in my "$HOME/.p2" repository. It was even a long struggle to figure out which jars were corrupted, as Eclipse would fail to install a new plugin, saying that a zip file was invalid, but the exception info wasn't

Can derived attributes be persisted and derivation disabled in Ecore and OCL?

不问归期 提交于 2019-12-22 08:55:36
问题 I want to port a legacy data format, which consists of concepts similar to Eclipse Modeling Framework (EMF) Ecore: Elements with Parameters which have different datatypes and default values. A custom-made tool lets you edit such model instances by a fancy table-based GUI. Also, a common feature for the Parameters is that a Derivation Rule can be added which specifies that the Parameter value gets computed automatically from other parameters. That also seems similar to Ecore derived Attributes

Why use a factory instead of 'new'?

谁说我不能喝 提交于 2019-12-14 01:42:31
问题 I am reading the book EMF: Eclipse Modeling Framework where its stated: The EMF programming model strongly encourages, but doesn’t require, the use of factories for creating objects. Instead of simply using the new operator to create [an object]... Why is the use of factories encouraged over new ? Your answer does not have to be EMF specific, as long as it has to do with Java. 回答1: You can read Effective Java Item 1: Consider static factory methods instead of constructors. It describes

What are Switch classes used for?

帅比萌擦擦* 提交于 2019-12-12 17:39:13
问题 What are switch classes (derived from org.eclipse.emf.ecore.util.Switch<T> ) used for? The javadoc explains it as An abstract base class for all switch classes. which does not help as I have never heared about "switch classes" before. 回答1: A switch class is a class that allows you to choose and instantiates a concrete instance of a type based on a model object (in this case, an EMF model object). The examples I've seen suggest it's useful for instantiating type-specific adapters for an EMF

Eclipse EMF: How to get access EAttribute by name?

风格不统一 提交于 2019-12-12 14:26:51
问题 I have a Java method that is passed a String and an EMF EObject. The String is meant to be the name of an attribute of the EObject. For example, if it were passed "foo" and EObject eobj, it would need to access eobj.getFoo(). I know how to get the value of an EAttibute from its featureID, but can't seem to find a way to get it by attribute name. Is this even possible? 回答1: The following should do the trick, but it is not elegant at all . It obtains the eClass of your eObject , finds a

Loading Multiple files using EMF resource load?

廉价感情. 提交于 2019-12-11 19:48:34
问题 I have a requirement where in the data to be loaded on to the model is distributed in multiple files, is it possible to load multiple files on to the same model. Using EMF Resource load if yes? can someone please guide me how to do it. 回答1: Usually when you have a Model distributed in multiple files, when you load the file that containt the root model element, all children are loaded althought they are contain in the distributed files. 来源: https://stackoverflow.com/questions/23381102/loading

Accessing Xtext's runtime EMF model

假如想象 提交于 2019-12-07 16:05:29
问题 I created a DSL via Xtext and now I need to transform the models created in the editor into another model(s). I suppose the most straightforward way is to employ some kind of M2M transformation framework, but i need to access the model behind the textual file. Question: how can I get a reference to the model? 回答1: The models created by Xtext have also a resource factory created for them. If you try to load the textual file as an EMF model, EMF will look for resource factories available for

How can I repair a damaged eclipse $HOME/.p2 repository?

一笑奈何 提交于 2019-12-06 03:34:00
I've been working through a long string of issues that apparently started when my Ubuntu VM ran out of disk space a couple of weeks ago. I was able to expand the virtual disk and get past that, but it appears that behind the scenes this caused Eclipse to somehow corrupt some jars in my "$HOME/.p2" repository. It was even a long struggle to figure out which jars were corrupted, as Eclipse would fail to install a new plugin, saying that a zip file was invalid, but the exception info wasn't saying which zip file was corrupted. In any case, by connecting a debugger I was able to figure out which