[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.tmf] Re: Using name of source file in generation

Hi,

the tutorial shows how to use the model elements for generating code. But how can I access the input file name e.g. to build the output file name based on it?

Write a java extension passing a (basically any) model element to it. In the java implementation you can then get the eResource giving you access to the URI.


public static String filename(EObject o){
  URI uri = o.eResource().getURI();
  String result=calculateNewFileNameFromUri(uri);
}

In general o would be your model root.

Alex