Package at.bestsolution.efxclipse.tooling.model.internal

Source Code of at.bestsolution.efxclipse.tooling.model.internal.FXClassmodel

/*******************************************************************************
* Copyright (c) 2012 BestSolution.at 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:
*     Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
*******************************************************************************/
package at.bestsolution.efxclipse.tooling.model.internal;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;

import at.bestsolution.efxclipse.tooling.model.IFXClass;
import at.bestsolution.efxclipse.tooling.model.IFXClassmodel;
import at.bestsolution.efxclipse.tooling.model.IFXCtrlClass;

public class FXClassmodel implements IFXClassmodel {
  private Map<String, FXClass> fxClassCache = new HashMap<String, FXClass>();
  private Map<String, FXCtrlClass> fxCtrlClassCache = new HashMap<String, FXCtrlClass>();
 
  public IFXClass findClass(IJavaProject javaProject, IType type) {
    IFXClass rv = fxClassCache.get(type.getFullyQualifiedName());
   
    if( rv == null ) {
      FXClass c = new FXClass(javaProject, type);
      fxClassCache.put(c.getFQN(), c);
      rv = c;
    }
    return rv;
  }
 
  @Override
  public IFXCtrlClass findCtrlClass(IJavaProject javaProject, IType type) {
    IFXCtrlClass rv = fxCtrlClassCache.get(type.getFullyQualifiedName());
   
    if( rv == null ) {
      FXCtrlClass c = new FXCtrlClass(javaProject, type);
      fxCtrlClassCache.put(c.getFQN(), c);
      rv = c;
    }
    return rv;
  }
 
  @Override
  public void clearCache(IType type) {
    String fqn = type.getFullyQualifiedName();
    fxClassCache.remove(fqn);
    fxCtrlClassCache.remove(fqn);
  }
}
TOP

Related Classes of at.bestsolution.efxclipse.tooling.model.internal.FXClassmodel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.