diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java')
-rw-r--r-- | jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java deleted file mode 100644 index c17cb9faf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 Sybase, Inc. 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: - * Sybase, Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.jsf.facesconfig.ui.util; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager; -import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType; - -/** - * - * @author sfshi - * - */ -public class ManagedBeanUtil { - - /** - * Determines if the new bean to be added is already a member of the - * configuration set. - * @param project - * - * @param beanName - - * The name of the bean being added - * @return int - 0 if bean doesn't exist, otherwise the choice from the - * Duplicate Bean dialog - */ - public static boolean isBeanDuplicate(IProject project, String beanName) - { - JSFAppConfigManager appCfgMgr = JSFAppConfigManager.getInstance(project); - - if (appCfgMgr != null) - { - List beans = appCfgMgr.getManagedBeans(); - - // Iterate through the bean list - for (Iterator i = beans.iterator(); i.hasNext();) { - Object o = i.next(); - if (o instanceof ManagedBeanType) { - ManagedBeanType mbti = (ManagedBeanType) o; - if (mbti.getManagedBeanName() != null) { - String name = mbti.getManagedBeanName() - .getTextContent(); - if (name != null && name.equals(beanName)) { - return true; - } - } - } - } - - } - return false; - } - - /** - * get the default managed bean name in the current project according to - * reference name - * - * @param project - - * current project - * @param refName - - * seed reference name - * @return String - default managed bean name - */ - public static String getDefaultManagedBeanName(IProject project, - String refName) { - String defaultName = refName; - - int newRefNameIndex = 1; - while (isBeanDuplicate(project, defaultName)) { - defaultName = refName + newRefNameIndex; - newRefNameIndex++; - } - return defaultName; - } -} |