File: DependencyTypeTranslator.java

package info (click to toggle)
eclipse-wtp 3.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 129,700 kB
  • ctags: 197,897
  • sloc: java: 1,181,138; xml: 35,588; jsp: 29,478; php: 407; sh: 169; makefile: 65
file content (49 lines) | stat: -rw-r--r-- 1,920 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*******************************************************************************
 * Copyright (c) 2001, 2005 IBM Corporation and others.
 * All rights reserved. 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
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
/*
 * Created on Apr 2, 2003
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package org.eclipse.wst.common.componentcore.internal.util;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.wst.common.componentcore.ComponentcorePackage;
import org.eclipse.wst.common.componentcore.internal.DependencyType;
import org.eclipse.wst.common.internal.emf.resource.Translator;

/**
 * @author administrator
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class DependencyTypeTranslator extends Translator implements WTPModulesXmlMapperI{
	
	public DependencyTypeTranslator(){
		super(DEPENDENCY_TYPE,ComponentcorePackage.eINSTANCE.getReferencedComponent_DependencyType());
	}
	
	/* (non-Javadoc)
	 * @see com.ibm.etools.emf2xml.impl.Translator#convertStringToValue(java.lang.String, org.eclipse.emf.ecore.EObject)
	 */
	public Object convertStringToValue(String strValue, EObject owner) {
		String correct = strValue;
		if (strValue.toUpperCase().equals("CONSUMES")) //$NON-NLS-1$
			correct = DependencyType.CONSUMES_LITERAL.getName(); 
		else if (strValue.toUpperCase().equals("USES")) //$NON-NLS-1$
			correct = DependencyType.USES_LITERAL.getName(); 
			
		return super.convertStringToValue(correct, owner);
	}

}