Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Adding own extension class to domainmodel example
Adding own extension class to domainmodel example [message #1713085] Fri, 30 October 2015 17:43 Go to next message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi,

I want to use an class with static methods with first paramater java.util.Date in the domainmodel example. The user should not have to use that import in the .dmodel, but I want it to be always there. I found the ImplicitlyImportedFeatures and overwrote it. I have to extension methods in that class:
	public static boolean operator_lessThan(
			final Date a,
			final Date b )
	{
		...
	}
	public static final boolean isJuly(
			final Date date )
	{
		...
	}


In the .dmodel if have such an operation:
		op anyDate : Date {
			val d1 = new Date
			val d2 = new Date
			if (d1 < d2) {
				
			}
			if (d1.isJuly) {
				
			}
		}


The first if-condition maps correctly to "operator_lessThan" but the "isJuly" is not found: "The method or field isJuly is undefined for the type Date"

What am I missing?

Thanks in advance
Ingo
Re: Adding own extension class to domainmodel example [message #1713087 is a reply to message #1713085] Fri, 30 October 2015 18:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi i cannot reproduce that in 2.8.4
are you sure you get the classpath right. of both the project containing your ImplicitlyImportedFeatures and the project containing the test.dmodel file?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Adding own extension class to domainmodel example [message #1713088 is a reply to message #1713087] Fri, 30 October 2015 18:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
(have a look at the generated java code as well i think currently ComparableExtensions is used?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Adding own extension class to domainmodel example [message #1713244 is a reply to message #1713088] Mon, 02 November 2015 17:49 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi, thanks for the classpath hint. It was a missing dependency which was a hidden by Eclipse due to our more complicated setup.
So this one is solved and is working as expected.
Previous Topic:Detecting duplicate inferred types
Next Topic:Couldn't find an interface org.eclipse.jwt.meta.model.processes.ProcessesPackage
Goto Forum:
  


Current Time: Sat Apr 27 01:20:46 GMT 2024

Powered by FUDForum. Page generated in 0.02973 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top