Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Today's Messages (off)  | Unanswered Messages (on)

Forum: TMF (Xtext)
 Topic: Getting bean properties from JvmGenericType
Getting bean properties from JvmGenericType [message #1060200] Thu, 23 May 2013 09:32
Aaron Digulla is currently online Aaron Digulla
Messages: 235
Registered: July 2009
Location: Switzerland
Senior Member
Does someone have a working code sample how to get Java Bean properties when I have a JvmGenericType?

Regards,

A. Digulla
 Topic: EMF changes do not reflect Xtext Document
EMF changes do not reflect Xtext Document [message #1060170] Thu, 23 May 2013 07:45
junior developer is currently offline junior developer
Messages: 140
Registered: January 2013
Senior Member
Hi all ,
I changed EMF ,I write code in the public abstract class ContentUnitImpl extends MinimalEObjectImpl.Container implements ContentUnit.
I did debug ,entered in the debug but changes not reflect in the Xtext Editor.Why this changes reflected in the Xtext Document(Editor) ?

My code is below :


 public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    //Display name bos ise doldur.
    if(this.getDisplayName() == null || this.getDisplayName().equals("")){
    	this.setDisplayName(name);
    }
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ContentPackage.CONTENT_UNIT__NAME, oldName, name));
  }




Best Regards,

[Updated on: Thu, 23 May 2013 08:02]

Report message to a moderator

 Topic: Xtext 2.4 referencing UML
Xtext 2.4 referencing UML [message #1060115] Thu, 23 May 2013 03:44
Marc Z is currently offline Marc Z
Messages: 4
Registered: July 2012
Junior Member
Hi,


I'm trying the reference UML elements in my DSL usign the following workflow:

Workflow {
    bean = StandaloneSetup {
    	scanClassPath = true
    	platformUri = "${runtimeProject}/.."
 	// The following two lines can be removed, if Xbase is not used.
    	registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
    	registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
        registerGeneratedEPackage = "org.eclipse.emf.ecore.EcorePackage"
	registerGenModelFile = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
        registerGeneratedEPackage = "org.eclipse.uml2.uml.UMLPackage"
        registerGenModelFile = "platform:/resource/org.eclipse.uml2.uml/model/UML.genmodel"
        registerGeneratedEPackage = "org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage"
        registerGenModelFile = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
        registerGeneratedEPackage = "org.eclipse.uml2.codegen.ecore.genmodel.GenModelPackage"
        registerGenModelFile = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
    }
    
    component = DirectoryCleaner {
    	directory = "${runtimeProject}/src-gen"
    }
    
    component = DirectoryCleaner {
    	directory = "${runtimeProject}.ui/src-gen"
    }
    
    component = Generator {
    	pathRtProject = runtimeProject
    	pathUiProject = "${runtimeProject}.ui"
    	pathTestProject = "${runtimeProject}.tests"
    	projectNameRt = projectName
    	projectNameUi = "${projectName}.ui"
    	language = auto-inject {
    		uri = grammarURI
    
    		// Java API to access grammar elements (required by several other fragments)
    		fragment = grammarAccess.GrammarAccessFragment auto-inject {}
    
    		// generates Java API for the generated EPackages
    		fragment = ecore.EcoreGeneratorFragment auto-inject {
    		// referencedGenModels = "
    		//  platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
    		//  platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
    		// "
    		}
    
    		// the old serialization component
    		// fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}    
    
    		// serializer 2.0
    		fragment = serializer.SerializerFragment auto-inject {
    			generateStub = false
    		}
    
    		// a custom ResourceFactory for use with EMF
    		fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
    
    		// The antlr parser generator fragment.
    		fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
    		//  options = {
    		//      backtrack = true
    		//  }
    		}
    
    		// Xtend-based API for validation
    		fragment = validation.ValidatorFragment auto-inject {
    		//    composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
    		//    composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
    		}
    
    		// old scoping and exporting API
    		// fragment = scoping.ImportURIScopingFragment auto-inject {}
    		// fragment = exporting.SimpleNamesFragment auto-inject {}
    
    		// scoping and exporting API
    		fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
    		fragment = exporting.QualifiedNamesFragment auto-inject {}
    		fragment = builder.BuilderIntegrationFragment auto-inject {}
    
    		// generator API
    		fragment = generator.GeneratorFragment auto-inject {}
    
    		// formatter API
    		fragment = formatting.FormatterFragment auto-inject {}
    
    		// labeling API
    		fragment = labeling.LabelProviderFragment auto-inject {}
    
    		// outline API
    		fragment = outline.OutlineTreeProviderFragment auto-inject {}
    		fragment = outline.QuickOutlineFragment auto-inject {}
    
    		// quickfix API
    		fragment = quickfix.QuickfixProviderFragment auto-inject {}
    
    		// content assist API
    		fragment = contentAssist.ContentAssistFragment auto-inject {}
    
    		// generates a more lightweight Antlr parser and lexer tailored for content assist
    		fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {}
    
    		// generates junit test support classes into Generator#pathTestProject
    		fragment = junit.Junit4Fragment auto-inject {}
    
    		// project wizard (optional)
    		// fragment = projectWizard.SimpleProjectWizardFragment auto-inject {
    		//      generatorProjectName = "${projectName}"
    		// }
    
    		// rename refactoring
    		fragment = refactoring.RefactorElementNameFragment auto-inject {}
    
    		// provides the necessary bindings for java types integration
    		fragment = types.TypesGeneratorFragment auto-inject {}
    
    		// generates the required bindings only if the grammar inherits from Xbase
    		fragment = xbase.XbaseGeneratorFragment auto-inject {}
    
    		// provides a preference page for template proposals
    		fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
    
    		// provides a compare view
    		fragment = compare.CompareFragment auto-inject {}
    	}
    }
}


But running the workflow always results in the following error:
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri '.../uml2/2.2.0/GenModel' not found. (platform:/resource/org.eclipse.uml2.uml/model/UML.genmodel, 13, 32)


Dows anyone know how to fix this error?


Thx Marc
 Topic: Applying (uml) stereotypes?
Applying (uml) stereotypes? [message #1059990] Wed, 22 May 2013 09:07
Dennis D. is currently offline Dennis D.
Messages: 9
Registered: April 2013
Junior Member
Hi,

as a more recent follow up of http://www.eclipse.org/forums/index.php/mv/msg/18749/60087/#msg_60087 I am interested in applying a stereotype to an xtext element.

Is there any progress here or any suggestions to do it with current versions?

I'd like to define elements in my dsl and use them from uml:

xtext:
MyElem returns my::mystereotype: 'MyElem' name=ID;

... and use/reference it in uml wherever my::mystereotype is expected. I can get it all working with "returns uml::class" instead of the stereotype, however I need to have stereotypes applied.

The link cited above is not of much help to me as further references there are broken urls.

thanks
dennis
 Topic: reload all elements from the XMFResource
reload all elements from the XMFResource [message #1059934] Wed, 22 May 2013 04:37
junior developer is currently offline junior developer
Messages: 140
Registered: January 2013
Senior Member
Hi all ,

I xant to reload all elements from the EMFResources.
My problem is EMFResource is different ,XtextResource is different.

How solved this problem ???

Best Regards,
 Topic: add a field Automatically
add a field Automatically [message #1059891] Wed, 22 May 2013 02:42
junior developer is currently offline junior developer
Messages: 140
Registered: January 2013
Senior Member
Hi all ,

When I create an element in the editor,default element must be added in the different element.I want to do this case.How can I do it in the Xtext.Which class is used for it

Best regrads,
 Topic: add a field Automatically
add a field Automatically [message #1059889] Wed, 22 May 2013 02:42
junior developer is currently offline junior developer
Messages: 140
Registered: January 2013
Senior Member
Hi all ,

When I create an element in the editor,default element must be added in the different element.I want to do this case.How can I do it in the Xtext.Which class is used for it

Best regrads,
 Topic: Change EMFResource
Change EMFResource [message #1059714] Tue, 21 May 2013 06:42
junior developer is currently offline junior developer
Messages: 140
Registered: January 2013
Senior Member
Hi all,

I do synchronization Xtext and GMF.and then I do changes in the GMF ,this change is not reflected in the Xtext Editor.so I want to reach EMFresources and then do changes in the model.Displayname field is in the grammar and every element's display name is shows in the outline.I load screenshot.

When I change display name in the editor and then this change is reflected in the element's name.I want to reach EMFresources and then change model in here.

Best regrads,

 Topic: Performing automatic corrections
Performing automatic corrections [message #1059692] Tue, 21 May 2013 04:58
Marco Naddeo is currently offline Marco Naddeo
Messages: 49
Registered: November 2012
Member
Hi Smile

The Java editor automatically corrects the code in some cases... For example, if I have a class B which extends a class A, I can declare an object myObject in this way:

A myObject = new B();


but now, supposing that myMethod is a method definied in the subclass B, if I try to call it directly on myObject (declared of type A):

myObject.myMethod()


the editor in some cases automatically adds a cast converting the code as following:

((B)myObject).myMethod()


Now, I have to implement some automatic corrections on user typing. Is there some Xtext or Eclipse support for implementing them?

Where can I hook to do this?


Thanks in advance,
Marco
 Topic: Add my var in Quick Reference
Add my var in Quick Reference [message #1059631] Mon, 20 May 2013 19:27
Yoandri Saavedra is currently offline Yoandri Saavedra
Messages: 21
Registered: February 2013
Junior Member


As I stated I can dynamically add variables to the Quick Reference???.. I read the Xtext Documentation in 9.4.1. Cross Reference Template Variable Resolver.. talk about variable and Quick Reference.. this is when I press Ctrl+Space???.. this is I need.. when I press Ctr+Space in my Xtext Editor the var declared show...If you do not understand my question, is that I do not speak English, but I try to learn more about this framework, sorry
 Topic: Getting IEditorInput in validator
Getting IEditorInput in validator [message #1059627] Mon, 20 May 2013 18:48
Roza Ghamari is currently offline Roza Ghamari
Messages: 22
Registered: January 2013
Junior Member
Hi all,

I need to do some validation on my grammar based on the association of the file with a specific object I called MyResource. The command for opening the xtext editor is handled when user is right clicking on MyResource, hence I extended the FileEditorInput (called it MyEditorInput) and store the Myresource instance for the editor input there. However, I cannot get the instance of MyEditorInput in the MyGrammarJavaEditor code. I tried using PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput()

but this it throw NullPointerException. Do you know any ways to get the editor input in validator? Do you think my solution for associating an external object with the xtext editor/file/resource is correct? Any other suggestions?

Thank you very much in advance!
 Topic: xText: access on Java packages, classes and methods out from the ProposalProvider
xText: access on Java packages, classes and methods out from the ProposalProvider [message #1059234] Fri, 17 May 2013 08:40
thomas thomas is currently offline thomas thomas
Messages: 1
Registered: May 2013
Junior Member
I developed a DSL which I use together with standard java code. In my DSL I can write things like this:

package:  packagename;
method: void testMethod (int, double);


What I want to do is that the user of the DSL gets the package names and method signatures suggested by the ProposalProvider which are really existing in my project.

Example:
When my project only consists of one package e.g. "TestPackage", the user of the DSL should only get the "TestPackage" as a suggestion.

How can I access my Java project packages, classes or methods out from the complete{TypeName}_{FeatureName} method of the ProposalProvider?






Current Time: Thu May 23 10:05:15 EDT 2013

Powered by FUDForum. Page generated in 0.02405 seconds