org.eclipse.mtl.ide.ui.wizards.newfile.example
Class MTLCopyExampleContentStrategy

java.lang.Object
  extended by org.eclipse.mtl.ide.ui.wizards.newfile.example.MTLCopyExampleContentStrategy
All Implemented Interfaces:
IMTLExampleStrategy

public class MTLCopyExampleContentStrategy
extends java.lang.Object
implements IMTLExampleStrategy

Default implementation of the "org.eclipse.mtl.ide.ui.example" extension point. It is used to initialize automatically a template file from an example, by copying the text of the example into the new template.

See Also:
IMTLExampleStrategy

Constructor Summary
MTLCopyExampleContentStrategy()
           
 
Method Summary
 java.lang.String getContent(org.eclipse.core.resources.IFile exampleFile, java.lang.String moduleName, java.lang.String metamodelURI, java.lang.String metamodelFileType)
          Gets the new template content, using the example file and the wizard information.
 java.lang.String getDescription()
          Gets the description of the strategy (Displayed in the "New>MTL>MTL Templates" wizard).
protected  java.lang.StringBuffer readExampleContent(org.eclipse.core.resources.IFile exampleFile)
          Reads the text of the example file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTLCopyExampleContentStrategy

public MTLCopyExampleContentStrategy()
Method Detail

getDescription

public java.lang.String getDescription()
Gets the description of the strategy (Displayed in the "New>MTL>MTL Templates" wizard).

Specified by:
getDescription in interface IMTLExampleStrategy
Returns:
the description of the strategy
See Also:
IMTLExampleStrategy.getDescription()

getContent

public java.lang.String getContent(org.eclipse.core.resources.IFile exampleFile,
                                   java.lang.String moduleName,
                                   java.lang.String metamodelURI,
                                   java.lang.String metamodelFileType)
Gets the new template content, using the example file and the wizard information.

Specified by:
getContent in interface IMTLExampleStrategy
Parameters:
exampleFile - is the selected example
moduleName - is the module name
metamodelURI - is the metamodel URI
metamodelFileType - is the main metamodel type
Returns:
the new template content
See Also:
IMTLExampleStrategy.getContent(org.eclipse.core.resources.IFile, java.lang.String, java.lang.String, java.lang.String)

readExampleContent

protected java.lang.StringBuffer readExampleContent(org.eclipse.core.resources.IFile exampleFile)
Reads the text of the example file.

Parameters:
exampleFile - is the example file
Returns:
the example file text

Copyright 2008 Obeo
All Rights Reserved.