eclipse plugin: Enhance the existing WMLFactory with some methods

This commit is contained in:
Timotei Dolean 2011-07-26 15:34:40 +00:00
parent bff4e240b2
commit 840922fcee
2 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2011 by Timotei Dolean <timotei21@gmail.com>
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.wesnoth.wml;
import org.wesnoth.wml.impl.WmlFactory2Impl;
public interface WmlFactory2 extends WmlFactory
{
WmlFactory2 eINSTANCE = new WmlFactory2Impl();
WMLTag createWMLTag( String name );
WMLTag createWMLTag( String name, String extendedName );
WMLTag createWMLTag( String name, String extendedName, char cardinality );
WMLKey createWMLKey( String name, String dataType );
WMLKey createWMLKey( String name, String dataType, char cardinality );
WMLKey createWMLKey( String name, String dataType, char cardinality, boolean translatable );
}

View file

@ -0,0 +1,68 @@
/*******************************************************************************
* Copyright (c) 2011 by Timotei Dolean <timotei21@gmail.com>
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.wesnoth.wml.impl;
import org.wesnoth.wml.WMLKey;
import org.wesnoth.wml.WMLTag;
import org.wesnoth.wml.WmlFactory2;
public class WmlFactory2Impl extends WmlFactoryImpl implements WmlFactory2
{
@Override
public WMLTag createWMLTag( String name )
{
return createWMLTag( name, "" );
}
@Override
public WMLTag createWMLTag( String name, String inhertedName )
{
return createWMLTag( name, inhertedName, '*' );
}
@Override
public WMLTag createWMLTag( String name, String inhertedName, char cardinality )
{
WMLTag tag = createWMLTag( );
tag.setName( name );
tag.setEndName( name );
tag.set_Cardinality( cardinality );
tag.set_InhertedTagName( inhertedName );
return tag;
}
@Override
public WMLKey createWMLKey( String name, String dataType )
{
return createWMLKey( name, dataType, '*' );
}
@Override
public WMLKey createWMLKey( String name, String dataType, char cardinality )
{
return createWMLKey( name, dataType, cardinality, false );
}
@Override
public WMLKey createWMLKey( String name, String dataType, char cardinality, boolean translatable )
{
WMLKey key = createWMLKey( );
key.setName( name );
key.set_DataType( dataType );
key.set_Cardinality( cardinality );
key.set_Translatable( translatable );
return key;
}
}