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

Field Summary
 
Fields inherited from interface org.eclipse.mtl.ide.ui.wizards.newfile.example.IMTLExampleStrategy
EXAMPLE_STRATEGY_EXTENSION_ID
 
Constructor Summary
MTLCopyExampleContentStrategy()
           
 
Method Summary
 boolean forceMetamodelURI()
          Indicates if this strategy defines itself the meta-model URI of the template to create.
 java.lang.String getContent(org.eclipse.core.resources.IFile exampleFile, java.lang.String moduleName, boolean templateHasFileBlock, boolean templateIsMain, 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).
 java.lang.String getInitialFileNameFilter()
          Gets the initial file name filter for this strategy.
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:
org.eclipse.mtl.internal.ide.ui.wizards.newfile.example.IMTLExampleStrategy#getDescription()

getInitialFileNameFilter

public java.lang.String getInitialFileNameFilter()
Gets the initial file name filter for this strategy.

Specified by:
getInitialFileNameFilter in interface IMTLExampleStrategy
Returns:
the initial file name filter
See Also:
IMTLExampleStrategy.getInitialFileNameFilter()

forceMetamodelURI

public boolean forceMetamodelURI()
Indicates if this strategy defines itself the meta-model URI of the template to create.

Specified by:
forceMetamodelURI in interface IMTLExampleStrategy
Returns:
true if this strategy defines itself the meta-model URI
See Also:
IMTLExampleStrategy.forceMetamodelURI()

getContent

public java.lang.String getContent(org.eclipse.core.resources.IFile exampleFile,
                                   java.lang.String moduleName,
                                   boolean templateHasFileBlock,
                                   boolean templateIsMain,
                                   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
templateHasFileBlock - indicates if a file block must be generated
templateIsMain - indicates if a main tag (@main) must be generated
metamodelURI - is the metamodel URI
metamodelFileType - is the main metamodel type
Returns:
the new template content
See Also:
org.eclipse.mtl.internal.ide.ui.wizards.newfile.example.IMTLExampleStrategy#getContent(org.eclipse.core.resources.IFile, java.lang.String, boolean, boolean, 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.