diff options
Diffstat (limited to 'plugins/org.eclipse.jst.jee.ui/src/org')
73 files changed, 0 insertions, 7278 deletions
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/CreateDeploymentFilesActionDelegate.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/CreateDeploymentFilesActionDelegate.java deleted file mode 100644 index ec04fd225..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/CreateDeploymentFilesActionDelegate.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.internal; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.actions.BaseAction; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.jee.project.facet.IAppClientCreateDeploymentFilesDataModelProperties; -import org.eclipse.jst.jee.project.facet.IConnectorCreateDeploymentFilesDataModelProperties; -import org.eclipse.jst.jee.project.facet.ICreateDeploymentFilesDataModelProperties; -import org.eclipse.jst.jee.project.facet.IEJBCreateDeploymentFilesDataModelProperties; -import org.eclipse.jst.jee.project.facet.IEarCreateDeploymentFilesDataModelProperties; -import org.eclipse.jst.jee.project.facet.IWebCreateDeploymentFilesDataModelProperties; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * @author ramanday - */ -public class CreateDeploymentFilesActionDelegate extends BaseAction { - - @Override - public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection aSelection) { - super.selectionChanged(action, aSelection); - boolean isEnabled = false; - if (aSelection != null) { - IStructuredSelection structuredSelection = (IStructuredSelection) aSelection; - isEnabled = isValidSelection(getProjectFromSelection(structuredSelection), null); - } - setEnabled(isEnabled); - action.setEnabled(isEnabled); - } - - private IProject getProjectFromSelection(IStructuredSelection structuredSelection){ - IProject project = ProjectUtilities.getProject(structuredSelection.getFirstElement()); - if (project == null){ - Object firstElement = structuredSelection.getFirstElement(); - if (IAdaptable.class.isInstance(firstElement)){ - return (IProject) ((IAdaptable) firstElement).getAdapter(IProject.class); - } - } - return project; - } - - private boolean isValidSelection(IProject project, Shell shell) { - return (project != null - && J2EEProjectUtilities.isJEEProject(project) - && !hasDeploymentDescriptor(project, shell)); - } - - /** - * Method informInvalidSelection. - */ - private void informInvalidSelection(Shell shell) { - MessageDialog.openInformation(shell, Messages.INVALID_DEP_DESC_SELECTION_TITLE, - Messages.INFORM_INVALID_DEP_DESC_SELECTION); - } - - private boolean hasDeploymentDescriptor(IProject project, Shell shell) { - boolean ret = true; - IPath ddFilePath = null; - if(JavaEEProjectUtilities.isEARProject(project)){ - ddFilePath = new Path(J2EEConstants.APPLICATION_DD_URI); - } else if(JavaEEProjectUtilities.isEJBProject(project)){ - ddFilePath = new Path(J2EEConstants.EJBJAR_DD_URI); - } else if(JavaEEProjectUtilities.isDynamicWebProject(project)){ - ddFilePath = new Path(J2EEConstants.WEBAPP_DD_URI); - } else if(JavaEEProjectUtilities.isApplicationClientProject(project)){ - ddFilePath = new Path(J2EEConstants.APP_CLIENT_DD_URI); - }else if(JavaEEProjectUtilities.isJCAProject(project)){ - ddFilePath = new Path(J2EEConstants.RAR_DD_URI); - } - IVirtualComponent component = ComponentCore.createComponent(project); - if(component.getRootFolder() != null - && component.getRootFolder().getUnderlyingFolder() != null){ - IFile ddXmlFile = component.getRootFolder().getUnderlyingFolder().getFile(ddFilePath); - ret = ddXmlFile.exists(); - if(shell != null && ret) - informInvalidSelection(shell); - } - return ret; - } - - - /* - */ - @Override - protected void primRun(Shell shell) { - IProject project = getProjectFromSelection(selection); - if (!validateSelection(project, shell)) - return; - try { - getDataModel(project).getDefaultOperation().execute( new NullProgressMonitor(), null); - } catch (ExecutionException e) { - JEEUIPlugin.logError(e); - } - } - - private IDataModel getDataModel(IProject project) { - Class dataModelClass = null; - if(JavaEEProjectUtilities.isEARProject(project)){ - dataModelClass = IEarCreateDeploymentFilesDataModelProperties.class; - } else if(JavaEEProjectUtilities.isEJBProject(project)){ - dataModelClass = IEJBCreateDeploymentFilesDataModelProperties.class; - } else if(JavaEEProjectUtilities.isDynamicWebProject(project)){ - dataModelClass = IWebCreateDeploymentFilesDataModelProperties.class; - } else if(JavaEEProjectUtilities.isApplicationClientProject(project)){ - dataModelClass = IAppClientCreateDeploymentFilesDataModelProperties.class; - }else if(JavaEEProjectUtilities.isJCAProject(project)){ - dataModelClass = IConnectorCreateDeploymentFilesDataModelProperties.class; - } - IDataModel dataModel = DataModelFactory.createDataModel(dataModelClass); - dataModel.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT, project); - return dataModel; - } - - private boolean validateSelection(IProject project, Shell shell) { - boolean validSelection = true; - if (!isValidSelection(project, shell)) { - validSelection = false; - } - return validSelection; - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/Messages.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/Messages.java deleted file mode 100644 index aa593a45f..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/Messages.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.internal; - -import org.eclipse.osgi.util.NLS; - - -public class Messages extends NLS { - - private static final String BUNDLE_NAME = "org.eclipse.jst.jee.ui.internal.messages"; //$NON-NLS-1$ - - - private Messages() { - // Do not instantiate - } - - public static String INVALID_DEP_DESC_SELECTION_TITLE; - public static String INFORM_INVALID_DEP_DESC_SELECTION; - public static String DEPLOYMENT_DESCRIPTOR; - public static String SESSION_BEANS; - public static String ENTITY_BEANS; - public static String MESSAGE_DRIVEN_BEANS; - public static String MessageAdapterNode_MESSAGE_ADAPTER; - public static String MessageListenerNode_MessageListener; - public static String ActicationSpecNode_ActivationSpec; - public static String ACTIVATION_CONFIG_PROPERTIES; - public static String ENTERPRISE_BEAN_CLASS_DESCRIPTION; - - public static String SERVLET_ITEM_PROVIDER; - public static String LISTENER_ITEM_PROVIDER; - public static String FILTERS_ITEM_PROVIDER; - public static String FILTER_MAPPING_ITEM_PROVIDER; - public static String SERVLET_MAPPING_ITEM_PROVIDER; - public static String ERROR_PAGES_ITEM_PROVIDER; - public static String WELCOME_PAGES_ITEM_PROVIDER; - public static String CONTEXT_PARAMS_ITEM_PROVIDER; - - - - - public static String REFERENCES; - public static String BUNDLED_LIBRARIES_NODE; - public static String LIBRARY_DIRECTORY; - public static String EAR_MODULES_NODE; - public static String EJBLOCAL_REFERENCES; - public static String EJB_REFERENCES; - public static String ENVIROMENT_ENTRIES; - public static String RESOURCE_ENVIROMENT_ENTRIES; - public static String RESOURCE_REFERENCES; - public static String SERVICE_REFERENCES; - public static String AddProjectToEARDropAssistant_The_dragged_project_cannot_be_added_; - public static String AddProjectToEARDropAssistant_The_project_0_cannot_be_accesse_; - public static String AddProjectToEARDropAssistant_Could_not_add_module_to_Enterprise_; - public static String AddModuleToEarDropAssistant_Adding_module_to_ea_; - public static String ImportJEEModuleDropAssistant_Importing_Java_Enterprise_Edition_artifacts; - public static String ImportJEEModuleDropAssistant_Could_not_recognize_extension_0_; - public static String InboundRaNode_Inbound_Resource_adapter; - - public static String ConnectorLabelProvider_ADMIN_OBJECT; - public static String ConnectorLabelProvider_CONFIG_PROPERTY; - public static String ConnectorLabelProvider_ConnectionDefinition; - public static String ConnectorLabelProvider_LICENSE_ARTIFACT; - public static String ConnectorLabelProvider_RequiredConfigProperty; - public static String GroupRaContentProvider_RESOURCE_ADAPTER; - public static String OutboundRaNode_OutboundResourceAdapter; - - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EJBDeployableArtifactAdapterFactory.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EJBDeployableArtifactAdapterFactory.java deleted file mode 100644 index f58efe089..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EJBDeployableArtifactAdapterFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 Jan 18, 2005 - */ -package org.eclipse.jst.jee.ui.internal.deployables; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.ui.actions.ILaunchable; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.wst.server.core.IModuleArtifact; -import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate; - -public class EJBDeployableArtifactAdapterFactory extends ModuleArtifactAdapterDelegate implements IAdapterFactory { - - public Object getAdapter(Object adaptableObject, Class adapterType) { - return null; - } - - public Class[] getAdapterList() { - return new Class[]{ILaunchable.class}; - } - - @Override - public IModuleArtifact getModuleArtifact(Object obj) { - return EJBDeployableArtifactAdapterUtil.getModuleObject(obj); - } - @Override - public IModuleArtifact[] getModuleArtifacts(Object obj) { - - if (obj instanceof SessionBean) - return EJBDeployableArtifactAdapterUtil.getModuleObjects((SessionBean) obj); - IModuleArtifact artifact = getModuleArtifact(obj); - if (artifact != null) - return new IModuleArtifact[] { artifact }; - return null; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EJBDeployableArtifactAdapterUtil.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EJBDeployableArtifactAdapterUtil.java deleted file mode 100644 index 0958cdea1..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EJBDeployableArtifactAdapterUtil.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.internal.deployables; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.javaee.ejb.EJBJar; -import org.eclipse.jst.javaee.ejb.EntityBean; -import org.eclipse.jst.javaee.ejb.MessageDrivenBean; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.jst.jee.internal.deployables.JEEFlexProjDeployable; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.jst.server.core.EJBBean; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualResource; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.IModuleArtifact; -import org.eclipse.wst.server.core.ServerUtil; -import org.eclipse.wst.server.core.model.ModuleDelegate; -import org.eclipse.wst.server.core.util.NullModuleArtifact; - -/** - * @version 1.0 - * @author - */ -public class EJBDeployableArtifactAdapterUtil { - /** - * Constructor for EJBDeployableObjectAdapter. - */ - public EJBDeployableArtifactAdapterUtil() { - super(); - } - - public static IModuleArtifact getModuleObject(Object obj) { - if (obj == null) - return null; - else if (obj instanceof EJBJar) - return getModuleObject((EJBJar) obj); - else if (obj instanceof SessionBean) - return getModuleObject((SessionBean) obj); - else if (obj instanceof MessageDrivenBean) - return getModuleObject((MessageDrivenBean) obj); - else if (obj instanceof EntityBean) - return getModuleObject((EntityBean) obj); - else if (obj instanceof IProject) - return getModuleObject((IProject) obj); - else if (obj instanceof IJavaProject) - return getModuleObject(((IJavaProject) obj).getProject()); - else if (obj instanceof IFile) - return getModuleObject((IFile) obj); - else if (obj instanceof ICompilationUnit) - return getModuleObject((ICompilationUnit) obj); - return null; - } - - protected static boolean hasInterestedComponents(IProject project) { - return JavaEEProjectUtilities.isEJBProject(project); - } - - protected static IModuleArtifact getModuleObject(ICompilationUnit cu) { - - try { - IFile file = (IFile) cu.getCorrespondingResource(); - IProject project = file.getProject(); - if (hasInterestedComponents(project)) { - return getModuleJavaObject(file); - } - - } catch (JavaModelException e) { - JEEUIPlugin.logError(e); - } - return null; - } - - protected static IModuleArtifact getModuleObject(EJBJar ejbJar) { - IModule dep = getModule((EObject)ejbJar); - return createModuleObject(dep, null, false, false); - } - - protected static IModuleArtifact getModuleObject(SessionBean ejb) { - IModule dep = getModule((EObject)ejb); - return createModuleObject(dep, ejb.getEjbName(), false, false); - } - protected static IModuleArtifact getModuleObject(EntityBean ejb) { - IModule dep = getModule((EObject)ejb); - return createModuleObject(dep, ejb.getEjbName(), false, false); - } - protected static IModuleArtifact getModuleObject(MessageDrivenBean ejb) { - IModule dep = getModule((EObject)ejb); - return createModuleObject(dep, ejb.getEjbName(), false, false); - } - protected static IModuleArtifact[] getModuleObjects(SessionBean ejb) { - List modArtifacts = new ArrayList(); - IModule dep = getModule((EObject)ejb); - List busLocals = ejb.getBusinessLocals(); - List busRemotes = ejb.getBusinessRemotes(); - for (Iterator iterator = busLocals.iterator(); iterator.hasNext();) { - String localName = (String) iterator.next(); - modArtifacts.add(createModuleObjectForSessionBean(dep, ejb.getEjbName(), localName, false,true)); - - } - for (Iterator iterator = busRemotes.iterator(); iterator.hasNext();) { - String remoteName = (String) iterator.next(); - modArtifacts.add(createModuleObjectForSessionBean(dep, ejb.getEjbName(), remoteName, true, false)); - } - - // for EJB 3.1 no-interface - if (ejb.getLocalBean() != null){ - modArtifacts.add(createModuleObjectForSessionBean(dep, ejb.getEjbName(), null, false,false)); - } - - return (IModuleArtifact[])modArtifacts.toArray(new IModuleArtifact[modArtifacts.size()]); - } - - protected static IModuleArtifact getModuleObject(IProject project) { - if (hasInterestedComponents(project)) { - IModule dep = getModule(project, null); - return createModuleObject(dep, null, false, false); - } - return null; - } - - protected static IModuleArtifact getModuleObject(IFile file) { - IVirtualResource[] resources = ComponentCore.createResources(file); - IVirtualComponent component = null; - if (resources[0] != null || resources.length <= 0) - component = resources[0].getComponent(); - if (hasInterestedComponents(file.getProject())) { - String ext = file.getFileExtension(); - if ("java".equals(ext) || "class".equals(ext)) //$NON-NLS-1$ //$NON-NLS-2$ - return getModuleJavaObject(file); - if (file.getProjectRelativePath().toString().endsWith(J2EEConstants.EJBJAR_DD_URI)) - return createModuleObject(getModule(file.getProject(), component), null, false, false); - } - return null; - } - - protected static IModule getModule(EObject refObject) { - IProject proj = ProjectUtilities.getProject(refObject); - if (proj == null) - return null; - Resource refResource = refObject.eResource(); - IVirtualResource[] resources = null; - IVirtualComponent component = null; - try { - IResource eclipeServResoruce = WorkbenchResourceHelper.getFile(refResource); - resources = ComponentCore.createResources(eclipeServResoruce); - if (resources[0] != null) - component = resources[0].getComponent(); - } catch (Exception e) { - JEEUIPlugin.logError(e); - } - return getModule(proj, component); - } - - protected static IModule getModule(IProject project, IVirtualComponent component) { - IModule deployable = null; - Iterator iterator = Arrays.asList(ServerUtil.getModules(J2EEProjectUtilities.EJB)).iterator(); - String componentName = null; - if (component != null) - componentName = component.getName(); - else - return getModuleProject(project, iterator); - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof IModule) { - deployable = (IModule) next; - if (deployable.getName().equals(componentName)) { - return deployable; - } - } - } - return null; - } - - protected static IModule getModuleProject(IProject project, Iterator iterator) { - IModule deployable = null; - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof IModule) { - deployable = (IModule) next; - if (deployable.getProject().equals(project)) - return deployable; - } - } - return null; - } - - - protected static IModuleArtifact getModuleJavaObject(IFile file) { - return null; - } - - protected static IModuleArtifact createModuleObject(IModule module, String ejbName, boolean remote, boolean local) { - if (module != null) { - String jndiName = null; - if (ejbName != null) { - module.loadAdapter(ModuleDelegate.class, new NullProgressMonitor()); - JEEFlexProjDeployable moduleDelegate = (JEEFlexProjDeployable)module.getAdapter(ModuleDelegate.class); - jndiName = moduleDelegate.getJNDIName(ejbName); - return new EJBBean(module, jndiName, remote, local,EJBBean.EJB_30); - } - return new NullModuleArtifact(module); - } - return null; - } - - protected static IModuleArtifact createModuleObjectForSessionBean(IModule module, String ejbName, String interfaceName, boolean remote, boolean local) { - if (module != null) { - String jndiName = null; - if (ejbName != null) { - module.loadAdapter(ModuleDelegate.class, new NullProgressMonitor()); - JEEFlexProjDeployable moduleDelegate = (JEEFlexProjDeployable)module.getAdapter(ModuleDelegate.class); - jndiName = moduleDelegate.getJNDIName(ejbName, interfaceName); - return new EJBBean(module, jndiName, remote, local,EJBBean.EJB_30, interfaceName); - } - return new NullModuleArtifact(module); - } - return null; - } - - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EnterpriseApplicationDeployableAdapterUtil.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EnterpriseApplicationDeployableAdapterUtil.java deleted file mode 100644 index 32bc3178e..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EnterpriseApplicationDeployableAdapterUtil.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.internal.deployables; - -import java.util.Arrays; -import java.util.Iterator; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.javaee.application.Application; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualResource; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.IModuleArtifact; -import org.eclipse.wst.server.core.ServerUtil; -import org.eclipse.wst.server.core.util.NullModuleArtifact; - -/** - * Creates the Object adapter for ear projects. - */ -public class EnterpriseApplicationDeployableAdapterUtil { - - /** - * Constructor for EnterpriseApplicationDeployableObjectAdapter. - */ - public EnterpriseApplicationDeployableAdapterUtil() { - super(); - }// EnterpriseApplicationDeployableObjectAdapter - - /** - * Gets the object for a type of object. - * - * @param Object - * obj - Object to adapt. - */ - public static IModuleArtifact getModuleObject(Object obj) { - if (obj instanceof Application) - return getModuleObject((Application) obj); - if (obj instanceof IProject) - return getModuleObject((IProject) obj); - if (obj instanceof IFile) - return getModuleObject((IFile) obj); - return null; - }// getDeployableObject - - /** - * Gets the deployable object for ear instance. - * - * @param Application - * application - EAR instance. - */ - protected static IModuleArtifact getModuleObject(Application application) { - IModule dep = getModule((EObject)application); - return createModuleObject(dep); - } - - /** - * Gets the deployable object for project instances. - * - * @param IProject - * project - Project instance. - * @return IModuleObject - */ - protected static IModuleArtifact getModuleObject(IProject project) { - IModule dep = getModule(project,null); - return createModuleObject(dep); - }// getModuleObject - - /** - * Gets the deployable object for file instances. - * - * @param IFile - * file - File instance. - * @return IModuleObject - */ - protected static IModuleArtifact getModuleObject(IFile file) { - if (file.getProjectRelativePath().toString().endsWith(J2EEConstants.APPLICATION_DD_URI)) { - { - IVirtualResource[] resources = ComponentCore.createResources(file); - IVirtualComponent component = null; - if (resources[0] != null || resources.length <= 0) - component = resources[0].getComponent(); - return createModuleObject(getModule(file.getProject(), component)); - } - }// if - return null; - }// getModuleObject - - /** - * Gets the deployable object. - * - * @param EObject - * refObject - The current refObject. - * @return IModule - */ - protected static IModule getModule(EObject refObject) { - IProject proj = ProjectUtilities.getProject(refObject); - Resource servResource = refObject.eResource(); - IVirtualResource[] resources = null; - try { - IResource eclipeServResoruce = WorkbenchResourceHelper.getFile(servResource); - resources = ComponentCore.createResources(eclipeServResoruce); - } catch (Exception e) { - JEEUIPlugin.logError(e); - } - IVirtualComponent component = null; - if (resources != null && resources[0] != null){ - component = resources[0].getComponent(); - } - return getModule(proj,component); - } - - - - protected static IModule getModuleProject(IProject project, Iterator iterator) { - IModule deployable = null; - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof IModule) { - deployable = (IModule) next; - if (deployable.getProject().equals(project)) - return deployable; - } - } - return null; - } - - protected static IModule getModule(IProject project, IVirtualComponent component) { - IModule deployable = null; - Iterator iterator = Arrays.asList(ServerUtil.getModules(J2EEProjectUtilities.ENTERPRISE_APPLICATION)).iterator(); - String componentName = null; - if (component != null) - componentName = component.getName(); - else - return getModuleProject(project, iterator); - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof IModule) { - deployable = (IModule) next; - if (deployable.getName().equals(componentName)) { - return deployable; - } - } - } - return null; - } - - /** - * Creates the deployable object. - * - * @param IModuleObject - * deployable - The current module object. - */ - protected static IModuleArtifact createModuleObject(IModule module) { - - if (module != null) { - return new NullModuleArtifact(module); - } - - return null; - }// createDeployableObject - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.server.core.IModuleArtifactAdapter#getId() - */ - public String getId() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.server.core.IModuleArtifactAdapter#getObjectClassName() - */ - public String getObjectClassName() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.server.core.IModuleArtifactAdapter#isPluginActivated() - */ - public boolean isPluginActivated() { - return false; - } - -}// EnterpriseApplicationDeployableObjectAdapter diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EnterpriseDeployableArtifactAdapterFactory.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EnterpriseDeployableArtifactAdapterFactory.java deleted file mode 100644 index 6f0587723..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/EnterpriseDeployableArtifactAdapterFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 Jan 18, 2005 - */ -package org.eclipse.jst.jee.ui.internal.deployables; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.ui.actions.ILaunchable; -import org.eclipse.wst.server.core.IModuleArtifact; -import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate; - -public class EnterpriseDeployableArtifactAdapterFactory extends ModuleArtifactAdapterDelegate implements IAdapterFactory { - - public Object getAdapter(Object adaptableObject, Class adapterType) { - return null; - } - - public Class[] getAdapterList() { - return new Class[] {ILaunchable.class }; - } - - @Override - public IModuleArtifact getModuleArtifact(Object obj) { - return EnterpriseApplicationDeployableAdapterUtil.getModuleObject(obj); - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/WebDeployableArtifactAdapterFactory.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/WebDeployableArtifactAdapterFactory.java deleted file mode 100644 index 39b17cc86..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/WebDeployableArtifactAdapterFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.internal.deployables; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.ui.actions.ILaunchable; -import org.eclipse.wst.server.core.IModuleArtifact; -import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate; - -public class WebDeployableArtifactAdapterFactory extends ModuleArtifactAdapterDelegate implements IAdapterFactory { - - public Object getAdapter(Object adaptableObject, Class adapterType) { - return null; - } - - public Class[] getAdapterList() { - return new Class[]{ILaunchable.class}; - } - - - @Override - public IModuleArtifact getModuleArtifact(Object obj) { - return WebDeployableArtifactUtil.getModuleObject(obj); - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/WebDeployableArtifactUtil.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/WebDeployableArtifactUtil.java deleted file mode 100644 index e40ac200c..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/deployables/WebDeployableArtifactUtil.java +++ /dev/null @@ -1,406 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.internal.deployables; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeHierarchy; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURL; -import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURLExtensionReader; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.javaee.core.UrlPatternType; -import org.eclipse.jst.javaee.web.IWebCommon; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.ServletMapping; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.javaee.web.internal.impl.ServletImpl; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualResource; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.IModuleArtifact; -import org.eclipse.wst.server.core.ServerUtil; -import org.eclipse.wst.server.core.internal.ModuleType; -import org.eclipse.wst.server.core.util.WebResource; - -/** - * @version 1.0 - * @author - */ -public class WebDeployableArtifactUtil { - - private final static String GENERIC_SERVLET_CLASS_TYPE = "javax.servlet.GenericServlet"; //$NON-NLS-1$ - private final static String CACTUS_SERVLET_CLASS_TYPE = "org.apache.cactus.server.ServletTestRedirector"; //$NON-NLS-1$ - - public WebDeployableArtifactUtil() { - super(); - } - - public static IModuleArtifact getModuleObject(Object obj) { - IResource resource = null; - if (obj instanceof IResource) - resource = (IResource) obj; - if (obj instanceof IModuleArtifact) - resource = ((IModuleArtifact) obj).getModule().getProject(); - else if (obj instanceof IAdaptable) - resource = (IResource) ((IAdaptable) obj).getAdapter(IResource.class); - else if (obj instanceof EObject) { - resource = ProjectUtilities.getProject((EObject) obj); - if (obj instanceof Servlet) { - ServletImpl servlet = ((ServletImpl) obj); - Resource servResource = servlet.eResource(); - IVirtualResource[] resources = null; - try { - IResource eclipeServResoruce = WorkbenchResourceHelper.getFile(servResource); - resources = ComponentCore.createResources(eclipeServResoruce); - } catch (Exception e) { - JEEUIPlugin.logError(e); - } - IVirtualComponent component = null; - if (resources != null && resources[0] != null){ - component = resources[0].getComponent(); - } - String mapping = null; - if (servlet.getServletClass() != null) { - List<ServletMapping> mappings = getServletMappings(resource, servlet.getServletClass()); - - if (mappings != null && !mappings.isEmpty()) { - ServletMapping map = mappings.get(0); - UrlPatternType urlPattern = map.getUrlPatterns().get(0); - mapping = urlPattern.getValue(); - } - if (mapping != null) { - return new WebResource(getModule(resource.getProject(), component), new Path(mapping)); - } - return new WebResource(getModule(resource.getProject(), component), new Path("servlet/" + servlet.getServletClass())); //$NON-NLS-1$ - - } else if (servlet.getJspFile() != null) { - if (component != null) { - IPath jspFilePath = new Path(servlet.getJspFile()); - resource = component.getRootFolder().getUnderlyingFolder().getFile(jspFilePath); - } - } - } - } - if (resource == null) - return null; - - if (resource instanceof IProject) { - IProject project = (IProject) resource; - if (hasInterestedComponents(project)) - return new WebResource(getModule(project, null), project.getProjectRelativePath()); - } - - if (!hasInterestedComponents(resource.getProject())) - return null; - if (isCactusJunitTest(resource)) - return null; - - IPath resourcePath = resource.getFullPath(); - IVirtualResource[] resources = ComponentCore.createResources(resource); - IVirtualComponent component = null; - if (resources.length <= 0 || resources[0] == null ) - return null; - component = resources[0].getComponent(); - String className = getServletClassName(resource); - if (className != null && component != null) { - String mapping = getServletMapping(resource, true, className, component.getName()); - if (mapping != null) { - return new WebResource(getModule(resource.getProject(), component), new Path(mapping)); - } - // if there is no servlet mapping, provide direct access to the servlet - // through the fully qualified class name - return new WebResource(getModule(resource.getProject(), component), new Path("servlet/" + className)); //$NON-NLS-1$ - - } - if (className == null && component != null) { - IPath rootPath = component.getRootFolder().getProjectRelativePath(); - IPath jspPath = resource.getProjectRelativePath().removeFirstSegments(rootPath.segmentCount()); - String mapping = getJSPServletMapping(resource, jspPath.makeAbsolute().toString()); - if (mapping != null) { - return new WebResource(getModule(resource.getProject(), component), new Path(mapping)); - } - } - resourcePath = resources[0].getRuntimePath(); - - try {//adding try/catch to avoid future issues that would require commenting this out. - // Extension read to get the correct URL for Java Server Faces file if - // the jsp is of type jsfaces. - FileURL jspURL = FileURLExtensionReader.getInstance().getFilesURL(); - if (jspURL != null) { - IPath correctJSPPath = jspURL.getFileURL(resource, resourcePath); - if (correctJSPPath != null && correctJSPPath.toString().length() > 0) - return new WebResource(getModule(resource.getProject(), component), correctJSPPath); - } - }catch (Exception e) {} - - return new WebResource(getModule(resource.getProject(), component), resourcePath); - } - - protected static IModule getModule(IProject project, IVirtualComponent component) { - String componentName = null; - if (component != null) - componentName = component.getName(); - ModuleType[] moduleTypeArray = new ModuleType[]{ - ModuleType.getModuleType(J2EEProjectUtilities.DYNAMIC_WEB, null), - ModuleType.getModuleType(J2EEProjectUtilities.WEBFRAGMENT, null) - }; - IModule[] modules = ServerUtil.getModules(moduleTypeArray); - for (IModule module : modules) { - if ((project == null || project.equals(module.getProject())) - && (componentName == null || componentName.equals(module.getName()))) - return module; - } - - // otherwise fall back to other types of web modules on the project - if (project != null) { - modules = ServerUtil.getModules(project); - for (IModule module : modules) { - if (componentName == null || componentName.equals(module.getName())) - return module; - } - } - return null; - } - - /** - * @deprecated - see getModule() for better logic for finding a project's IModule - */ - protected static IModule getModuleProject(IProject project, Iterator iterator) { - IModule deployable = null; - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof IModule) { - deployable = (IModule) next; - if (deployable.getProject().equals(project)) - return deployable; - } - } - return null; - } - - /** - * - * Very temporary api - TODO - rip this out by 1.0 - */ - private static boolean isCactusJunitTest(IResource resource) { - return getClassNameForType(resource, CACTUS_SERVLET_CLASS_TYPE) != null; - } - - - - private static IType[] getTypes(IJavaElement element) { - try { - if (element.getElementType() != IJavaElement.COMPILATION_UNIT) - return null; - - return ((ICompilationUnit) element).getAllTypes(); - } catch (Exception e) { - return null; - } - } - - public static String getServletClassName(IResource resource) { - return getClassNameForType(resource, GENERIC_SERVLET_CLASS_TYPE); - } - - public static String getClassNameForType(IResource resource, String superType) { - if (resource == null) - return null; - - try { - IProject project = resource.getProject(); - IPath path = resource.getFullPath(); - if (!project.hasNature(JavaCore.NATURE_ID) || path == null) - return null; - - IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID); - if (!javaProject.isOpen()) - javaProject.open(new NullProgressMonitor()); - - // output location may not be on classpath - IPath outputPath = javaProject.getOutputLocation(); - if (outputPath != null && "class".equals(path.getFileExtension()) && outputPath.isPrefixOf(path)) { //$NON-NLS-1$ - int count = outputPath.segmentCount(); - path = path.removeFirstSegments(count); - } - - // remove initial part of classpath - IClasspathEntry[] classPathEntry = javaProject.getResolvedClasspath(true); - if (classPathEntry != null) { - int size = classPathEntry.length; - for (int i = 0; i < size; i++) { - IPath classPath = classPathEntry[i].getPath(); - if (classPath.isPrefixOf(path)) { - int count = classPath.segmentCount(); - path = path.removeFirstSegments(count); - i += size; - } - } - } - - // get java element - IJavaElement javaElement = javaProject.findElement(path); - - IType[] types = getTypes(javaElement); - if (types != null) { - int size2 = types.length; - for (int i = 0; i < size2; i++) { - if (hasSuperclass(types[i], superType)) - return types[i].getFullyQualifiedName(); - } - } - return null; - } catch (Exception e) { - return null; - } - } - - public static boolean hasSuperclass(IType type, String superClassName) { - try { - ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null); - IType[] superClasses = hierarchy.getAllSuperclasses(type); - - int size = superClasses.length; - for (int i = 0; i < size; i++) { - if (superClassName.equals(superClasses[i].getFullyQualifiedName())) - return true; - } - return false; - } catch (Exception e) { - return false; - } - } - - public static String getServletMapping(IResource resource, boolean isServlet, String typeName, String componentName) { - if (typeName == null || typeName.equals("")) //$NON-NLS-1$ - return null; - - IModelProvider provider = ModelProviderManager.getModelProvider( resource.getProject() ); - Object mObj = provider.getModelObject(); - - if ( mObj instanceof org.eclipse.jst.javaee.web.WebApp){ - org.eclipse.jst.javaee.web.WebApp webApp= (org.eclipse.jst.javaee.web.WebApp) mObj; - List servlets = webApp.getServlets(); - // Ensure the display does not already exist in the web application - if (servlets != null && !servlets.isEmpty()) { - for (int i = 0; i < servlets.size(); i++) { - org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet)servlets.get(i); - if( servlet.getServletClass().equals(typeName)){ - - java.util.List mappings = webApp.getServletMappings(); - if (mappings != null && !mappings.isEmpty()) { - Iterator it = mappings.iterator(); - while( it.hasNext() ){ - org.eclipse.jst.javaee.web.ServletMapping map = (org.eclipse.jst.javaee.web.ServletMapping) it.next(); - if( map.getServletName().equals(servlet.getServletName())){ - org.eclipse.jst.javaee.core.UrlPatternType urlPattern = map.getUrlPatterns().get(0); - return urlPattern.getValue(); - } - } - - } - } - - } - } - - - } - return null; - - } - - protected static boolean hasInterestedComponents(IProject project) { - return (JavaEEProjectUtilities.isDynamicWebProject(project) || - JavaEEProjectUtilities.isWebFragmentProject(project)); - } - - private static String getJSPServletMapping(IResource resource, String jspPath) { - IModelProvider provider = ModelProviderManager.getModelProvider(resource.getProject()); - Object mObj = provider.getModelObject(); - - if (mObj instanceof WebApp) { - WebApp webApp= (WebApp) mObj; - List<Servlet> servlets = webApp.getServlets(); - if (servlets != null && !servlets.isEmpty()) { - for (int i = 0; i < servlets.size(); i++) { - Servlet servlet = servlets.get(i); - if (servlet.getJspFile() != null && servlet.getJspFile().equals(jspPath)) { - List<ServletMapping> mappings = webApp.getServletMappings(); - if (mappings != null && !mappings.isEmpty()) { - Iterator<ServletMapping> it = mappings.iterator(); - while (it.hasNext()) { - ServletMapping map = it.next(); - if (map.getServletName().equals(servlet.getServletName())) { - UrlPatternType urlPattern = map.getUrlPatterns().get(0); - return urlPattern.getValue(); - } - } - } - } - } - } - } - return null; - } - - private static List getServletMappings(IResource resource, String typeName){ - IModelProvider provider = ModelProviderManager.getModelProvider( resource.getProject() ); - IWebCommon webApp = (IWebCommon)provider.getModelObject(); - - List servlets = webApp.getServlets(); - List list = new ArrayList(); - - if (servlets != null && !servlets.isEmpty()) { - for (int i = 0; i < servlets.size(); i++) { - Servlet servlet = (Servlet)servlets.get(i); - if( servlet.getServletClass().equals(typeName)){ - - java.util.List mappings = webApp.getServletMappings(); - if (mappings != null && !mappings.isEmpty()) { - Iterator it = mappings.iterator(); - while( it.hasNext() ){ - org.eclipse.jst.javaee.web.ServletMapping map = (org.eclipse.jst.javaee.web.ServletMapping) it.next(); - if( map.getServletName().equals(servlet.getServletName())){ - list.add(map); - } - } - } - } - - } - } - return list; - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/messages.properties b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/messages.properties deleted file mode 100644 index b9c07b3ca..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/messages.properties +++ /dev/null @@ -1,46 +0,0 @@ -INVALID_DEP_DESC_SELECTION_TITLE=Invalid Selection -INFORM_INVALID_DEP_DESC_SELECTION=One or more Java EE projects selected already has a Deployment Descriptor. -DEPLOYMENT_DESCRIPTOR=Deployment Descriptor: {0} -SESSION_BEANS=Session Beans -ENTITY_BEANS=Entity Beans (1.x-2.x) -MESSAGE_DRIVEN_BEANS=Message-Driven Beans -MessageAdapterNode_MESSAGE_ADAPTER=Message Adapter -MessageListenerNode_MessageListener=Message Listener -ActicationSpecNode_ActivationSpec=Activation Spec -ACTIVATION_CONFIG_PROPERTIES=Activation Config Properties -ENTERPRISE_BEAN_CLASS_DESCRIPTION=Enterprise Bean Class - - -SERVLET_ITEM_PROVIDER=Servlets -LISTENER_ITEM_PROVIDER=Listeners -FILTERS_ITEM_PROVIDER=Filters -FILTER_MAPPING_ITEM_PROVIDER=Filter Mappings -SERVLET_MAPPING_ITEM_PROVIDER=Servlet Mappings -ERROR_PAGES_ITEM_PROVIDER=Error Pages -WELCOME_PAGES_ITEM_PROVIDER=Welcome Pages -CONTEXT_PARAMS_ITEM_PROVIDER=Context Parameters -BUNDLED_LIBRARIES_NODE=Bundled Libraries -LIBRARY_DIRECTORY=Library Directory -EAR_MODULES_NODE=Modules -EJBLOCAL_REFERENCES=Ejb Local References -EJB_REFERENCES=Ejb References -ENVIROMENT_ENTRIES=Environment Entries -RESOURCE_ENVIROMENT_ENTRIES=Resource Environment Entries -RESOURCE_REFERENCES=Resource References -SERVICE_REFERENCES=Service References -REFERENCES=References - -AddProjectToEARDropAssistant_The_dragged_project_cannot_be_added_=The dragged project cannot be added -AddProjectToEARDropAssistant_The_project_0_cannot_be_accesse_=The project cannot be accessed -AddProjectToEARDropAssistant_Could_not_add_module_to_Enterprise_=Could not add module to Enterprise -AddModuleToEarDropAssistant_Adding_module_to_ea_=Adding module to ear -ImportJEEModuleDropAssistant_Importing_Java_Enterprise_Edition_artifacts=Importing Java Enterprise Edition artifacts -ImportJEEModuleDropAssistant_Could_not_recognize_extension_0_=Could not recognize extension -InboundRaNode_Inbound_Resource_adapter=Inbound Resource Adapter - -ConnectorLabelProvider_ADMIN_OBJECT=Admin Object -ConnectorLabelProvider_CONFIG_PROPERTY=Config Property -ConnectorLabelProvider_ConnectionDefinition=Connection Definition -ConnectorLabelProvider_LICENSE_ARTIFACT=License -ConnectorLabelProvider_RequiredConfigProperty=Required Config Property -GroupRaContentProvider_RESOURCE_ADAPTER=Resource Adapter -OutboundRaNode_OutboundResourceAdapter=Outbound Resource Adapter diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AbstractDDNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AbstractDDNode.java deleted file mode 100644 index 934024051..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AbstractDDNode.java +++ /dev/null @@ -1,74 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.List; - -import org.eclipse.jface.viewers.IDecoration; -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.swt.graphics.Image; - -/** - * Abstract Deployment Descriptor Node is an abstract wrapper class for the nodes in the Deployment - * Descriptor it can contain information for the label provider some description for tool tip, an image - * and the object that it is wrapping. - * - * @author Dimitar Giormov - */ -public abstract class AbstractDDNode { - - protected Object adapterNode; - protected Image image; - protected String text; - protected String description; - - - /** - * Constructor for the class - * - * @param adapterNode - the wrapped object - */ - public AbstractDDNode(Object adapterNode){ - this.adapterNode = adapterNode; - image = null; - text = null; - description = null; - } - - public abstract List getChildren(); - - public abstract boolean hasChildren(); - - public void decorate(IDecoration decoration) { - // do nothing, subclasses should override - } - - public Image getImage() { - return image; - } - - public String getText() { - return text; - } - - public String getDescription() { - return description; - } - - public Object getAdapterNode() { - return adapterNode; - } - - public void reinit(JavaEEObject modelObject) { - adapterNode = modelObject; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AbstractGroupProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AbstractGroupProvider.java deleted file mode 100644 index 7a8168b94..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AbstractGroupProvider.java +++ /dev/null @@ -1,70 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; - -/** - * Abstract group Deployment Descriptor node that has a number of sub nodes - * (like Entity Beans, Session Beans, Message Driven Beans). - * - * - * @author Dimitar Giormov - * - */ -public abstract class AbstractGroupProvider { - - protected List children = new ArrayList<Object>(); - protected JavaEEObject javaee; - protected String text; - protected boolean isValid = true; - - public void setValid(boolean isValid) { - this.isValid = isValid; - } - - public AbstractGroupProvider(JavaEEObject javaee) { - this.javaee = javaee; - text = NLS.bind(Messages.DEPLOYMENT_DESCRIPTOR, javaee.toString()); - } - - public abstract List getChildren(); - - public abstract Image getImage(); - - public String getText() { - return text ; - } - - public boolean hasChildren() { - List children2 = getChildren(); - return children2 != null && !children2.isEmpty(); - } - - public JavaEEObject getJavaEEObject() { - return javaee; - } - - public void reinit(JavaEEObject modelObject) { - this.javaee = modelObject; - } - - public boolean isValid(){ - return isValid; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AppClient5ContentProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AppClient5ContentProvider.java deleted file mode 100644 index 28ee5ee4b..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AppClient5ContentProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.javaee.applicationclient.ApplicationClient; -import org.eclipse.jst.jee.ui.internal.navigator.appclient.GroupAppClientProvider; -import org.eclipse.jst.jee.ui.internal.navigator.ear.ModulesNode; - -/** - * Ear 5.0 Content provider is Deployment Descriptor content provider, - * used for constructing of the descriptor tree in project explorer. - * - * @author Dimitar Giormov - */ -public class AppClient5ContentProvider extends JEE5ContentProvider { - - - public Object[] getChildren(Object aParentElement) { - IProject project = null; - List children = new ArrayList(); - if (aParentElement instanceof GroupAppClientProvider) { - children.addAll(((GroupAppClientProvider) aParentElement).getChildren()); - } else if (aParentElement instanceof IAdaptable) { - project = (IProject) ((IAdaptable) aParentElement).getAdapter(IPROJECT_CLASS); - if (project != null && JavaEEProjectUtilities.isApplicationClientProject(project) && - J2EEProjectUtilities.isJEEProject(project)) { - AbstractGroupProvider cachedContentProvider = getCachedContentProvider(project); - if (cachedContentProvider != null){ - children.add(cachedContentProvider); - } - } - } - return children.toArray(); - } - - - - public boolean hasChildren(Object element) { - if (element instanceof GroupAppClientProvider) { - return !((GroupAppClientProvider) element).getChildren().isEmpty(); - } - return false; - } - - public Object getParent(Object object) { - if (object instanceof ModulesNode){ - return ((ModulesNode) object).getEarProject(); - } - return null; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - - - @Override - protected AbstractGroupProvider getNewContentProviderInstance(IProject project) { - return new GroupAppClientProvider((ApplicationClient) getCachedModelProvider(project).getModelObject(), project); - } - - - - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AppClient5LabelProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AppClient5LabelProvider.java deleted file mode 100644 index d6f5b2545..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/AppClient5LabelProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import org.eclipse.jst.j2ee.navigator.internal.J2EELabelProvider; -import org.eclipse.jst.jee.ui.internal.navigator.appclient.GroupAppClientProvider; -import org.eclipse.swt.graphics.Image; - -/** - * Application Clent 5.0 Label provider is Deployment Descriptor label provider, - * used for decorating of the descriptor tree in project explorer. - * - * @author Dimitar Giormov - */ -public class AppClient5LabelProvider extends J2EELabelProvider { - - @Override - public Image getImage(Object element) { - Image ret = null; - if (element instanceof GroupAppClientProvider) { - ret = ((GroupAppClientProvider)element).getImage(); - } - return ret; - } - - @Override - public String getText(Object element) { - String ret = null; - if (element instanceof GroupAppClientProvider) { - ret = ((GroupAppClientProvider) element).getText(); - } - return ret; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ConnectorContentProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ConnectorContentProvider.java deleted file mode 100644 index f5b332f30..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ConnectorContentProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.javaee.jca.Connector; -import org.eclipse.jst.jee.ui.internal.navigator.ra.RaGroupContentProvider; - -public class ConnectorContentProvider extends JEE5ContentProvider { - - public Object[] getChildren(Object aParentElement) { - List<Object> children = new ArrayList<Object>(); - IProject project = null; - if (IProject.class.isInstance(aParentElement)) { - project = (IProject) aParentElement; - AbstractGroupProvider cachedContentProvider = getCachedContentProvider(project); - if (cachedContentProvider!= null && cachedContentProvider.isValid()){ - children.add(cachedContentProvider); - } - } else if (AbstractGroupProvider.class.isInstance(aParentElement)){ - AbstractGroupProvider abstractGroupProvider = (AbstractGroupProvider) aParentElement; - if (abstractGroupProvider.hasChildren()){ - children.addAll(abstractGroupProvider.getChildren()); - } - } - return children.toArray(); - } - - public Object getParent(Object element) { - return null; - } - - public boolean hasChildren(Object element) { - return true; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - @Override - protected AbstractGroupProvider getNewContentProviderInstance(IProject project) { - return new RaGroupContentProvider((Connector)getCachedModelProvider(project).getModelObject(), project); - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ConnectorLabelProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ConnectorLabelProvider.java deleted file mode 100644 index 0397c6633..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ConnectorLabelProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator;
-
-import org.eclipse.jst.j2ee.navigator.internal.J2EELabelProvider;
-import org.eclipse.jst.javaee.jca.ConfigProperty;
-import org.eclipse.jst.javaee.jca.ConnectionDefinition;
-import org.eclipse.jst.javaee.jca.RequiredConfigProperty;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin;
-import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons;
-import org.eclipse.swt.graphics.Image;
-
-public class ConnectorLabelProvider extends J2EELabelProvider {
-
- private Image CONFIG_PROP_IMAGE;
- private Image LICENSE_IMAGE;
-
- @Override
- public String getText(Object element) {
- if (AbstractGroupProvider.class.isInstance(element)){
- return ((AbstractGroupProvider) element).getText();
- } else if (element instanceof org.eclipse.jst.javaee.jca.License){
- return Messages.ConnectorLabelProvider_LICENSE_ARTIFACT;
- } else if (element instanceof ConfigProperty){
- return Messages.ConnectorLabelProvider_CONFIG_PROPERTY + ((ConfigProperty)element).getConfigPropertyName() != null ? ((ConfigProperty)element).getConfigPropertyName() : ""; //$NON-NLS-1$
- } else if (element instanceof RequiredConfigProperty){
- return Messages.ConnectorLabelProvider_RequiredConfigProperty + ((RequiredConfigProperty)element).getConfigPropertyName() != null ? ((RequiredConfigProperty)element).getConfigPropertyName() : ""; //$NON-NLS-1$
- } else if (element instanceof ConnectionDefinition){
- return Messages.ConnectorLabelProvider_ConnectionDefinition + ((ConnectionDefinition)element).getManagedconnectionfactoryClass() != null ?((ConnectionDefinition)element).getManagedconnectionfactoryClass() : ""; //$NON-NLS-1$
- }
-
- return super.getText(element);
- }
-
- @Override
- public Image getImage(Object element) {
- if (AbstractGroupProvider.class.isInstance(element)){
- return ((AbstractGroupProvider) element).getImage();
- } else if (element instanceof ConfigProperty){
- if (CONFIG_PROP_IMAGE == null) {
- CONFIG_PROP_IMAGE = JEEUIPlugin.getDefault().getImage(JEEUIPluginIcons.IMG_CONFIG_PROP);
- }
- return CONFIG_PROP_IMAGE;
- } else if (element instanceof org.eclipse.jst.javaee.jca.License){
- if (LICENSE_IMAGE == null) {
- LICENSE_IMAGE = JEEUIPlugin.getDefault().getImage(JEEUIPluginIcons.IMG_LICENSE);
- }
- return LICENSE_IMAGE;
- }
- return super.getImage(element);
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/DDAdapterFactory.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/DDAdapterFactory.java deleted file mode 100644 index 01ae46dec..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/DDAdapterFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jdt.core.IJavaElement; - -public class DDAdapterFactory implements IAdapterFactory { - - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adapterType == IJavaElement.class) { - if (adaptableObject instanceof AbstractDDNode) { - AbstractDDNode ddNode = (AbstractDDNode) adaptableObject; - Object node = ddNode.getAdapterNode(); - if (node instanceof IJavaElement) - return node; - if (node instanceof IAdaptable) - return ((IAdaptable) node).getAdapter(IJavaElement.class); - - return Platform.getAdapterManager().getAdapter(node, IJavaElement.class); - } - } - return null; - } - - public Class[] getAdapterList() { - return new Class[] { IJavaElement.class }; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ear5ContentProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ear5ContentProvider.java deleted file mode 100644 index 60ed717e8..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ear5ContentProvider.java +++ /dev/null @@ -1,204 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.javaee.application.Application; -import org.eclipse.jst.jee.ui.internal.navigator.ear.AbstractEarNode; -import org.eclipse.jst.jee.ui.internal.navigator.ear.GroupEARProvider; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * Application Client 5.0 Content provider is Deployment Descriptor content provider, - * used for constructing of the descriptor tree in project explorer. - * - * @author Dimitar Giormov - */ -public class Ear5ContentProvider extends JEE5ContentProvider { - - private List getComponentReferencesAsList(List componentTypes, IVirtualComponent virtualComponent, IPath runtimePath) { - List components = new ArrayList(); - IVirtualComponent earComponent = virtualComponent; - if (earComponent != null ) { - IVirtualReference[] refComponents = earComponent.getReferences(); - for (int i = 0; i < refComponents.length; i++) { - IVirtualComponent module = refComponents[i].getReferencedComponent(); - if (module == null) continue; - // if component types passed in is null then return all components - if (componentTypes == null || componentTypes.size() == 0) { - components.add(refComponents[i]); - } else { - if (componentTypes.contains(JavaEEProjectUtilities.getJ2EEComponentType(module))) { - components.add(refComponents[i]); - } - } - } - } - return components; - } - - public IVirtualReference[] getUtilityModuleReferences(IVirtualComponent component) { - List explicitUtilityReferences = - getComponentReferencesAsList(Collections.singletonList(J2EEProjectUtilities.UTILITY), component, null); - - // fetch other Utility Jars attached to the EAR project - List implicitUtilityReferenceTypes = - Arrays.asList(new String[] { - IModuleConstants.JST_APPCLIENT_MODULE, - IModuleConstants.JST_WEB_MODULE, - IModuleConstants.JST_EJB_MODULE - }); - - List implicitUtilityReferences = - getComponentReferencesAsList(implicitUtilityReferenceTypes, component, null); - - List allUtilityModuleReferences = new ArrayList(); - allUtilityModuleReferences.addAll(explicitUtilityReferences); - allUtilityModuleReferences.addAll(implicitUtilityReferences); - - if(allUtilityModuleReferences.size() > 0) - return (IVirtualReference[]) allUtilityModuleReferences.toArray(new IVirtualReference[allUtilityModuleReferences.size()]); - return new IVirtualReference[0]; - - } - - public Object[] getChildren(Object aParentElement) { - IProject project = null; - List children = new ArrayList(); - if (aParentElement instanceof GroupEARProvider) { - children.addAll(((GroupEARProvider)aParentElement).getChildren()); - } else if (aParentElement instanceof AbstractEarNode) { - return ((AbstractEarNode) aParentElement).getModules().toArray(); - } else if (aParentElement instanceof IAdaptable) { - project = (IProject) ((IAdaptable) aParentElement).getAdapter(IPROJECT_CLASS); - if (project != null && JavaEEProjectUtilities.isEARProject(project)) { - IFacetedProject facetedProject; - try { - facetedProject = ProjectFacetsManager.create(project); - if (facetedProject != null && - (facetedProject.hasProjectFacet( - ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE).getVersion( - J2EEVersionConstants.VERSION_5_0_TEXT)) || facetedProject.hasProjectFacet( - ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE).getVersion( - J2EEVersionConstants.VERSION_6_0_TEXT)))) { - GroupEARProvider element = (GroupEARProvider) getCachedContentProvider(project); - if (element != null){ - children.add(element); - } - - } - } catch (CoreException e) { - String msg = "Error in the JEEContentProvider.getChildren() for parent:" + aParentElement; //$NON-NLS-1$ - JEEUIPlugin.logError(msg, e); - } - } - } - return children.toArray(); - } - - public boolean hasChildren(Object element) { - if (element instanceof AbstractEarNode) { - return ((AbstractEarNode) element).getModules().size() > 0; - } else if (element instanceof GroupEARProvider){ - return true; - } else return false; - } - - public Object getParent(Object object) { - if (object instanceof AbstractEarNode){ - return ((AbstractEarNode) object).getEarProject(); - } - return null; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - @Override - protected AbstractGroupProvider getNewContentProviderInstance(IProject project) { - return new GroupEARProvider((Application) getCachedModelProvider(project).getModelObject(), (EARVirtualComponent)ComponentCore.createComponent(project)); - } - - public EarLibVisitor getVisitor() { - return new EarLibVisitor(); - } - - protected class EarLibVisitor implements IResourceDeltaVisitor { - - private Set<IProject> projects = new HashSet<IProject>(); - - public boolean visit(IResourceDelta delta) throws CoreException { - IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED | IResourceDelta.REPLACED | IResourceDelta.CHANGED); - if (affectedChildren != null){ - for (int i = 0; i < affectedChildren.length; i++) { - if (affectedChildren[i].getResource() != null && affectedChildren[i].getResource().getName() != null - && (affectedChildren[i].getResource().getName().toLowerCase().endsWith(IJ2EEModuleConstants.JAR_EXT) - || (affectedChildren[i].getResource().getName().equals(IJ2EEModuleConstants.JST_COMPONENT_FILE) && affectedChildren[i].getKind()==IResourceDelta.CHANGED))){ - projects.add(affectedChildren[i].getResource().getProject()); - } - } - } - return true; - } - - protected Set<IProject> getChangedProject() { - return projects; - } - - } - - @Override - public void resourceChanged(IResourceChangeEvent event) { - super.resourceChanged(event); - if (event.getType() == IResourceChangeEvent.POST_CHANGE){ - EarLibVisitor visitor = getVisitor(); - if (visitor == null){ - return; - } - try { - event.getDelta().accept(visitor); - Set<IProject> changedProject = visitor.getChangedProject(); - for (IProject project : changedProject) { - projectChanged(project); - } - - } catch (CoreException e) { - JEEUIPlugin.logError("Could not refresh changed project.", e); //$NON-NLS-1$ - } - } - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ear5LabelProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ear5LabelProvider.java deleted file mode 100644 index 58ac50730..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ear5LabelProvider.java +++ /dev/null @@ -1,126 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - * IBM - bug 281382 clean up - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.net.URL; -import java.util.HashMap; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.navigator.internal.J2EELabelProvider; -import org.eclipse.jst.j2ee.navigator.internal.plugin.J2EENavigatorPlugin; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants; -import org.eclipse.jst.jee.ui.internal.navigator.ear.AbstractEarNode; -import org.eclipse.jst.jee.ui.internal.navigator.ear.GroupEARProvider; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.common.componentcore.internal.util.VirtualReferenceUtilities; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; - -/** - * EAR 5.0 Label provider is Deployment Descriptor label provider, - * used for decorating of the descriptor tree in project explorer. - * - * @author Dimitar Giormov - */ -public class Ear5LabelProvider extends J2EELabelProvider { - - private static ImageDescriptor IMG_MODULES_NODE; - private static ImageDescriptor IMG_MODULE_UTIL; - private static ImageDescriptor IMG_MODULE_WEB; - private static ImageDescriptor IMG_MODULE_EJB; - private static ImageDescriptor IMG_MODULE_CLIENT; - private static ImageDescriptor IMG_MODULE_CONNECTOR; - private static HashMap<String, ImageDescriptor> typeToDescriptor; - static { - try { - IMG_MODULES_NODE = J2EENavigatorPlugin.getDefault().getImageDescriptor("folder.gif"); //$NON-NLS-1$ - IMG_MODULE_UTIL = ImageDescriptor.createFromURL((URL) J2EEPlugin.getPlugin().getImage("utiljar_obj")); //$NON-NLS-1$ - IMG_MODULE_WEB = ImageDescriptor.createFromURL((URL) J2EEPlugin.getPlugin().getImage("full/obj16/module_web_obj")); //$NON-NLS-1$ - IMG_MODULE_EJB = ImageDescriptor.createFromURL((URL) J2EEPlugin.getPlugin().getImage("full/obj16/module_ejb_obj")); //$NON-NLS-1$ - IMG_MODULE_CLIENT = ImageDescriptor.createFromURL((URL) J2EEPlugin.getPlugin().getImage("module_clientapp_obj")); //$NON-NLS-1$ - IMG_MODULE_CONNECTOR = ImageDescriptor.createFromURL((URL) J2EEPlugin.getPlugin().getImage("full/obj16/connector_module")); //$NON-NLS-1$ - } catch (RuntimeException e) { - String msg = e.getMessage() != null ? e.getMessage() : e.toString(); - JEEUIPlugin.logError(msg, e); - IMG_MODULES_NODE = ImageDescriptor.getMissingImageDescriptor(); - IMG_MODULE_UTIL = ImageDescriptor.getMissingImageDescriptor(); - IMG_MODULE_WEB = ImageDescriptor.getMissingImageDescriptor(); - IMG_MODULE_EJB = ImageDescriptor.getMissingImageDescriptor(); - IMG_MODULE_CLIENT = ImageDescriptor.getMissingImageDescriptor(); - IMG_MODULE_CONNECTOR = ImageDescriptor.getMissingImageDescriptor(); - } - typeToDescriptor = new HashMap<String, ImageDescriptor>(); - typeToDescriptor.put(IJ2EEFacetConstants.APPLICATION_CLIENT, IMG_MODULE_CLIENT); - typeToDescriptor.put(IJ2EEFacetConstants.DYNAMIC_WEB, IMG_MODULE_WEB); - typeToDescriptor.put(IJ2EEFacetConstants.EJB, IMG_MODULE_EJB); - typeToDescriptor.put(IJ2EEFacetConstants.JCA, IMG_MODULE_CONNECTOR); - typeToDescriptor.put(IJ2EEFacetConstants.UTILITY, IMG_MODULE_UTIL); - } - - @Override - public Image getImage(Object element) { - Image ret = null; - if (element instanceof AbstractEarNode) { - ret = J2EENavigatorPlugin.getDefault().getImage(IMG_MODULES_NODE); - } else if (element instanceof IVirtualReference) { - IVirtualComponent component = ((IVirtualReference) element).getReferencedComponent(); - if (component.isBinary()) { - ret = J2EENavigatorPlugin.getDefault().getImage(IMG_MODULE_UTIL); - } else { - String type = JavaEEProjectUtilities.getJ2EEComponentType(component); - ImageDescriptor desc = typeToDescriptor.get(type); - ret = J2EENavigatorPlugin.getDefault().getImage(desc == null ? IMG_MODULE_UTIL : desc); - } - } else if (element instanceof GroupEARProvider){ - ret = ((GroupEARProvider) element).getImage(); - } - return ret; - } - - @Override - public String getText(Object element) { - String ret = null; - if (element instanceof AbstractEarNode) { - ret = ((AbstractEarNode) element).getText(); - } else if (element instanceof IVirtualReference) { - IVirtualComponent component = ((IVirtualReference) element).getReferencedComponent(); - String archiveName = ((IVirtualReference)element).getArchiveName(); - if( component.isBinary()) { - ret = archiveName != null ? archiveName : (new Path(component.getDeployedName()).lastSegment()); - } else { - // more efficient to get type once - String type = JavaEEProjectUtilities.getJ2EEComponentType(component); - if( archiveName == null ) - archiveName = VirtualReferenceUtilities.INSTANCE.getDefaultArchiveName((IVirtualReference)element); - - if( type.equals(IJ2EEFacetConstants.DYNAMIC_WEB)) - ret = "Web " + archiveName; //$NON-NLS-1$ - else if( type.equals(IJ2EEFacetConstants.EJB)) - ret = "EJB " + archiveName;//$NON-NLS-1$ - else if( type.equals(IJ2EEFacetConstants.APPLICATION_CLIENT)) - ret = "APP Client " + archiveName;//$NON-NLS-1$ - else if( type.equals(IJ2EEFacetConstants.JCA)) - ret = "Connector " + archiveName;//$NON-NLS-1$ - else if( type.equals(IJ2EEFacetConstants.UTILITY)) - ret = archiveName; - } - } else if (element instanceof GroupEARProvider){ - ret = ((GroupEARProvider) element).getText(); - } - return ret; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ejb3ContentProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ejb3ContentProvider.java deleted file mode 100644 index 2cf5088eb..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ejb3ContentProvider.java +++ /dev/null @@ -1,218 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants; -import org.eclipse.jst.javaee.ejb.EJBJar; -import org.eclipse.jst.javaee.ejb.EntityBean; -import org.eclipse.jst.javaee.ejb.MessageDrivenBean; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.jst.jee.ui.internal.navigator.JndiRefNode.KINDS; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.ActivationConfigProperties; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.BeanInterfaceNode; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.BeanNode; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEJBProvider; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * Ejb 3.0 Content provider is Deployment Descriptor content provider, - * used for constructing of the descriptor tree in project explorer. - * - * @author Dimitar Giormov - */ -public class Ejb3ContentProvider extends JEE5ContentProvider { - - - public Object[] getChildren(Object aParentElement) { - List<Object> children = new ArrayList<Object>(); - IProject project = null; - - if (aParentElement instanceof AbstractGroupProvider) { - List lst = ((AbstractGroupProvider) aParentElement).getChildren(); - children.addAll(lst); - } else if (aParentElement instanceof AbstractDDNode) { - List lst = ((AbstractDDNode) aParentElement).getChildren(); - children.addAll(lst); - } else if (aParentElement instanceof SessionBean) { - SessionBean sb = ((SessionBean)aParentElement); - addSessionBeanSubNodes(sb, children); - - } else if (aParentElement instanceof EntityBean) { - EntityBean eb = ((EntityBean)aParentElement); - - addEntityBeanSubNodes(eb, children); - - } else if (aParentElement instanceof MessageDrivenBean) { - Object msgBean = new BeanNode((MessageDrivenBean) aParentElement); - addActivationConfigProperties((MessageDrivenBean) aParentElement, children); - if(((MessageDrivenBean) aParentElement).getEjbClass()!=null){ - children.add(msgBean); - } - } else - if (aParentElement instanceof IAdaptable) { - project = (IProject) ((IAdaptable) aParentElement) - .getAdapter(IPROJECT_CLASS); - if (project != null) { - if (isEjbModuleProject(project)) { - GroupEJBProvider root = (GroupEJBProvider) getCachedContentProvider(project); - if (root != null) { - children.add(root); - } - } - } - } - return children.toArray(); - } - - private void addActivationConfigProperties(MessageDrivenBean parentElement, - List<Object> children) { - if (parentElement.getActivationConfig() != null && parentElement.getActivationConfig().getActivationConfigProperties() != null && !parentElement.getActivationConfig().getActivationConfigProperties().isEmpty()){ - children.add(new ActivationConfigProperties(parentElement.getActivationConfig().getActivationConfigProperties())); - } - } - - private void addEntityBeanSubNodes(EntityBean eb, List<Object> children) { - if (eb.getLocal() != null) { - children.add(new BeanInterfaceNode(eb, eb.getLocal(), BeanInterfaceNode.KINDS.LOCAL)); - } - if (eb.getLocalHome() != null) { - children.add(new BeanInterfaceNode(eb, eb.getLocalHome(), BeanInterfaceNode.KINDS.LOCAL_HOME)); - } - - if (eb.getRemote() != null) { - children.add(new BeanInterfaceNode(eb, eb.getRemote(), BeanInterfaceNode.KINDS.REMOTE)); - } - if (eb.getHome() != null) { - children.add(new BeanInterfaceNode(eb, eb.getHome(), BeanInterfaceNode.KINDS.REMOTE_HOME)); - } - - if (eb.getEjbClass() != null) { - children.add(new BeanNode(eb)); - } - - } - - private void addSessionBeanSubNodes(SessionBean sb, List children) { - addClassRelatedInfo(sb, children); - addSessionJNDIRefInfo(sb, children); - } - - private void addSessionJNDIRefInfo(SessionBean sb, List children) { - if (sb.getEjbLocalRefs() != null && !sb.getEjbLocalRefs().isEmpty()){ - children.add(new JndiRefNode(sb.getEjbLocalRefs(), KINDS.EJBLOCALREF)); - } - - if (sb.getEjbRefs() != null && !sb.getEjbRefs().isEmpty()){ - children.add(new JndiRefNode(sb.getEjbRefs(), KINDS.EJBREF)); - } - - if (sb.getResourceEnvRefs() != null && !sb.getResourceEnvRefs().isEmpty()){ - children.add(new JndiRefNode(sb.getResourceEnvRefs(), KINDS.RESENVENTY)); - } - if (sb.getEnvEntries() != null && !sb.getEnvEntries().isEmpty()){ - children.add(new JndiRefNode(sb.getEnvEntries(), KINDS.ENVENTRY)); - } - - if (sb.getResourceRefs() != null && !sb.getResourceRefs().isEmpty()){ - children.add(new JndiRefNode(sb.getResourceRefs(), KINDS.RESREF)); - } - - if (sb.getServiceRefs() != null && !sb.getServiceRefs().isEmpty()){ - children.add(new JndiRefNode(sb.getServiceRefs(), KINDS.SERVICEREF)); - } - } - - private void addClassRelatedInfo(SessionBean sb, List children) { - if (sb.getLocal() != null) { - children.add(new BeanInterfaceNode(sb, sb.getLocal(), BeanInterfaceNode.KINDS.LOCAL)); - } - - if (sb.getLocalHome() != null) { - children.add(new BeanInterfaceNode(sb, sb.getLocalHome(), BeanInterfaceNode.KINDS.LOCAL_HOME)); - } - - if (sb.getRemote() != null) { - children.add(new BeanInterfaceNode(sb, sb.getRemote(), BeanInterfaceNode.KINDS.REMOTE)); - } - - if (sb.getHome() != null) { - children.add(new BeanInterfaceNode(sb, sb.getHome(), BeanInterfaceNode.KINDS.REMOTE_HOME)); - } - - if (sb.getEjbClass() != null) { - children.add(new BeanNode(sb)); - } - - List r = sb.getBusinessLocals(); - for (Object locals : r) { - children.add(new BeanInterfaceNode(sb, (String)locals, BeanInterfaceNode.KINDS.BUSSINESS_LOCAL)); - } - - r = sb.getBusinessRemotes(); - for (Object locals : r) { - children.add(new BeanInterfaceNode(sb, (String)locals, BeanInterfaceNode.KINDS.BUSSINESS_REMOTE)); - } - } - - private boolean isEjbModuleProject(IProject project) { - try { - IFacetedProject facetedProject = ProjectFacetsManager.create(project); - //EE6TODO - IProjectFacetVersion installedVersion = facetedProject.getInstalledVersion(ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.EJB).getVersion(IJ2EEFacetConstants.EJB_30.getVersionString()).getProjectFacet()); - return installedVersion != null; - } catch (CoreException e) { - JEEUIPlugin.logError("Can not acces project", e); //$NON-NLS-1$ - } - return false; - } - - public boolean hasChildren(Object element) { - if (element instanceof AbstractGroupProvider) { - return ((AbstractGroupProvider) element).hasChildren(); - } else if (element instanceof AbstractDDNode) { - return ((AbstractDDNode) element).hasChildren(); - } else if (element instanceof SessionBean) { - return true; - } else if (element instanceof EntityBean) { - return true; - }else if (element instanceof MessageDrivenBean) { - return true; - } else - return false; - } - - public Object getParent(Object element) { - return null; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - @Override - protected AbstractGroupProvider getNewContentProviderInstance(IProject project) { - IModelProvider cachedModelProvider = getCachedModelProvider(project); - GroupEJBProvider root = new GroupEJBProvider((EJBJar) cachedModelProvider.getModelObject()); - root.setProjectName(project.getName()); - return root; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ejb3LabelProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ejb3LabelProvider.java deleted file mode 100644 index a5a5d5eb2..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Ejb3LabelProvider.java +++ /dev/null @@ -1,214 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008, 2010 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.net.URL; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.j2ee.internal.provider.J2EEAdapterFactoryLabelProvider; -import org.eclipse.jst.j2ee.navigator.internal.IJ2EENavigatorConstants; -import org.eclipse.jst.j2ee.navigator.internal.J2EELabelProvider; -import org.eclipse.jst.j2ee.navigator.internal.LoadingDDNode; -import org.eclipse.jst.javaee.core.EjbLocalRef; -import org.eclipse.jst.javaee.core.EjbRef; -import org.eclipse.jst.javaee.core.EnvEntry; -import org.eclipse.jst.javaee.core.ResourceEnvRef; -import org.eclipse.jst.javaee.core.ResourceRef; -import org.eclipse.jst.javaee.core.ServiceRef; -import org.eclipse.jst.javaee.ejb.ActivationConfigProperty; -import org.eclipse.jst.javaee.ejb.EntityBean; -import org.eclipse.jst.javaee.ejb.MessageDrivenBean; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEJBProvider; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.common.internal.emfworkbench.integration.DynamicAdapterFactory; - -/** - * Ejb 3.0 Label provider is Deployment Descriptor label provider, - * used for decorating of the descriptor tree in project explorer. - * - * @author Dimitar Giormov - * @author Kaloyan Raev - */ -public class Ejb3LabelProvider extends J2EELabelProvider { - - private Image ejb30Image; - private Image ejb31Image; - private Image sessionBeanImage; - private Image mdbImage; - private Image cmpImage; - private Image ejbRefImage; - private Image resourceRefImage; - private Image serviceRefImage; - private Image activationConfigImage; - - public Ejb3LabelProvider() { - new J2EEAdapterFactoryLabelProvider(new DynamicAdapterFactory(IJ2EENavigatorConstants.VIEWER_ID)); - } - - @Override - public Image getImage(Object element) { - if(element instanceof LoadingDDNode) { - return ((LoadingDDNode)element).getImage(); - } else if (element instanceof IProject || element instanceof IJavaProject) { - return null; - } else if (element instanceof GroupEJBProvider) { - String version = ((GroupEJBProvider) element).getEjbJar().getVersion(); - if (J2EEVersionConstants.VERSION_3_0_TEXT.equals(version)) { - return getEjb30Image(); - } else if (J2EEVersionConstants.VERSION_3_1_TEXT.equals(version)) { - return getEjb31Image(); - } - return getEjb30Image(); - } else if(element instanceof AbstractDDNode) { - return ((AbstractDDNode) element).getImage(); - } else if (element instanceof SessionBean) { - return getSessionBeanImage(); - } else if (element instanceof MessageDrivenBean) { - return getMDBImage(); - } else if (element instanceof EntityBean){ - return getCMPImage(); - } else if (element instanceof EjbLocalRef || element instanceof EjbRef) { - return getEjbRefImage(); - } else if (element instanceof EnvEntry) { - return getResourceRefImage(); - } else if (element instanceof ResourceEnvRef) { - return getResourceRefImage(); - } else if (element instanceof ResourceRef) { - return getResourceRefImage(); - } else if (element instanceof ServiceRef) { - return getServiceRefImage(); - } else if(element instanceof ActivationConfigProperty) { - return getActivationConfigImage(); - } - - return null; - } - - @Override - public String getText(Object element) { - String ret = null; - if (element instanceof SessionBean || element instanceof MessageDrivenBean || element instanceof EntityBean) { - ret = (element instanceof SessionBean) ? ((SessionBean) element).getEjbName() : - (element instanceof MessageDrivenBean) ? ((MessageDrivenBean) element).getEjbName() : - (element instanceof EntityBean) ? ((EntityBean) element).getEjbName() : null; - } else if (element instanceof AbstractDDNode) { - ret = ((AbstractDDNode) element).getText(); - } else if (element instanceof AbstractGroupProvider) { - ret = ((AbstractGroupProvider) element).getText(); - } else if (element instanceof EjbLocalRef || element instanceof EjbRef){ - ret = element instanceof EjbLocalRef ? ((EjbLocalRef)element).getEjbRefName() : element instanceof EjbRef ? ((EjbRef)element).getEjbRefName() : null; - } else if (element instanceof EnvEntry){ - ret = ((EnvEntry) element).getEnvEntryName(); - } else if (element instanceof ResourceEnvRef){ - ret = ((ResourceEnvRef) element).getResourceEnvRefName(); - } else if (element instanceof ResourceRef){ - ret = ((ResourceRef) element).getResRefName(); - } else if (element instanceof ServiceRef){ - ret = ((ServiceRef) element).getServiceRefName(); - } else if(element instanceof ActivationConfigProperty){ - ret = ((ActivationConfigProperty)element).getActivationConfigPropertyName() + ":" +((ActivationConfigProperty)element).getActivationConfigPropertyValue(); //$NON-NLS-1$ - } - - return ret; - } - - @Override - public String getDescription(Object anElement) { - String description = super.getDescription(anElement); - - if (anElement instanceof AbstractDDNode) { - String desc = ((AbstractDDNode) anElement).getDescription(); - if (desc != null) { - description = desc; - } - } - - return description; - } - - private Image getEjb30Image() { - if (ejb30Image == null) { - ejb30Image = JEEUIPlugin.getDefault().getImageDescriptor(JEEUIPluginIcons.IMG_EJBEEMODEL).createImage(); - } - return ejb30Image; - } - - private Image getEjb31Image() { - if (ejb31Image == null) { - ejb31Image = JEEUIPlugin.getDefault().getImageDescriptor(JEEUIPluginIcons.IMG_EJBEE6MODEL).createImage(); - } - return ejb31Image; - } - - private Image getSessionBeanImage() { - if (sessionBeanImage == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage("sessionBean_obj"); //$NON-NLS-1$ - sessionBeanImage = ImageDescriptor.createFromURL(url).createImage(); - } - return sessionBeanImage; - } - - private Image getMDBImage() { - if (mdbImage == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage("message_bean_obj"); //$NON-NLS-1$ - mdbImage = ImageDescriptor.createFromURL(url).createImage(); - } - return mdbImage; - } - - private Image getCMPImage() { - if (cmpImage == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage("cmpEntity_obj"); //$NON-NLS-1$ - cmpImage = ImageDescriptor.createFromURL(url).createImage(); - } - return cmpImage; - } - - private Image getEjbRefImage() { - if (ejbRefImage == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage("ejbRef_obj"); //$NON-NLS-1$ - ejbRefImage = ImageDescriptor.createFromURL(url).createImage(); - } - return ejbRefImage; - } - - private Image getResourceRefImage() { - if (resourceRefImage == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage("resourceRef_obj"); //$NON-NLS-1$ - resourceRefImage = ImageDescriptor.createFromURL(url).createImage(); - } - return resourceRefImage; - } - - private Image getServiceRefImage() { - if (serviceRefImage == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage("attribute_obj"); //$NON-NLS-1$ - serviceRefImage = ImageDescriptor.createFromURL(url).createImage(); - } - return serviceRefImage; - } - - private Image getActivationConfigImage() { - if (activationConfigImage == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage("access_intent_obj"); //$NON-NLS-1$ - activationConfigImage = ImageDescriptor.createFromURL(url).createImage(); - } - return activationConfigImage; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JEE5ContentProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JEE5ContentProvider.java deleted file mode 100644 index 9da9bf81b..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JEE5ContentProvider.java +++ /dev/null @@ -1,262 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderEvent; -import org.eclipse.jst.j2ee.model.IModelProviderListener; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.navigator.internal.EMFRootObjectProvider.IRefreshHandlerListener; -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.javaee.ejb.EntityBean; -import org.eclipse.jst.javaee.ejb.MessageDrivenBean; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Item; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.progress.UIJob; -import org.eclipse.wst.common.componentcore.ModuleCoreNature; - -public abstract class JEE5ContentProvider implements ITreeContentProvider, IRefreshHandlerListener, IModelProviderListener, IResourceChangeListener { - - protected Viewer viewer; - protected static final Class IPROJECT_CLASS = IProject.class; - - protected static Map<IProject, IModelProvider> groupProvidersMap = new HashMap<IProject, IModelProvider>(); - - protected static Map<IProject, AbstractGroupProvider> groupContentProviders = new HashMap<IProject, AbstractGroupProvider>(); - - - public JEE5ContentProvider() { - ResourcesPlugin.getWorkspace().addResourceChangeListener(this); - } - - public void inputChanged(Viewer aViewer, Object anOldInput, Object aNewInput) { - viewer = aViewer; - } - - - protected IModelProvider getCachedModelProvider(IProject project) { - IModelProvider provider = groupProvidersMap.get(project); - if (provider == null){ - provider = ModelProviderManager.getModelProvider(project); - provider.addListener(this); - groupProvidersMap.put(project,provider); - } - return provider; - } - - protected AbstractGroupProvider getCachedContentProvider(IProject project) { - AbstractGroupProvider provider = groupContentProviders.get(project); - if (provider == null){ - if (project == null || !project.isAccessible()){ - return null; - } - // if the project is no longer a valid flexible project (due to deletion of critical files) - if (!ModuleCoreNature.isFlexibleProject(project)){ - return null; - } - provider = getNewContentProviderInstance(project); - groupContentProviders.put(project, provider); - } else { - if (!project.isAccessible()){ - return null; - } - Object modelObject = ModelProviderManager.getModelProvider(project).getModelObject(); - if (provider.getJavaEEObject() != modelObject){ - if (modelObject == null){ - provider.setValid(false); - return provider; - } - - provider.reinit((JavaEEObject)modelObject); - } - } - return provider; - } - - protected abstract AbstractGroupProvider getNewContentProviderInstance(IProject project); - - - public void projectChanged(final IProject project) { - try { - Runnable refreshThread = new Runnable() { - public void run() { - if (viewer != null) { - try{ - - if( viewer.getControl() != null && !viewer.getControl().isDisposed() ){ - viewer.getControl().setRedraw(false); - ISelection sel = ((TreeViewer) viewer).getSelection(); - ITreeContentProvider contentProvider = ((ITreeContentProvider) ((TreeViewer) viewer) - .getContentProvider()); - contentProvider.getChildren(project); - Object[] expandedElements = ((TreeViewer) viewer).getExpandedElements(); - - ((StructuredViewer) viewer).refresh(project); - ((TreeViewer) viewer).setSelection(sel); - - expandElements(expandedElements); - } - - }finally{ - if( viewer.getControl() != null && !viewer.getControl().isDisposed() ){ - viewer.getControl().setRedraw(true); - } - } - } - } - - private void expandElements(Object[] expandedElements) { - ArrayList<Object> newExpandedElements = new ArrayList<Object>(); - - ArrayList<Object> allElements = new ArrayList<Object>(); - getViewerElements(allElements, ((TreeViewer) viewer).getControl()); - - Object[] expandedElementsAfterRefresh = ((TreeViewer) viewer).getExpandedElements(); - newExpandedElements.addAll(Arrays.asList(expandedElementsAfterRefresh)); - for(int i=0;i < expandedElements.length;i++){ - boolean expanded = false; - for(int j=0;j < expandedElementsAfterRefresh.length; j++){ - if(expandedElements[i].equals(expandedElementsAfterRefresh[j])){ - expanded = true; - break; - } - } - if(expanded){ - for(Object ob : allElements){ - if(ob instanceof SessionBean - && expandedElements[i] instanceof SessionBean){ - SessionBean bean = (SessionBean) ob; - SessionBean bean2 = (SessionBean) expandedElements[i]; - if(bean.getEjbName().equals(bean2.getEjbName())){ - newExpandedElements.add(ob); - } - } - if(ob instanceof MessageDrivenBean - && expandedElements[i] instanceof MessageDrivenBean){ - MessageDrivenBean bean = (MessageDrivenBean) ob; - MessageDrivenBean bean2 = (MessageDrivenBean) expandedElements[i]; - if(bean.getEjbName().equals(bean2.getEjbName())){ - newExpandedElements.add(ob); - } - } - if(ob instanceof EntityBean - && expandedElements[i] instanceof EntityBean){ - EntityBean bean = (EntityBean) ob; - EntityBean bean2 = (EntityBean) expandedElements[i]; - if(bean.getEjbName().equals(bean2.getEjbName())){ - newExpandedElements.add(ob); - } - } - } - } - } - ((TreeViewer) viewer).setExpandedElements(newExpandedElements.toArray()); - } - }; - Display.getDefault().asyncExec(refreshThread); - } catch (Exception e) - { - JEEUIPlugin.logError("Error during refresh", e); //$NON-NLS-1$ - } - } - - private void getViewerElements(List result, Widget widget) { - Item[] items = getChildren(widget); - for (int i = 0; i < items.length; i++) { - Item item = items[i]; - result.add(item.getData()); - getViewerElements(result, item); - } - } - - protected Item[] getChildren(Widget o) { - if (o instanceof TreeItem) { - return ((TreeItem) o).getItems(); - } - if (o instanceof Tree) { - return ((Tree) o).getItems(); - } - return null; - } - - public void modelsChanged(IModelProviderEvent event) { - projectChanged(event.getProject()); - - } - - public void onRefresh(final Object element) { - if (viewer instanceof AbstractTreeViewer) { - if (Display.getCurrent() != null) { - ((AbstractTreeViewer) viewer).refresh(element, true); - } else { - /* Create and schedule a UI Job to update the Navigator Content Viewer */ - Job job = new UIJob("Update the Navigator Content Viewer Job") { //$NON-NLS-1$ - @Override - public IStatus runInUIThread(IProgressMonitor monitor) { - ((AbstractTreeViewer) viewer).refresh(element, true); - return Status.OK_STATUS; - } - }; - ISchedulingRule rule = new ISchedulingRule() { - public boolean contains(ISchedulingRule rule) { - return rule == this; - } - public boolean isConflicting(ISchedulingRule rule) { - return rule == this; - } - }; - job.setRule(rule); - job.schedule(); - } - } - } - - public void dispose() { - groupProvidersMap.clear(); - groupContentProviders.clear(); - } - - public void resourceChanged(IResourceChangeEvent event) { - if (event.getType() == IResourceChangeEvent.PRE_DELETE && event.getResource() != null && event.getResource().getType() == IResource.PROJECT){ - groupContentProviders.remove(event.getResource()); - groupProvidersMap.remove(event.getResource()); - } - - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JEEActionProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JEEActionProvider.java deleted file mode 100644 index 7c0c02bcf..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JEEActionProvider.java +++ /dev/null @@ -1,243 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.internal.provider.J2EEUtilityJarItemProvider; -import org.eclipse.jst.jee.ui.internal.navigator.appclient.GroupAppClientProvider; -import org.eclipse.jst.jee.ui.internal.navigator.ear.GroupEARProvider; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.BeanInterfaceNode; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.BeanNode; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEJBProvider; -import org.eclipse.jst.jee.ui.internal.navigator.ra.RaGroupContentProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.WebAppProvider; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.ActionContext; -import org.eclipse.ui.actions.OpenWithMenu; -import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; -import org.eclipse.ui.navigator.CommonActionProvider; -import org.eclipse.ui.navigator.ICommonActionConstants; -import org.eclipse.ui.navigator.ICommonActionExtensionSite; -import org.eclipse.ui.navigator.ICommonMenuConstants; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; - -/** - * Standard operations Java EE Action Provider. - * Introduces standard operations for Deployment descriptor tree nodes. (like open) - * - * @author Dimitar Giormov - * - */ -public class JEEActionProvider extends CommonActionProvider { - -private static final Class IRESOURCE_CLASS = IResource.class; - - private OpenJEEResourceAction openAction; - - /** - * - */ - public JEEActionProvider() { - } - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.navigator.internal.views.actions.ICommonActionProvider#init(org.eclipse.ui.IViewPart, - * org.eclipse.jface.viewers.StructuredViewer, - * org.eclipse.wst.common.navigator.internal.views.extensions.NavigatorContentService) - */ - @Override - public void init(ICommonActionExtensionSite aConfig) { - openAction = new OpenJEEResourceAction(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.navigator.internal.views.actions.ICommonActionProvider#setActionContext(org.eclipse.ui.actions.ActionContext) - */ - @Override - public void setContext(ActionContext aContext) { - - if (aContext != null && aContext.getSelection() instanceof IStructuredSelection) { - IStructuredSelection selection = (IStructuredSelection) aContext.getSelection(); - - openAction.selectionChanged(selection); - - Object[] array = selection.toArray(); - if (isUtilityJars(array)) { - J2EEUtilityJarItemProvider utilityJarItemProvider = null; - List newSelection = new ArrayList(); - for (int i = 0; i < array.length; i++) { - utilityJarItemProvider = (J2EEUtilityJarItemProvider) array[i]; - newSelection.addAll(utilityJarItemProvider.getChildren(null)); - } - selection = new StructuredSelection(newSelection); - } - } - super.setContext(aContext); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.navigator.internal.views.actions.ICommonActionProvider#fillActionBars(org.eclipse.ui.IActionBars) - */ - @Override - public void fillActionBars(IActionBars theActionBars) { - if(openAction.isEnabled()) - theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openAction); - return; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.common.navigator.internal.views.actions.ICommonActionProvider#fillContextMenu(org.eclipse.jface.action.IMenuManager) - */ - @Override - public void fillContextMenu(IMenuManager aMenu) { - if (getContext()==null || getContext().getSelection().isEmpty()) - return; - IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); - if(!adaptsToResource(selection.toArray())) { - openAction.selectionChanged(selection); -// createAction.selectionChanged(selection); - if (openAction.isEnabled()) - aMenu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openAction); -// if (createAction.isEnabled()) -// aMenu.insertAfter(ICommonMenuConstants.GROUP_OPEN, createAction); - addOpenWithMenu(aMenu); - - } - } - - private boolean adaptsToResource(Object[] objects) { - for (int i = 0; i < objects.length; i++) { - if(objects[i] instanceof IResource) { - return true; - } else if (objects[i] instanceof IAdaptable && (((IAdaptable)objects[i]).getAdapter(IRESOURCE_CLASS) != null)) { - return true; - } - } - return false; - } - private boolean isUtilityJars(Object[] items) { - if (items != null) { - for (int i = 0; i < items.length; i++) { - if (items[i] == null || items[i].getClass() != J2EEUtilityJarItemProvider.class) - return false; - } - return true; - } - return false; - } - - private void addOpenWithMenu(IMenuManager menu) { - ISelection selection= getContext().getSelection(); - if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) - return; - IStructuredSelection ss= (IStructuredSelection)selection; - if (ss.size() != 1) - return; - - Object srcObject = ss.getFirstElement(); - Object resource = null; - - if (srcObject instanceof EObject) { - resource = openEObject((EObject) srcObject); - } else if (srcObject instanceof BeanInterfaceNode) { - resource = ((BeanInterfaceNode) srcObject).get_fqn(); - } else if (srcObject instanceof BeanNode) { - resource = ((BeanNode) srcObject).getEjbClassQualifiedName(); - - } else if (srcObject instanceof WebAppProvider) { - IFile file = ((WebAppProvider) srcObject).getDDFile(); - if (file.isAccessible()){ - resource = file; - } - } else if (srcObject instanceof RaGroupContentProvider) { - IFile file = WorkbenchResourceHelper.getFile((EObject) ((AbstractGroupProvider)srcObject).getJavaEEObject()); - if (file.isAccessible()){ - resource = file; - } - } else if (srcObject instanceof GroupAppClientProvider) { - IFile file = ((GroupAppClientProvider) srcObject).getDDFile(); - if (file.isAccessible()){ - resource = file; - } - } else if (srcObject instanceof GroupEJBProvider) { - IFile file = WorkbenchResourceHelper.getFile((EObject)((GroupEJBProvider)srcObject).getEjbJar()); - if (file.isAccessible()){ - resource = file; - } - } else if (srcObject instanceof GroupEARProvider) { - IFile file = ((GroupEARProvider) srcObject).getDDFile(); - if (file.isAccessible()){ - resource = file; - } - } - - if (!(resource instanceof IFile)) - return; - - // Create a menu. - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage(); - IMenuManager submenu= new MenuManager(WorkbenchNavigatorMessages.OpenActionProvider_OpenWithMenu_label, - ICommonMenuConstants.GROUP_OPEN_WITH); - submenu.add(new OpenWithMenu(page, (IFile) resource)); - - // Add the submenu. - menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, submenu); - } - - private IResource openEObject(EObject _srcObject) { -// EObject ro = _srcObject; -// IResource resource = WorkbenchResourceHelper -// .getFile(_srcObject); -// if (resource != null) { -// return resource; -// } -// ModuleFile moduleFile = ArchiveUtil.getModuleFile(ro); -// if (moduleFile != null) { -// ArchiveOptions options = moduleFile.getOptions(); -// if (options instanceof ComponentArchiveOptions) { -// IVirtualComponent component = ((ComponentArchiveOptions) options) -// .getComponent(); -//// openAppropriateEditor(component); -// } -// } else { -// IArchive archive = JavaEEArchiveUtilities.findArchive(ro); -// if(archive != null){ -// IVirtualComponent component = JavaEEArchiveUtilities.findComponent(archive); -// if(component != null){ -//// openAppropriateEditor(component); -// } -// } -// } - - return null; - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JndiRefNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JndiRefNode.java deleted file mode 100644 index b19a53a43..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/JndiRefNode.java +++ /dev/null @@ -1,126 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.net.URL; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.swt.graphics.Image; - -/** - * Deployment Descriptor node that contains information about JNDI references. - * Like: Ejb reference, Ejb Local Reference, Resource Reference, Resource Environment Reference, - * Environment Entry, Service Reference - * - * @author Dimitar Giormov - * - */ -public class JndiRefNode extends AbstractDDNode { - - private final int kind; - - public class KINDS { - public static final int EJBLOCALREF = 0; - public static final int EJBREF = 1; - public static final int ENVENTRY = 2; - public static final int RESENVENTY = 3; - public static final int RESREF = 4; - public static final int SERVICEREF = 5; - } - - public JndiRefNode(Object adapterNode, int kind) { - super(adapterNode); - this.kind = kind; - - } - - public int getKind() { - return kind; - } - - @Override - public List getChildren() { - return (List) adapterNode; - } - - @Override - public String getText() { - switch (kind) { - case KINDS.EJBLOCALREF: - return Messages.EJBLOCAL_REFERENCES; - - case KINDS.EJBREF: - return Messages.EJB_REFERENCES; - case KINDS.ENVENTRY: - return Messages.ENVIROMENT_ENTRIES; - case KINDS.RESENVENTY: - return Messages.RESOURCE_ENVIROMENT_ENTRIES; - case KINDS.RESREF: - return Messages.RESOURCE_REFERENCES; - case KINDS.SERVICEREF: - return Messages.SERVICE_REFERENCES; - - default: - break; - } - return super.getText(); - } - - @Override - public Image getImage() { - switch (kind) { - case KINDS.EJBLOCALREF:{ - URL url = (URL) J2EEPlugin.getPlugin().getImage("ejbRef_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } - case KINDS.EJBREF:{ - URL url = (URL) J2EEPlugin.getPlugin().getImage("ejbRef_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } - - case KINDS.ENVENTRY: - { - URL url = (URL) J2EEPlugin.getPlugin().getImage("resourceRef_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } - case KINDS.RESENVENTY: - { - URL url = (URL) J2EEPlugin.getPlugin().getImage("resourceRef_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } - case KINDS.RESREF: - { - URL url = (URL) J2EEPlugin.getPlugin().getImage("resourceRef_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } - case KINDS.SERVICEREF: - { - URL url = (URL) J2EEPlugin.getPlugin().getImage("resourceRef_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } - - default: - break; - } - return super.getImage(); - } - - - @Override - public boolean hasChildren() { - - return true; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/OpenJEEResourceAction.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/OpenJEEResourceAction.java deleted file mode 100644 index 6a87b0ba4..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/OpenJEEResourceAction.java +++ /dev/null @@ -1,557 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TreePath; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions; -import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.actions.AbstractOpenAction; -import org.eclipse.jst.j2ee.internal.actions.ComponentEditorInput; -import org.eclipse.jst.j2ee.internal.archive.JavaEEArchiveUtilities; -import org.eclipse.jst.j2ee.internal.componentcore.ComponentArchiveOptions; -import org.eclipse.jst.j2ee.internal.ejb.provider.J2EEJavaClassProviderHelper; -import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webservice.wsdd.BeanLink; -import org.eclipse.jst.javaee.core.EjbLocalRef; -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.javaee.core.Listener; -import org.eclipse.jst.javaee.core.ResourceRef; -import org.eclipse.jst.javaee.core.internal.impl.EjbLocalRefImpl; -import org.eclipse.jst.javaee.core.internal.impl.ResourceRefImpl; -import org.eclipse.jst.javaee.ejb.EJBJar; -import org.eclipse.jst.javaee.ejb.EntityBean; -import org.eclipse.jst.javaee.ejb.MessageDrivenBean; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.jst.javaee.web.Filter; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.jee.archive.IArchive; -import org.eclipse.jst.jee.ui.internal.navigator.appclient.GroupAppClientProvider; -import org.eclipse.jst.jee.ui.internal.navigator.ear.GroupEARProvider; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.BeanInterfaceNode; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.BeanNode; -import org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEJBProvider; -import org.eclipse.jst.jee.ui.internal.navigator.ra.RaGroupContentProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.WebAppProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.WebArtifactNode; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.ui.IEditorDescriptor; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorRegistry; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; - -/** - * Open Action for Deployment descriptor tree nodes. - * - * @author Dimitar Giormov - * - */ -public class OpenJEEResourceAction extends AbstractOpenAction { - - public static final String ID = "com.sap.ide.j2ee.ui.actions.OpenJEEResourceAction"; //$NON-NLS-1$ - public static final String JAVA_EDITOR_ID = "org.eclipse.jst.j2ee.internal.internal.ejb.ui.java.EnterpriseBeanJavaEditor"; //$NON-NLS-1$ - public static final String BASE_JAVA_EDITOR_ID = "org.eclipse.jdt.ui.CompilationUnitEditor"; //$NON-NLS-1$ - - protected static IEditorDescriptor javaEditorDescriptor; - protected static IEditorDescriptor baseJavaEditorDescriptor; - - /** - * Create an instance of this class - */ - public OpenJEEResourceAction() { - super("Open"); //$NON-NLS-1$ - } - - /** - * Returns the action ID. - */ - public String getID() { - return ID; - } - - public static IEditorDescriptor getJavaEditorDescriptor() { - if (javaEditorDescriptor == null) - javaEditorDescriptor = findEditorDescriptor(JAVA_EDITOR_ID); - return javaEditorDescriptor; - } - - public static IEditorDescriptor getBaseJavaEditorDescriptor() { - if (baseJavaEditorDescriptor == null) - baseJavaEditorDescriptor = findEditorDescriptor(BASE_JAVA_EDITOR_ID); - return baseJavaEditorDescriptor; - } - - protected void openAppropriateEditor(String c) { - if(getStructuredSelection() instanceof TreeSelection){ - TreePath path = ((TreeSelection) getStructuredSelection()).getPaths()[0]; - IProject project = null; - - while (path != null) { - Object segment = path.getLastSegment(); - if (segment instanceof IProject) { - project = (IProject) segment; - break; - } - path = path.getParentPath(); - } - - if (project != null) { - try { - IType findType = JavaCore.create(project).findType(c); - if(findType == null){ - return; - } - openAppropriateEditor(findType.getResource()); - } catch (JavaModelException e) { - JEEUIPlugin.logError("Error during open editor", e); //$NON-NLS-1$ - } - } - } - } - - protected void openAppropriateEditor(IVirtualComponent c) { - if (c == null) { - return; - } - IWorkbenchPage page = null; - IEditorPart editor = null; - try { - page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage(); - editor = page.openEditor(new ComponentEditorInput(c), - currentDescriptor.getId()); - if (editor instanceof ISetSelectionTarget) - ((ISetSelectionTarget) editor) - .selectReveal(getStructuredSelection()); - } catch (Exception e) { - MessageDialog - .openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - J2EEUIMessages - .getResourceString("Problems_Opening_Editor_ERROR_"), e.getMessage()); //$NON-NLS-1$ = "Problems Opening Editor" - } - } - - protected void openAppropriateEditor(IJavaElement element) { - if (element == null) { - return; - } - try { - JavaUI.openInEditor(element); - } catch (Exception e) { - MessageDialog - .openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - J2EEUIMessages - .getResourceString("Problems_Opening_Editor_ERROR_"), e.getMessage()); //$NON-NLS-1$ = "Problems Opening Editor" - } - } - - /** - * open the appropriate editor - */ - protected void openAppropriateEditor(IResource r) { - if (r == null) - return; - IWorkbenchPage page = null; - IEditorPart editor = null; - try { - page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage(); - String ID = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(r.getLocation() - .toPortableString()).getId(); - editor = page.openEditor(new FileEditorInput((IFile) r), ID); - if (editor instanceof ISetSelectionTarget) - ((ISetSelectionTarget) editor) - .selectReveal(getStructuredSelection()); - } catch (Exception e) { - MessageDialog - .openError( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - J2EEUIMessages - .getResourceString("Problems_Opening_Editor_ERROR_"), e.getMessage()); //$NON-NLS-1$ = "Problems Opening Editor" - } - } - - /** - * The user has invoked this action - */ - @Override - public void run() { - if (!isEnabled()) - return; - - if (srcObject instanceof J2EEJavaClassProviderHelper) { - ((J2EEJavaClassProviderHelper) srcObject).openInEditor(); - return; - } - - //[Bug 240512] deal with if any of these node types ndo not have an associated class - if (srcObject instanceof SessionBean || - srcObject instanceof MessageDrivenBean || - srcObject instanceof EntityBean || - srcObject instanceof Servlet || - srcObject instanceof Filter || - srcObject instanceof Listener){ - - String name = ""; //$NON-NLS-1$ - if( srcObject instanceof SessionBean ){ - SessionBean bean = (SessionBean)srcObject; - name = bean.getEjbClass(); - } else if(srcObject instanceof MessageDrivenBean){ - MessageDrivenBean bean = (MessageDrivenBean)srcObject; - name = bean.getEjbClass(); - } else if(srcObject instanceof EntityBean){ - EntityBean bean = (EntityBean)srcObject; - name = bean.getEjbClass(); - } else if(srcObject instanceof Servlet){ - Servlet servlet = (Servlet)srcObject; - name = servlet.getServletClass(); - } else if(srcObject instanceof Filter) { - Filter filter = (Filter)srcObject; - name = filter.getFilterClass(); - } else if(srcObject instanceof Listener){ - Listener listener = (Listener)srcObject; - name = listener.getListenerClass(); - } - - IResource resource = WorkbenchResourceHelper.getFile((EObject)srcObject); - if (resource == null) - return; - IProject project = resource.getProject(); - IJavaProject javaProject = JavaCore.create(project); - if(javaProject.exists()){ - IType type = null; - try { - //if name is null then can't get type - if(name != null) { - type = javaProject.findType( name ); - } - - //if type is null then can't open its editor, so open editor for the resource - if(type != null) { - ICompilationUnit cu = type.getCompilationUnit(); - EditorUtility.openInEditor(cu); - } else{ - openAppropriateEditor(resource); - } - } catch (JavaModelException e) { - JEEUIPlugin.logError(e.getMessage(), e); - } catch (PartInitException e) { - JEEUIPlugin.logError(e.getMessage(), e); - } - } - return; - } - - - if (srcObject instanceof EObject) { - if(srcObject instanceof EjbLocalRefImpl || srcObject instanceof ResourceRefImpl){ - IResource resource = WorkbenchResourceHelper.getFile((EObject)srcObject); - if (resource == null) - { - openEObject((EObject) srcObject); - return; - } - IProject project = resource.getProject(); - - EJBJar ejbJar = (EJBJar) ModelProviderManager.getModelProvider(project).getModelObject(new Path(J2EEConstants.EJBJAR_DD_URI)); - - if(srcObject instanceof EjbLocalRefImpl){ - openEjbLocalRefNode(resource, ejbJar); - } else if(srcObject instanceof ResourceRefImpl){ - openResourceRefNode(resource, ejbJar); - } - } else { - openEObject((EObject) srcObject); - } - } else if (srcObject instanceof BeanInterfaceNode) { - openAppropriateEditor(((BeanInterfaceNode) srcObject).get_fqn()); - return; - } else if (srcObject instanceof BeanNode) { - openAppropriateEditor(((BeanNode) srcObject).getEjbClassQualifiedName()); - return; - } else if (srcObject instanceof WebAppProvider) { - IFile file = ((WebAppProvider) srcObject).getDDFile(); - if (file.isAccessible()){ - openAppropriateEditor(file); - return; - } - } else if(srcObject instanceof WebArtifactNode){ - openEObject((EObject) ((WebArtifactNode)srcObject).getJavaEEObject()); - - } else if (srcObject instanceof GroupEJBProvider) { - openEObject((EObject) ((GroupEJBProvider)srcObject).getEjbJar()); - } else if (srcObject instanceof GroupEARProvider) { - IFile file = ((GroupEARProvider) srcObject).getDDFile(); - if (file.isAccessible()){ - openAppropriateEditor(file); - return; - } - } else if (srcObject instanceof GroupAppClientProvider) { - IFile file = ((GroupAppClientProvider) srcObject).getDDFile(); - if (file.isAccessible()){ - openAppropriateEditor(file); - return; - } - } else if (srcObject instanceof AbstractGroupProvider){ - openEObject((EObject) ((AbstractGroupProvider)srcObject).getJavaEEObject()); - } else if (srcObject instanceof Resource) - openAppropriateEditor(WorkbenchResourceHelper - .getFile((Resource) srcObject)); - } - - private void openResourceRefNode(IResource resource, EJBJar ejbJar) { - if (ejbJar.getEnterpriseBeans() != null) { - List<SessionBean> beans = ejbJar.getEnterpriseBeans().getSessionBeans(); - for (SessionBean bean : beans) { - for (ResourceRef localref : bean.getResourceRefs()) { - if (localref.getResRefName().equals(((ResourceRef) srcObject).getResRefName())) { - openAppropriateEditor(resource); - return; - } - } - } - } - if (((ResourceRefImpl) srcObject).eContainer() instanceof SessionBean) { - openAppropriateEditor(((SessionBean) (((ResourceRefImpl) srcObject).eContainer())).getEjbClass()); - return; - } - } - - private void openEjbLocalRefNode(IResource resource, EJBJar ejbJar) { - if (ejbJar.getEnterpriseBeans() != null) { - List<SessionBean> beans = ejbJar.getEnterpriseBeans().getSessionBeans(); - for (SessionBean bean : beans) { - for (EjbLocalRef localref : bean.getEjbLocalRefs()) { - if (localref.getEjbRefName().equals(((EjbLocalRef) srcObject).getEjbRefName())) { - openAppropriateEditor(resource); - return; - } - } - } - } - if (((EjbLocalRefImpl) srcObject).eContainer() instanceof SessionBean) { - openAppropriateEditor(((SessionBean) (((EjbLocalRefImpl) srcObject).eContainer())).getEjbClass()); - return; - } - } - - private void openEObject(EObject _srcObject) { - EObject ro = _srcObject; - IResource resource = WorkbenchResourceHelper - .getFile(_srcObject); - if (resource != null) { - openAppropriateEditor(resource); - } else { - ModuleFile moduleFile = ArchiveUtil.getModuleFile(ro); - if (moduleFile != null) { - ArchiveOptions options = moduleFile.getOptions(); - if (options instanceof ComponentArchiveOptions) { - IVirtualComponent component = ((ComponentArchiveOptions) options) - .getComponent(); - openAppropriateEditor(component); - } - } else { - IArchive archive = JavaEEArchiveUtilities.findArchive(ro); - if(archive != null){ - IVirtualComponent component = JavaEEArchiveUtilities.findComponent(archive); - if(component != null){ - openAppropriateEditor(component); - } - } - } - } - - } - - /** - * The structured selection has changed in the workbench. Subclasses should - * override this method to react to the change. Returns true if the action - * should be enabled for this selection, and false otherwise. - * - * When this method is overridden, the super method must always be invoked. - * If the super method returns false, this method must also return false. - * - * @param sel - * the new structured selection - */ - @Override - public boolean updateSelection(IStructuredSelection s) { - if (!super.updateSelection(s)) - return false; - - // Make sure this is one of the selections we can handle, - // then set the source object as is. The run() will do the hard stuff. - Object obj = s.getFirstElement(); - setText("Open"); //$NON-NLS-1$ - - if (obj instanceof J2EEJavaClassProviderHelper) - currentDescriptor = getJavaEditorDescriptor(); - else if (obj instanceof BeanLink) - currentDescriptor = getBaseJavaEditorDescriptor(); - else if (obj instanceof EObject) { - IEditorRegistry registry = PlatformUI.getWorkbench() - .getEditorRegistry(); - IFile file = WorkbenchResourceHelper.getFile((EObject) obj); - if (file != null) { - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - } else { - if(((EObject) obj).eResource() != null){ - String name = (new Path(((EObject) obj).eResource().getURI() - .toString())).lastSegment(); - currentDescriptor = registry.getDefaultEditor(name, null); - } - } - } else if (obj instanceof Resource) { - IEditorRegistry registry = PlatformUI.getWorkbench() - .getEditorRegistry(); - IFile file = WorkbenchResourceHelper.getFile((Resource) obj); - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - } else if (obj instanceof GroupEARProvider) { - IFile file = ((GroupEARProvider) obj).getDDFile(); - if (file.isAccessible()){ - IEditorRegistry registry = PlatformUI.getWorkbench() - .getEditorRegistry(); - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - }else{ - currentDescriptor = null; - return false; - } - } else if (obj instanceof GroupEJBProvider) { - IFile file = WorkbenchResourceHelper.getFile((EObject)((GroupEJBProvider)obj).getEjbJar()); - if (file.isAccessible()){ - IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry(); - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - }else{ - currentDescriptor = null; - return false; - } - } else if (obj instanceof GroupAppClientProvider) { - IFile file = ((GroupAppClientProvider) obj).getDDFile(); - if (file.isAccessible()){ - IEditorRegistry registry = PlatformUI.getWorkbench() - .getEditorRegistry(); - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - }else{ - currentDescriptor = null; - return false; - } - } else if (obj instanceof WebAppProvider) { - IFile file = ((WebAppProvider) obj).getDDFile(); - if (file.isAccessible()){ - IEditorRegistry registry = PlatformUI.getWorkbench() - .getEditorRegistry(); - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - } else{ - currentDescriptor = null; - return false; - } - } else if (obj instanceof RaGroupContentProvider) { - IFile file = WorkbenchResourceHelper.getFile((EObject) ((AbstractGroupProvider)obj).getJavaEEObject()); - if (file.isAccessible()){ - IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry(); - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - }else{ - currentDescriptor = null; - return false; - } - } else if (obj instanceof BeanNode) { - - IEditorRegistry registry = PlatformUI.getWorkbench() - .getEditorRegistry(); - JavaEEObject enterpriseBean = ((BeanNode) obj).getEnterpriseBean(); - IFile file = WorkbenchResourceHelper.getFile((EObject)enterpriseBean); - if (file != null) { - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - } else { - if(((EObject) enterpriseBean).eResource() != null){ - String name = (new Path(((EObject) enterpriseBean).eResource().getURI() - .toString())).lastSegment(); - currentDescriptor = registry.getDefaultEditor(name, null); - } - } - } else if (obj instanceof BeanInterfaceNode) { - - IEditorRegistry registry = PlatformUI.getWorkbench() - .getEditorRegistry(); - JavaEEObject beanInterface = (JavaEEObject) ((BeanInterfaceNode) obj).getAdapterNode(); - IFile file = WorkbenchResourceHelper.getFile((EObject)beanInterface); - if (file != null) { - IContentType contentType = IDE.getContentType(file); - currentDescriptor = registry.getDefaultEditor(file.getName(), - contentType); - } else { - if(((EObject) beanInterface).eResource() != null){ - String name = (new Path(((EObject) beanInterface).eResource().getURI().toString())).lastSegment(); - currentDescriptor = registry.getDefaultEditor(name, null); - } else { - String fqn = ((BeanInterfaceNode) obj).get_fqn(); - if (fqn != null){ - currentDescriptor = registry.getDefaultEditor(((BeanInterfaceNode) obj).getText(), null); -// return true; - } else { - return false; - } - - } - } - } - setAttributesFromDescriptor(); - srcObject = obj; - return true; - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Web25ContentProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Web25ContentProvider.java deleted file mode 100644 index 75bdb2857..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Web25ContentProvider.java +++ /dev/null @@ -1,71 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.navigator.web.WebAppProvider; - -/** - * Web 2.5 Content provider is Deployment Descriptor content provider, - * used for constructing of the descriptor tree in project explorer. - * - * @author Dimitar Giormov - */ -public class Web25ContentProvider extends JEE5ContentProvider { - - public Object[] getChildren(Object aParentElement) { - - List<Object> children = new ArrayList<Object>(); - IProject project = null; - if (IProject.class.isInstance(aParentElement)) { - project = (IProject) aParentElement; - AbstractGroupProvider cachedContentProvider = getCachedContentProvider(project); - if (cachedContentProvider != null && cachedContentProvider.isValid()){ - children.add(cachedContentProvider); - } - } else if (AbstractGroupProvider.class.isInstance(aParentElement)){ - AbstractGroupProvider abstractGroupProvider = (AbstractGroupProvider) aParentElement; - if (abstractGroupProvider.hasChildren()){ - children.addAll(abstractGroupProvider.getChildren()); - } - } - return children.toArray(); - } - - - public boolean hasChildren(Object element) { - if (element instanceof WebAppProvider) { - return ((WebAppProvider)element).isValid(); - } else if (element instanceof AbstractGroupProvider) { - return ((AbstractGroupProvider) element).hasChildren(); - } else - return false; - } - - public Object getParent(Object element) { - return null; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - - @Override - protected AbstractGroupProvider getNewContentProviderInstance(IProject project) { - return new WebAppProvider((WebApp) getCachedModelProvider(project).getModelObject(), project); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Web25LabelProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Web25LabelProvider.java deleted file mode 100644 index 40f49d827..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/Web25LabelProvider.java +++ /dev/null @@ -1,106 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator; - -import org.eclipse.jst.j2ee.navigator.internal.J2EELabelProvider; -import org.eclipse.jst.javaee.core.Listener; -import org.eclipse.jst.javaee.core.ParamValue; -import org.eclipse.jst.javaee.web.ErrorPage; -import org.eclipse.jst.javaee.web.Filter; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupContextParamsItemProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupErrorPagesItemProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupFilterMappingItemProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupFilterMappingItemProvider.FilterMappingUIWrapper; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupFiltersItemProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupListenerItemProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupServletItemProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupServletMappingItemProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.GroupServletMappingItemProvider.ServletMappingUIWrapper; -import org.eclipse.jst.jee.ui.internal.navigator.web.WebAppProvider; -import org.eclipse.jst.jee.ui.internal.navigator.web.WebArtifactNode; -import org.eclipse.swt.graphics.Image; - - -/** - * Web 2.5 Label provider is Deployment Descriptor label provider, - * used for decorating of the descriptor tree in project explorer. - * - * @author Dimitar Giormov - */ -public class Web25LabelProvider extends J2EELabelProvider { - - - - @Override - public Image getImage(Object element) { - Image ret = null; - if (element instanceof WebAppProvider) { - ret = ((WebAppProvider) element).getImage(); - } else if (element instanceof AbstractGroupProvider){ - ret = ((AbstractGroupProvider) element).getImage(); - } else if (element instanceof Servlet){ - ret = GroupServletItemProvider.getServletImage(); - } else if (element instanceof ServletMappingUIWrapper){ - ret = GroupServletMappingItemProvider.getServletMappingImage(); - } else if (element instanceof Filter){ - ret = GroupFiltersItemProvider.getFiltersImage(); - } else if (element instanceof Listener){ - ret = GroupListenerItemProvider.getListenersImage(); - } else if (element instanceof FilterMappingUIWrapper){ - ret = GroupFilterMappingItemProvider.getFilterMappingImage(); - } else if (element instanceof WebArtifactNode){ - ret = ((WebArtifactNode)element).getImage(); - } else if (element instanceof ErrorPage) { - ret = GroupErrorPagesItemProvider.getErrorPagesImage((ErrorPage)element); - } else if (element instanceof ParamValue){ - ret = GroupContextParamsItemProvider.getContextParamsImage(); - } else { - ret = super.getImage(element); - } - return ret; - } - - @Override - public String getText(Object element) { - String ret = null; - if (element instanceof WebAppProvider) { - ret = ((WebAppProvider) element).getText(); - } else if (element instanceof AbstractGroupProvider){ - ret = ((AbstractGroupProvider) element).getText(); - } else if (element instanceof Servlet){ - ret = ((Servlet) element).getServletName(); - } else if (element instanceof ServletMappingUIWrapper) { - ret = ((ServletMappingUIWrapper) element).getValue(); - } else if (element instanceof Filter){ - ret = ((Filter) element).getFilterName(); - } else if (element instanceof Listener){ - ret = ((Listener) element).getListenerClass(); - } else if (element instanceof FilterMappingUIWrapper) { - ret = ((FilterMappingUIWrapper) element).getValue(); - } else if (element instanceof WebArtifactNode) { - ret = ((WebArtifactNode) element).getText(); - } else if (element instanceof ErrorPage ){ - ErrorPage page = ((ErrorPage) element); - if (page.getErrorCode() == null) { - ret = page.getExceptionType() + " -> " + page.getLocation(); //$NON-NLS-1$ - } else { - ret = page.getErrorCode() + " -> " + page.getLocation(); //$NON-NLS-1$ - } - } else if (element instanceof ParamValue){ - ret = ((ParamValue)element).getParamName() + " = " + ((ParamValue)element).getParamValue();//$NON-NLS-1$ - } else { - ret = super.getText(element); - } - return ret; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/appclient/AbstractAppClientGroupProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/appclient/AbstractAppClientGroupProvider.java deleted file mode 100644 index 5910232bf..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/appclient/AbstractAppClientGroupProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.appclient; - -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractGroupProvider; - -public abstract class AbstractAppClientGroupProvider extends - AbstractGroupProvider { - - public AbstractAppClientGroupProvider(JavaEEObject javaee) { - super(javaee); - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/appclient/GroupAppClientProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/appclient/GroupAppClientProvider.java deleted file mode 100644 index abe0183c0..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/appclient/GroupAppClientProvider.java +++ /dev/null @@ -1,126 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008, 2010 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.appclient; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.javaee.applicationclient.ApplicationClient; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; - -/** - * Application Client 5.0 Deployment Descriptor node. - * - * @author Dimitar Giormov - * @author Kaloyan Raev - */ -public class GroupAppClientProvider extends AbstractAppClientGroupProvider implements IAdaptable { - - - private final IProject project; - - - public GroupAppClientProvider(ApplicationClient javaee, IProject project) { - super(javaee); - this.project = project; - } - - private static final String PROJECT_RELATIVE_PATH = "META-INF/application-client.xml"; //$NON-NLS-1$ - - private Image appClient50Image; - private Image appClient60Image; - - private IFile ddFile; - - @Override - public String getText() { - String result = null; - if (this.project == null) { - result = NLS.bind(Messages.DEPLOYMENT_DESCRIPTOR, new Object[] {""}); //$NON-NLS-1$ - } else { - result = NLS.bind(Messages.DEPLOYMENT_DESCRIPTOR, this.project.getName()); - } - return result; - } - - @Override - public List getChildren() { - List result = new ArrayList(); - if (javaee != null){ - result.addAll(((ApplicationClient) javaee).getEjbRefs()); - //result.addAll(((ApplicationClient) javaee).getEjbLocalRefs()); - result.addAll(((ApplicationClient) javaee).getResourceRefs()); - result.addAll(((ApplicationClient) javaee).getResourceEnvRefs()); - result.addAll(((ApplicationClient) javaee).getEnvEntries()); - result.addAll(((ApplicationClient) javaee).getMessageDestinationRefs()); - //result.addAll(((ApplicationClient) javaee).getPersistenceContextRefs()); - result.addAll(((ApplicationClient) javaee).getPersistenceUnitRefs()); - result.addAll(((ApplicationClient) javaee).getServiceRefs()); - } - return result; - } - - @Override - public Image getImage() { - String version = ((ApplicationClient) javaee).getVersion(); - if (J2EEVersionConstants.VERSION_5_TEXT.equals(version)) { - return getAppClient50Image(); - } else if (J2EEVersionConstants.VERSION_6_TEXT.equals(version)) { - return getAppClient60Image(); - } - return getAppClient50Image(); - } - - public IFile getDDFile() { - if (ddFile != null){ - return ddFile; - } - IVirtualFolder virtualFolder = ComponentCore.createComponent(project).getRootFolder(); - ddFile = virtualFolder.getFile(PROJECT_RELATIVE_PATH).getUnderlyingFile(); - return ddFile; - } - - public IProject getProject() { - return project; - } - - public Object getAdapter(Class adapter) { - if (IProject.class == adapter){ - return getProject(); - } - return null; - } - - private Image getAppClient50Image() { - if (appClient50Image == null) { - appClient50Image = JEEUIPlugin.getDefault().getImageDescriptor(JEEUIPluginIcons.APP_CLIENT50).createImage(); - } - return appClient50Image; - } - - private Image getAppClient60Image() { - if (appClient60Image == null) { - appClient60Image = JEEUIPlugin.getDefault().getImageDescriptor(JEEUIPluginIcons.APP_CLIENT60).createImage(); - } - return appClient60Image; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/dnd/AddProjectToEARDropAssistant.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/dnd/AddProjectToEARDropAssistant.java deleted file mode 100644 index 890922b4a..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/dnd/AddProjectToEARDropAssistant.java +++ /dev/null @@ -1,619 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - * IBM - bug 281382 clean up - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.dnd; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jdt.internal.core.JarPackageFragmentRoot; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider; -import org.eclipse.jst.j2ee.application.internal.operations.IAddComponentToEnterpriseApplicationDataModelProperties; -import org.eclipse.jst.j2ee.application.internal.operations.RemoveComponentFromEnterpriseApplicationDataModelProvider; -import org.eclipse.jst.j2ee.application.internal.operations.UpdateManifestDataModelProperties; -import org.eclipse.jst.j2ee.application.internal.operations.UpdateManifestDataModelProvider; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest; -import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent; -import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil; -import org.eclipse.jst.j2ee.internal.dialogs.DependencyConflictResolveDialog; -import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.internal.provider.J2EEItemProvider; -import org.eclipse.jst.j2ee.navigator.internal.plugin.J2EENavigatorPlugin; -import org.eclipse.jst.j2ee.project.EarUtilities; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.jst.j2ee.project.facet.EARFacetUtils; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.internal.navigator.ear.AbstractEarNode; -import org.eclipse.jst.jee.ui.internal.navigator.ear.BundledNode; -import org.eclipse.jst.jee.ui.internal.navigator.ear.GroupEARProvider; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.dnd.DropTargetEvent; -import org.eclipse.swt.dnd.TransferData; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.navigator.CommonDropAdapter; -import org.eclipse.ui.navigator.CommonDropAdapterAssistant; -import org.eclipse.ui.part.PluginTransfer; -import org.eclipse.ui.progress.IProgressService; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties; -import org.eclipse.wst.common.componentcore.internal.operation.RemoveReferenceComponentsDataModelProvider; -import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * Handles drop of JEE resources on EAR project thus adding them as modules. - * - * @author Dimitar Giormov - * - */ -public class AddProjectToEARDropAssistant extends CommonDropAdapterAssistant { - - private static final Class IPROJECT_CLASS = IProject.class; - private IVirtualComponent earComponent = null; - private IProject earProject = null; - private String libDir = null; - private boolean resolveConflicts = false; - - public AddProjectToEARDropAssistant() { - super(); - } - - @Override - public boolean isSupportedType(TransferData aTransferType) { - return LocalSelectionTransfer.getTransfer().isSupportedType(aTransferType); - } - - @Override - public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, final Object aTarget) { - if (LocalSelectionTransfer.getTransfer().isSupportedType(aDropAdapter.getCurrentTransfer())) { - final IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection(); - IProgressService service = PlatformUI.getWorkbench().getProgressService(); - resolveConflicts = false; - for (Iterator selectionIterator = selection.iterator(); selectionIterator.hasNext();) { - Object sourceObject = selectionIterator.next(); - if (sourceObject instanceof IVirtualReference) { - IVirtualReference reference = (IVirtualReference) sourceObject; - /* - * If a reference is moved from the root to the lib - * directory check for conflicts with projects referenced by - * the ear referencing the same lib - */ - IPath libDirPath = null; - if(libDir != null) - libDirPath = new Path(libDir).makeRelative(); - if (libDir.length() > 0 && libDirPath != null && !libDirPath.equals(reference.getRuntimePath().makeRelative())) { - if (hasConflictingProjectInMetaInf(reference)) { - DependencyConflictResolveDialog dlg = new DependencyConflictResolveDialog(getShell(), DependencyConflictResolveDialog.DLG_TYPE_2); - if (dlg.open() == DependencyConflictResolveDialog.BTN_ID_CANCEL) { - return Status.CANCEL_STATUS; - } - resolveConflicts = true; - } - } - } else { - if (libDir.length() > 0){ - IProject projectToAdd = getProject(sourceObject); - if (hasConflictingProjectInMetaInf(projectToAdd)) { - DependencyConflictResolveDialog dlg = new DependencyConflictResolveDialog(getShell(), DependencyConflictResolveDialog.DLG_TYPE_2); - if (dlg.open() == DependencyConflictResolveDialog.BTN_ID_CANCEL) { - return Status.CANCEL_STATUS; - } - resolveConflicts = true; - } - } - } - } - Job addProjectToEarJob = new Job(getJobTitle(earComponent)) { - @Override - protected IStatus run(IProgressMonitor monitor) { - - IStatus status = null; - - List<IVirtualComponent> componentsToAdd = new ArrayList<IVirtualComponent>(); - List<IVirtualComponent> componentsToRemove = new ArrayList<IVirtualComponent>(); - - for (Iterator selectionIterator = selection.iterator(); selectionIterator.hasNext();) { - Object sourceObject = selectionIterator.next(); - - if (sourceObject instanceof JarPackageFragmentRoot) { - JarPackageFragmentRoot jarPackageFragment = (JarPackageFragmentRoot) sourceObject; - - String type = VirtualArchiveComponent.LIBARCHIVETYPE + IPath.SEPARATOR; - IVirtualComponent archive = ComponentCore.createArchiveComponent(earComponent.getProject(), type + jarPackageFragment.getPath().toString()); - componentsToAdd.add(archive); - } else if (sourceObject instanceof IVirtualReference) { - IVirtualReference reference = (IVirtualReference) sourceObject; - if (resolveConflicts) { - status = resolveConflicts(reference.getReferencedComponent()); - if (!status.isOK()) { - return status; - } - } - IVirtualComponent archive = reference.getReferencedComponent(); - componentsToRemove.add(archive); - status = removeComponentsFromEar(componentsToRemove, reference.getRuntimePath().toString()); - if (!status.isOK()) - return status; - componentsToAdd.add(archive); - } else { - IProject projectToAdd = getProject(sourceObject); - if (resolveConflicts) { - status = resolveConflicts(ComponentCore.createComponent(projectToAdd)); - if (!status.isOK()) { - return status; - } - } - componentsToAdd.add(ComponentCore.createComponent(projectToAdd)); - } - } - - if (!componentsToAdd.isEmpty()) { - status = addComponentsToEar(componentsToAdd, libDir); - if (!status.isOK()) - return status; - } - - return status; - } - - }; - service.showInDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), addProjectToEarJob); - addProjectToEarJob.setRule(ResourcesPlugin.getWorkspace().getRoot()); - addProjectToEarJob.schedule(); - } - return Status.OK_STATUS; - } - - @Override - public IStatus validateDrop(Object target, int operation, TransferData transferType) { - libDir = ""; //$NON-NLS-1$ - if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType) || PluginTransfer.getInstance().isSupportedType(transferType)) { - ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); - if (selection != null && !selection.isEmpty() && (selection instanceof IStructuredSelection)) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - earProject = getProject(target); - if (earProject == null) { - return Status.CANCEL_STATUS; - } - earComponent = ComponentCore.createComponent(earProject); - int earVersion = getEarVersion(earProject); - if (target instanceof BundledNode && ((BundledNode) target).getBundledLibsDirectoryNode() == null) { - libDir = EarUtilities.getEARLibDir(earComponent); - } - - IStatus status = null; - for (Iterator iterator = structuredSelection.iterator(); iterator.hasNext();) { - Object next = iterator.next(); - - //check if library is physically present in the Ear path - if (IVirtualReference.class.isInstance(next)){ - IVirtualComponent referencedComponent = ((IVirtualReference)next).getReferencedComponent(); - if (referencedComponent.isBinary() && isPhysicallyAdded(referencedComponent)) { - return Status.CANCEL_STATUS; - } - } - - if (next instanceof IVirtualReference) { - return Status.OK_STATUS; - } - - /* - * Check if we try to add a JarPackageFragment that is - * already referenced - */ - if (next instanceof JarPackageFragmentRoot) { - JarPackageFragmentRoot jar = (JarPackageFragmentRoot) next; - for (IVirtualReference reference : earComponent.getReferences()) { - if (reference.getArchiveName().equals(jar.getElementName())) { - return Status.CANCEL_STATUS; - } - } - return Status.OK_STATUS; - } - - /* - * Check if we try to add a module that is already - * referenced by the ear but at the same time allow to - * change its location from the root to the lib directory - * and the opposite. - */ - IProject projectToAdd = getProject(next); - hasConflictingProjectInMetaInf(ComponentCore.createComponent(projectToAdd)); - try { - for (IProject referencedProject : earProject.getReferencedProjects()) { - if (referencedProject == projectToAdd) { - return Status.CANCEL_STATUS; - } - } - } catch (CoreException e) { - String msg = e.getMessage() != null ? e.getMessage() : e.toString(); - status = J2EENavigatorPlugin.createErrorStatus(0, msg, e); - } - - if ((status = validateProjectMayBeAdded(earProject, projectToAdd, earVersion)).isOK()) - return status; - } - } - - } - return Status.CANCEL_STATUS; - } - - private boolean isPhysicallyAdded(IVirtualComponent component) { - IFile f = (IFile)component.getAdapter(IFile.class); - return f == null ? false : true; - } - - /** - * @param target - */ - private IStatus validateProjectMayBeAdded(IProject earProject, IProject projectToAdd, int earVersion) { - if (earProject == null || projectToAdd == null || earVersion < 0) - return J2EENavigatorPlugin.createErrorStatus(0, Messages.AddProjectToEARDropAssistant_Could_not_add_module_to_Enterprise_, null); - else if (!earProject.isAccessible()) { - return J2EENavigatorPlugin.createErrorStatus(0, NLS.bind(Messages.AddProjectToEARDropAssistant_The_project_0_cannot_be_accesse_, earProject.getName()), null); - } else if (!projectToAdd.isAccessible()) { - return J2EENavigatorPlugin.createErrorStatus(0, Messages.AddProjectToEARDropAssistant_The_dragged_project_cannot_be_added_, null); - } - - IStatus isValid = validateProjectToAdd(projectToAdd, earVersion); - if (!isValid.isOK()) { - return isValid; - } - - return Status.OK_STATUS; - } - - /** - * - * @return -1 on error - */ - protected final int getEarVersion(IProject earProject) { - int earVersion = -1; - IFacetedProject facetedProject = null; - try { - facetedProject = ProjectFacetsManager.create(earProject); - - if (facetedProject != null) { - double double1 = Double.parseDouble(facetedProject.getProjectFacetVersion(EARFacetUtils.EAR_FACET).getVersionString()); - earVersion = (int) (double1 * 10); - } else { - JEEUIPlugin.logError("Could not acquire model elements for project \"" + earProject.getName() + "\".", null); //$NON-NLS-1$ //$NON-NLS-2$ - } - } catch (CoreException e1) { - String msg = e1.getMessage() != null ? e1.getMessage() : e1.toString(); - JEEUIPlugin.logError(msg, e1); - } - - return earVersion; - } - - /** - * @param facetedProject - * @return - */ - protected final boolean hasEarFacet(IProject project) { - IFacetedProject facetedProject = null; - try { - facetedProject = ProjectFacetsManager.create(project); - } catch (CoreException e1) { - String msg = e1.getMessage() != null ? e1.getMessage() : e1.toString(); - JEEUIPlugin.logError(msg, e1); - } - return facetedProject != null && facetedProject.hasProjectFacet(EARFacetUtils.EAR_FACET); - } - - protected final String calculateValidProjectName(final String originalName) { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - String validName = originalName; - int count = 1; - while (root.getProject(validName).exists()) { - validName = originalName + count++; - } - return validName; - } - - protected String getJobTitle(IVirtualComponent earComponent) { - return NLS.bind(Messages.AddModuleToEarDropAssistant_Adding_module_to_ea_, earComponent.getName()); - } - - protected IStatus validateProjectToAdd(IProject projectToAdd, int earVersion) { - try { - // check if the project to add is not an EAR itself - IFacetedProject facetedProject = ProjectFacetsManager.create(projectToAdd); - if (facetedProject == null) { - facetedProject = ProjectFacetsManager.create(projectToAdd, true, new NullProgressMonitor()); - IProjectFacetVersion javafacetversion = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_JAVA).getDefaultVersion(); - facetedProject.installProjectFacet(javafacetversion, null, null); - IProjectFacetVersion utilityfacetversion = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_UTILITY_MODULE).getDefaultVersion(); - facetedProject.installProjectFacet(utilityfacetversion, null, null); - } - if (facetedProject.hasProjectFacet(EARFacetUtils.EAR_FACET)) - return Status.CANCEL_STATUS; - - // check if the project to add is with Java EE version equal or - // lesser than that of the EAR - String verStr = J2EEProjectUtilities.getJ2EEProjectVersion(projectToAdd); - if (verStr != null) { - int version; - if (JavaEEProjectUtilities.isApplicationClientProject(projectToAdd)) - version = J2EEVersionUtil.convertAppClientVersionStringToJ2EEVersionID(verStr); - else if (JavaEEProjectUtilities.isEJBProject(projectToAdd)) - version = J2EEVersionUtil.convertEJBVersionStringToJ2EEVersionID(verStr); - else if (JavaEEProjectUtilities.isDynamicWebProject(projectToAdd)) - version = J2EEVersionUtil.convertWebVersionStringToJ2EEVersionID(verStr); - else if (JavaEEProjectUtilities.isJCAProject(projectToAdd)) - version = J2EEVersionUtil.convertConnectorVersionStringToJ2EEVersionID(verStr); - else - version = J2EEVersionUtil.convertVersionStringToInt(verStr); - - if (version > earVersion) - return Status.CANCEL_STATUS; - } - } catch (CoreException e) { - String msg = e.getMessage() != null ? e.getMessage() : e.toString(); - return J2EENavigatorPlugin.createErrorStatus(0, msg, e); - } - return Status.OK_STATUS; - - } - - protected static IProject getProject(Object element) { - if (element == null) - return null; - IProject project = null; - if (element instanceof IAdaptable) - project = (IProject) ((IAdaptable) element).getAdapter(IPROJECT_CLASS); - else - project = (IProject) Platform.getAdapterManager().getAdapter(element, IPROJECT_CLASS); - - if (element instanceof AbstractEarNode) { - project = ((AbstractEarNode) element).getEarProject(); - } - - if (element instanceof GroupEARProvider) { - project = ((GroupEARProvider) element).getProject(); - } - - if (element instanceof IVirtualReference) { - project = ((IVirtualReference) element).getReferencedComponent().getProject(); - } - - if (project == null) { - if (element instanceof EObject) { - project = ProjectUtilities.getProject((EObject) element); - } else if (element instanceof J2EEItemProvider) { - IFile associatedFile = ((J2EEItemProvider) element).getAssociatedFile(); - if (associatedFile != null) - project = associatedFile.getProject(); - } - } - return project; - } - - protected static String getDefaultURI(IVirtualComponent component) { - IProject project = component.getProject(); - String name = component.getName(); - - if (JavaEEProjectUtilities.isDynamicWebProject(project)) { - name += IJ2EEModuleConstants.WAR_EXT; - } else if (JavaEEProjectUtilities.isEARProject(project)) { - name += IJ2EEModuleConstants.EAR_EXT; - } else if (JavaEEProjectUtilities.isJCAProject(project)) { - name += IJ2EEModuleConstants.RAR_EXT; - } else { - name += IJ2EEModuleConstants.JAR_EXT; - } - return name; - } - - private boolean hasConflictingProjectInMetaInf(Object lib) { - IProject libProj = null; - if (lib instanceof IProject) { - libProj = (IProject) lib; - } else if (lib instanceof IVirtualComponent) { - libProj = ((IVirtualComponent) lib).getProject(); - } else if (lib instanceof IVirtualReference){ - libProj = ((IVirtualReference) lib).getReferencedComponent().getProject(); - } - if(libProj == null){ - return false; - } - IProject earProject = earComponent.getProject(); - try { - IProject[] earRefProjects = earProject.getReferencedProjects(); - for (int i = 0; i < earRefProjects.length; i++) { - if (!JavaEEProjectUtilities.isEARProject(earRefProjects[i]) && !earRefProjects[i].equals(libProj)) { - IVirtualComponent cmp1 = ComponentCore.createComponent(earRefProjects[i]); - if (cmp1 == null){ - continue; - } - IVirtualReference[] refs = cmp1.getReferences(); - for (int j = 0; j < refs.length; j++) { - if (refs[j].getReferencedComponent().getProject().equals(libProj)) - return true; - } - } - } - return false; - } catch (CoreException ce) { - } - return false; - } - - protected IStatus addComponentsToEar(List<IVirtualComponent> components, String libDir) { - IStatus status = null; - IDataModel datamodel = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider()); - - Map componentToURIMap = new HashMap(); - IVirtualComponent moduleComponent = null; - for (Iterator itr = components.iterator(); itr.hasNext();) { - moduleComponent = (IVirtualComponent) itr.next(); - componentToURIMap.put(moduleComponent, getDefaultURI(moduleComponent)); - } - datamodel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent); - datamodel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, components); - datamodel.setProperty(IAddComponentToEnterpriseApplicationDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, componentToURIMap); - String libDirPath = libDir; - if(libDir != null && libDir.length() > 0) - libDirPath = new Path(libDir).makeAbsolute().toString(); - datamodel.setProperty(IAddComponentToEnterpriseApplicationDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, libDirPath); - try { - return datamodel.getDefaultOperation().execute(new NullProgressMonitor(), null); - } catch (ExecutionException e) { - String msg = e.getMessage() != null ? e.getMessage() : e.toString(); - JEEUIPlugin.logError(msg, e); - } - return status; - } - - protected IStatus removeComponentsFromEar(List<IVirtualComponent> components, String libDir) { - IStatus status = null; - IDataModel datamodel = DataModelFactory.createDataModel(new RemoveComponentFromEnterpriseApplicationDataModelProvider()); - datamodel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent); - datamodel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, components); - try { - status = datamodel.getDefaultOperation().execute(new NullProgressMonitor(), null); - if (!status.isOK()) { - return status; - } - } catch (ExecutionException e) { - String msg = e.getMessage() != null ? e.getMessage() : e.toString(); - JEEUIPlugin.logError(msg, e); - } - return removeReferences(components, libDir, earComponent); - } - - protected IStatus removeReferences(List<IVirtualComponent> components, String libDir, IVirtualComponent sourceComponent) { - IVirtualReference[] refs = sourceComponent.getReferences(); - for (IVirtualReference ref : refs) { - ref.getRuntimePath(); - } - Map componentToURIMap = new HashMap(); - for (Iterator itr = components.iterator(); itr.hasNext();) { - IVirtualComponent moduleComponent = (IVirtualComponent) itr.next(); - componentToURIMap.put(moduleComponent, getDefaultURI(moduleComponent)); - } - final IDataModel model = DataModelFactory.createDataModel(new RemoveReferenceComponentsDataModelProvider()); - model.setProperty(IAddComponentToEnterpriseApplicationDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, componentToURIMap); - model.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, sourceComponent); - model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, components); - if (libDir.length() > 0) { - model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, new Path(libDir).makeAbsolute().toString()); - } - try { - return model.getDefaultOperation().execute(null, null); - } catch (ExecutionException e) { - String msg = e.getMessage() != null ? e.getMessage() : e.toString(); - JEEUIPlugin.logError(msg, e); - } - return Status.CANCEL_STATUS; - } - - protected IStatus resolveConflicts(IVirtualComponent component) { - IProject earProject = earComponent.getProject(); - try { - IProject[] earRefProjects = earProject.getReferencedProjects(); - for (int i = 0; i < earRefProjects.length; i++) { - if (!JavaEEProjectUtilities.isEARProject(earRefProjects[i])) { - IVirtualComponent cmp1 = ComponentCore.createComponent(earRefProjects[i]); - if(cmp1 == null){ - continue; - } - IVirtualReference[] refs = cmp1.getReferences(); - for (int j = 0; j < refs.length; j++) { - if (refs[j].getReferencedComponent().equals(component)) { - List<IVirtualComponent> components = new ArrayList<IVirtualComponent>(); - components.add(refs[j].getReferencedComponent()); - IStatus status = removeReferences(components, refs[j].getRuntimePath().toString(), refs[j].getEnclosingComponent()); - if (!status.isOK()) { - return status; - } - try { - removeManifestDependency(refs[j].getEnclosingComponent(), refs[j].getReferencedComponent()); - } catch (ExecutionException e) { - String msg = e.getMessage() != null ? e.getMessage() : e.toString(); - JEEUIPlugin.logError(msg, e); - } - } - } - } - } - } catch (CoreException ce) { - } - // return false; - return Status.OK_STATUS; - } - - private void removeManifestDependency(final IVirtualComponent source, final IVirtualComponent target) throws ExecutionException { - final String sourceProjName = source.getProject().getName(); - String targetProjName; - if (target instanceof J2EEModuleVirtualArchiveComponent) { - targetProjName = ((J2EEModuleVirtualArchiveComponent) target).getName(); - String[] pathSegments = targetProjName.split("" + IPath.SEPARATOR); //$NON-NLS-1$ - targetProjName = pathSegments[pathSegments.length - 1]; - } else { - targetProjName = target.getProject().getName(); - } - final IProgressMonitor monitor = new NullProgressMonitor(); - final IFile manifestmf = J2EEProjectUtilities.getManifestFile(source.getProject()); - final ArchiveManifest mf = J2EEProjectUtilities.readManifest(source.getProject()); - if (mf == null) - return; - final IDataModel updateManifestDataModel = DataModelFactory.createDataModel(new UpdateManifestDataModelProvider()); - updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.PROJECT_NAME, sourceProjName); - updateManifestDataModel.setBooleanProperty(UpdateManifestDataModelProperties.MERGE, false); - updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.MANIFEST_FILE, manifestmf); - String[] cp = mf.getClassPathTokenized(); - List cpList = new ArrayList(); - String cpToRemove = (targetProjName.endsWith(IJ2EEModuleConstants.JAR_EXT)) ? - targetProjName : targetProjName + IJ2EEModuleConstants.JAR_EXT; - for (int i = 0; i < cp.length; i++) { - if (!cp[i].equals(cpToRemove)) { - cpList.add(cp[i]); - } - } - updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.JAR_LIST, cpList); - updateManifestDataModel.getDefaultOperation().execute(monitor, null); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/dnd/IModuleExtensions.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/dnd/IModuleExtensions.java deleted file mode 100644 index cd9558a5a..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/dnd/IModuleExtensions.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.dnd; - -import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants; - -//@deprecated @see org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants - -public interface IModuleExtensions { - - public String DOT_WAR = IJ2EEModuleConstants.WAR_EXT; - public String DOT_JAR = IJ2EEModuleConstants.JAR_EXT; - public String DOT_RAR = IJ2EEModuleConstants.RAR_EXT; - public String DOT_EAR = IJ2EEModuleConstants.EAR_EXT; - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/AbstractEarGroupProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/AbstractEarGroupProvider.java deleted file mode 100644 index fd2e1dbf7..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/AbstractEarGroupProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ear; - -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractGroupProvider; - -public abstract class AbstractEarGroupProvider extends AbstractGroupProvider { - - public AbstractEarGroupProvider(JavaEEObject javaee) { - super(javaee); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/AbstractEarNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/AbstractEarNode.java deleted file mode 100644 index cab9b5d64..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/AbstractEarNode.java +++ /dev/null @@ -1,158 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ear; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; - -/** - * @author gormov - * - */ -public abstract class AbstractEarNode { - - public static int MODULES_TYPE = 0; - public static int LIBS_TYPE = 1; - - protected int type; - - protected static List implicitUtilityReferenceTypes = - Arrays.asList(new String[] { - IModuleConstants.JST_APPCLIENT_MODULE, - IModuleConstants.JST_WEB_MODULE, - IModuleConstants.JST_EJB_MODULE, - IModuleConstants.JST_CONNECTOR_MODULE}); - - private IProject earProject; - - public AbstractEarNode(IProject earProject) { - this.earProject = earProject; - } - - public IProject getEarProject() { - return earProject; - } - - public abstract List getModules(); - - - public int getType() { - return type; - } - - public abstract String getText(); - - protected List getComponentReferencesAsList(List componentTypes, IVirtualComponent virtualComponent, IPath runtimePath) { - List components = new ArrayList(); - IVirtualComponent earComponent = virtualComponent; - if (earComponent != null ) { - IPath relativeRuntimePath = null; - if (runtimePath != null){ - relativeRuntimePath = runtimePath.makeRelative(); - } - IVirtualReference[] refComponents = earComponent.getReferences(); - for (int i = 0; i < refComponents.length; i++) { - IVirtualComponent module = refComponents[i].getReferencedComponent(); - if (module == null) continue; - // if component types passed in is null then return all components - if (componentTypes == null || componentTypes.size() == 0) { - components.add(refComponents[i]); - } else { - if (componentTypes.contains(JavaEEProjectUtilities.getJ2EEComponentType(module))) { - if (relativeRuntimePath != null){ - IPath runtimePath2 = getRealRuntimePath(refComponents[i]); - if (runtimePath2.makeRelative().equals(relativeRuntimePath)) { - components.add(refComponents[i]); - } - } else { - components.add(refComponents[i]); - } - } - } - } - } - return components; - } - - /** - * This method will return complete list of the binaries contained in the lib dir. - * - * @param virtualComponent - * @param runtimePath - * @return - */ - protected List getBinariesInLibDir(IVirtualComponent virtualComponent, IPath runtimePath, List componentTypes) { - List components = new ArrayList(); - IVirtualComponent earComponent = virtualComponent; - if (earComponent != null ) { - IPath relativeRuntimePath = null; - if (runtimePath != null){ - relativeRuntimePath = runtimePath.makeRelative(); - } - IVirtualReference[] refComponents = earComponent.getReferences(); - for (int i = 0; i < refComponents.length; i++) { - IVirtualComponent module = refComponents[i].getReferencedComponent(); - if (module == null) continue; - // if component types passed in is null then return all components - if (module.isBinary() && relativeRuntimePath != null && !relativeRuntimePath.isEmpty() && getRealRuntimePath(refComponents[i]).makeRelative().equals(relativeRuntimePath)) { - if (componentTypes != null && !componentTypes.contains(JavaEEProjectUtilities.getJ2EEComponentType(module)) ) { - if (runtimePath != null && !runtimePath.makeAbsolute().equals(new Path("/"))){//$NON-NLS-1$ - components.add(refComponents[i]); - } - } else { - components.add(refComponents[i]); - } - - - } - } - } - return components; - } - - - /** - * This method will return all the binaries contained in the lib dir. - * It will not consider modules in lib dir as libraries for that use - * getBinariesInLibDir(IVirtualComponent virtualComponent, IPath runtimePath, List componentTypes) - * - * @param virtualComponent - * @param runtimePath - * @return - * @deprecated since it is not returning the complete list of libraries - * use: getBinariesInLibDir(IVirtualComponent virtualComponent, IPath runtimePath, List componentTypes) - */ - protected List getBinariesInLibDir(IVirtualComponent virtualComponent, IPath runtimePath) { - return getBinariesInLibDir(virtualComponent, runtimePath, null); - } - - protected IPath getRealRuntimePath(IVirtualReference vr){ - IPath runtimePath2 = vr.getRuntimePath(); - if(vr.getArchiveName() != null){ - IPath namePath = new Path (vr.getArchiveName()); - if (namePath.segmentCount()>1 && runtimePath2.segmentCount()==0){ - runtimePath2 = new Path("/"+namePath.removeLastSegments(1).toPortableString()); //$NON-NLS-1$ - } - } - return runtimePath2; - } - - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/Application5ViewerSorter.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/Application5ViewerSorter.java deleted file mode 100644 index 4e1d247fc..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/Application5ViewerSorter.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ear; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jst.j2ee.navigator.internal.ApplicationViewerSorter; - -public class Application5ViewerSorter extends ApplicationViewerSorter { - - @Override -public int compare(Viewer viewer, Object e1, Object e2) { - if(e1 instanceof BundledNode){ - return -1; - } else if(e2 instanceof BundledNode){ - return 1; - } - return super.compare(viewer, e1, e2); -} - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/BundledNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/BundledNode.java deleted file mode 100644 index ef9ecdba7..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/BundledNode.java +++ /dev/null @@ -1,108 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ear; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.project.EarUtilities; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; - -/** - * - * Bundled Libraries node. Sub-node of EAR 5 Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class BundledNode extends AbstractEarNode { - - private static final List<String> UTILITY = Collections.singletonList(J2EEProjectUtilities.UTILITY); - private String nodeName; - private final BundledNode bundledLibsDirectoryNode; - - public BundledNode(IProject earProject, String nodeName, BundledNode bundledLibsDirectoryNode) { - super(earProject); - this.nodeName = nodeName; - this.bundledLibsDirectoryNode = bundledLibsDirectoryNode; - type = LIBS_TYPE; - } - - @Override - public String toString() { - return nodeName; - } - - @Override - public String getText() { - return nodeName; - } - - public void setText(String label) { - nodeName = label; - } - - public BundledNode getBundledLibsDirectoryNode() { - return bundledLibsDirectoryNode; - } - - @Override - public List getModules() { - IVirtualComponent projectComponent = ComponentCore.createComponent(getEarProject()); - - Path libPath = new Path("/"); //$NON-NLS-1$ - if (bundledLibsDirectoryNode == null){ - String modelLibPath = EarUtilities.getEARLibDir(projectComponent); - String prefix = "/"; //$NON-NLS-1$ - if (modelLibPath.startsWith(prefix)){ - prefix = ""; //$NON-NLS-1$ - } - libPath = new Path(prefix + modelLibPath); - } - - List libs = getComponentReferencesAsList(UTILITY, projectComponent, - libPath); - libs.addAll(getBinariesInLibDir(projectComponent,libPath, UTILITY)); - if(bundledLibsDirectoryNode == null) - libs.addAll(getComponentReferencesAsList(implicitUtilityReferenceTypes, projectComponent, libPath)); - - List modules = new ArrayList(); - for (int i = 0; i < libs.size(); i++) { - IVirtualReference reference = (IVirtualReference) libs.get(i); - - IPath runtimePath = getRealRuntimePath(reference); - - if (runtimePath != null && runtimePath.segment(0) != null && !libPath.makeRelative().isEmpty() && - runtimePath.makeRelative().equals(libPath.makeRelative())) { - if (bundledLibsDirectoryNode == null){ - modules.add(libs.get(i)); - } - - } else { - if (bundledLibsDirectoryNode != null){ - modules.add(libs.get(i)); - } - } - } - if (bundledLibsDirectoryNode != null){ - modules.add(bundledLibsDirectoryNode); - } - return modules; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/GroupEARProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/GroupEARProvider.java deleted file mode 100644 index 307b0455b..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/GroupEARProvider.java +++ /dev/null @@ -1,154 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008, 2010 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ear; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.project.EarUtilities; -import org.eclipse.jst.javaee.application.Application; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * Ear 5 Deployment descriptor node. - * - * @author Dimitar Giormov - * @author Kaloyan Raev - */ -public class GroupEARProvider extends AbstractEarGroupProvider implements IAdaptable { - - private static final String PROJECT_RELATIVE_PATH = "META-INF/application.xml"; //$NON-NLS-1$ - public final static String EAR_DEFAULT_LIB = "lib"; //$NON-NLS-1$ - private static Image ear50Image; - private static Image ear60Image; - private EARVirtualComponent earComponent; - private IFile ddFile; - - private BundledNode bundledLibsNode; - private ModulesNode modulesNode; - - public GroupEARProvider(Application application, EARVirtualComponent wtpComponent) { - super(application); - earComponent = wtpComponent; - } - - public IProject getProject() { - return earComponent.getProject(); - } - - @Override - public String getText() { - return NLS.bind(Messages.DEPLOYMENT_DESCRIPTOR, earComponent.getName()); - } - - public EARVirtualComponent getEARVirtualComponent() { - return this.earComponent; - } - - @Override - public List getChildren() { - List children = new ArrayList(); - IProject project = getProject(); - - try { - IFacetedProject facetedProject = ProjectFacetsManager.create(project); - //EE6TODO - if (facetedProject != null && - (facetedProject.hasProjectFacet( - ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE).getVersion( - J2EEVersionConstants.VERSION_5_0_TEXT)) || facetedProject.hasProjectFacet( - ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE).getVersion( - J2EEVersionConstants.VERSION_6_0_TEXT)))) { - - if (bundledLibsNode == null) { - BundledNode bundledLibsDirectoryNode = new BundledNode(project, Messages.LIBRARY_DIRECTORY + ": " + EarUtilities.getEARLibDir(earComponent), null);//$NON-NLS-1$ - bundledLibsNode = new BundledNode(project, Messages.BUNDLED_LIBRARIES_NODE, bundledLibsDirectoryNode); - } else { - bundledLibsNode.getBundledLibsDirectoryNode().setText(Messages.LIBRARY_DIRECTORY + ": " + EarUtilities.getEARLibDir(earComponent));//$NON-NLS-1$ - } - - if(modulesNode == null){ - modulesNode = new ModulesNode(project); - } - - - children.add(modulesNode); - children.add(bundledLibsNode); - } - } catch (CoreException e) { - String msg = "Error in the JEEContentProvider.getChildren() for parent:" + this; //$NON-NLS-1$ - JEEUIPlugin.logError(msg, e); - } - return children; - } - - @Override - public Image getImage() { - String version = ((Application) javaee).getVersion(); - if (J2EEVersionConstants.VERSION_5_TEXT.equals(version)) { - return getEar50Image(); - } else if (J2EEVersionConstants.VERSION_6_TEXT.equals(version)) { - return getEar60Image(); - } - return getEar50Image(); - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - public IFile getDDFile() { - if (ddFile != null){ - return ddFile; - } - IVirtualFolder virtualFolder = ComponentCore.createComponent(getProject()).getRootFolder(); - ddFile = virtualFolder.getFile(PROJECT_RELATIVE_PATH).getUnderlyingFile(); - return ddFile; - } - - public Object getAdapter(Class adapter) { - if (IProject.class == adapter){ - return getProject(); - } - return null; - } - - private Image getEar50Image() { - if (ear50Image == null) { - ear50Image = JEEUIPlugin.getDefault().getImageDescriptor(JEEUIPluginIcons.EAR_IMAGE).createImage(); - } - return ear50Image; - } - - private Image getEar60Image() { - if (ear60Image == null) { - ear60Image = JEEUIPlugin.getDefault().getImageDescriptor(JEEUIPluginIcons.EAR6_IMAGE).createImage(); - } - return ear60Image; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/ModulesNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/ModulesNode.java deleted file mode 100644 index ef417a25c..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/ModulesNode.java +++ /dev/null @@ -1,51 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ear; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.project.EarUtilities; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -/** - * - * Modules sub-node of EAR Deployment descriptor node Java EE 5 - * - * @author Dimitar Giormov - * - */ -public class ModulesNode extends AbstractEarNode { - - public ModulesNode(IProject earProject) { - super(earProject); - type = MODULES_TYPE; - } - - @Override - public String toString() { - return Messages.EAR_MODULES_NODE; - } - - @Override - public String getText() { - return Messages.EAR_MODULES_NODE; - } - - @Override - public List getModules() { - IVirtualComponent projectComponent = ComponentCore.createComponent(getEarProject()); - return Arrays.asList(EarUtilities.getJ2EEModuleReferences(projectComponent)); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/ShowDepPropPageAction.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/ShowDepPropPageAction.java deleted file mode 100644 index 876001028..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ear/ShowDepPropPageAction.java +++ /dev/null @@ -1,50 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ear; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.internal.dialogs.PropertyDialog; - -public class ShowDepPropPageAction implements IObjectActionDelegate -{ - - private ISelection sel; - - public void selectionChanged(IAction action, ISelection selection) { - sel = selection; - } - - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - } - - public void run(IAction action) { - if (sel == null){ - return; - } - Object selectedObject = ((IStructuredSelection) sel).getFirstElement(); - if (selectedObject instanceof ModulesNode) { - IProject earProject = ((ModulesNode)selectedObject).getEarProject(); - PreferenceDialog dialog = PropertyDialog.createDialogOn(PlatformUI.getWorkbench().getActiveWorkbenchWindow(). - getShell(), "org.eclipse.wst.common.componentcore.ui.DeploymentAssemblyPage", earProject); //$NON-NLS-1$ - if (dialog != null) { - dialog.open(); - } - } - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/AbstractEjbGroupProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/AbstractEjbGroupProvider.java deleted file mode 100644 index ac62cf0e7..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/AbstractEjbGroupProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractGroupProvider; - -public abstract class AbstractEjbGroupProvider extends AbstractGroupProvider{ - - public AbstractEjbGroupProvider(JavaEEObject javaee) { - super(javaee); - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/ActivationConfigProperties.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/ActivationConfigProperties.java deleted file mode 100644 index d471c9b77..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/ActivationConfigProperties.java +++ /dev/null @@ -1,55 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import java.net.URL; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractDDNode; -import org.eclipse.swt.graphics.Image; - -/** - * Deployment Descriptor node that contains information about ActivationConfigProperties. - * - * @author Dimitar Giormov - * - */ -public class ActivationConfigProperties extends AbstractDDNode { - - public ActivationConfigProperties(Object adapterNode) { - super(adapterNode); - } - - @Override - public List getChildren() { - return (List) adapterNode; - } - - @Override - public boolean hasChildren() { - return true; - } - - @Override - public String getText() { - return Messages.ACTIVATION_CONFIG_PROPERTIES; - } - - @Override - public Image getImage() { - URL url = (URL) J2EEPlugin.getPlugin().getImage("access_intent_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanDecorator.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanDecorator.java deleted file mode 100644 index b2ed57670..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanDecorator.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IDecoration; -import org.eclipse.jface.viewers.ILightweightLabelDecorator; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; - -public class BeanDecorator extends LabelProvider implements ILightweightLabelDecorator { - - public void decorate(Object element, IDecoration decoration) { - if (element instanceof BeanInterfaceNode){ - BeanInterfaceNode beanInteraceNode = (BeanInterfaceNode) element; - switch (beanInteraceNode.getKind()) { - case BeanInterfaceNode.KINDS.BUSSINESS_LOCAL: - applyDecorator(JEEUIPluginIcons.BUSSINESS_LOCAL, decoration); - break; - case BeanInterfaceNode.KINDS.BUSSINESS_REMOTE: - applyDecorator(JEEUIPluginIcons.BUSSINESS_REMOTE, decoration); - break; - case BeanInterfaceNode.KINDS.REMOTE: - applyDecorator(JEEUIPluginIcons.REMOTE, decoration); - break; - case BeanInterfaceNode.KINDS.REMOTE_HOME: - applyDecorator(JEEUIPluginIcons.REMOTE_HOME, decoration); - break; - case BeanInterfaceNode.KINDS.LOCAL: - applyDecorator(JEEUIPluginIcons.LOCAL, decoration); - break; - case BeanInterfaceNode.KINDS.LOCAL_HOME: - applyDecorator(JEEUIPluginIcons.LOCAL_HOME, decoration); - break; - } - } else if (element instanceof BeanNode){ - decoration.addOverlay(J2EEUIPlugin.getDefault().getImageDescriptor("ejb_module_ovr")); //$NON-NLS-1$ - } - } - - private void applyDecorator(String id, IDecoration decoration) { - ImageDescriptor imageDescriptor = JEEUIPlugin.getDefault().getImageDescriptor(id); - decoration.addOverlay(imageDescriptor); - - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanInterfaceNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanInterfaceNode.java deleted file mode 100644 index d3ea465d4..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanInterfaceNode.java +++ /dev/null @@ -1,75 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jdt.internal.ui.JavaPluginImages; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractDDNode; -import org.eclipse.swt.graphics.Image; - -/** - * Deployment Descriptor node that contains information about Session or Entity - * beans interfaces (Business, Component and Local interfaces). - * - * @author Dimitar Giormov - */ -public class BeanInterfaceNode extends AbstractDDNode { - - private final int kind; - private final String _fqn; - - public class KINDS { - public static final int BUSSINESS_LOCAL = 0; - public static final int BUSSINESS_REMOTE = 1; - public static final int LOCAL = 2; - public static final int LOCAL_HOME = 3; - public static final int REMOTE = 4; - public static final int REMOTE_HOME = 5; - } - - public BeanInterfaceNode(Object adapterNode, String _fqn, int kind) { - super(adapterNode); - this._fqn = _fqn; - this.kind = kind; - } - - @Override - public String getText() { - return Signature.getSimpleName(_fqn); - } - - @Override - public List getChildren() { - return new ArrayList(); - } - - @Override - public boolean hasChildren() { - return false; - } - - @Override - public Image getImage() { - return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CUNIT); - } - - public String get_fqn() { - return _fqn; - } - - public int getKind() { - return kind; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanNode.java deleted file mode 100644 index ea3aaf73f..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanNode.java +++ /dev/null @@ -1,74 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import java.util.List; - -import org.eclipse.jdt.core.Signature; -import org.eclipse.jdt.internal.ui.JavaPluginImages; -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.javaee.ejb.EntityBean; -import org.eclipse.jst.javaee.ejb.MessageDrivenBean; -import org.eclipse.jst.javaee.ejb.SessionBean; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractDDNode; -import org.eclipse.swt.graphics.Image; - -/** - * Deployment Descriptor node that contains information about Enterprise beans. - * - * - * @author Dimitar Giormov - * - */ -public class BeanNode extends AbstractDDNode { - - public BeanNode(JavaEEObject bean) { - super(bean); - image = null; - String qualified = getEjbClassQualifiedName(); - if (qualified != null) { - text = Signature.getSimpleName(qualified); - description = Messages.ENTERPRISE_BEAN_CLASS_DESCRIPTION + qualified; - } - } - - public String getEjbClassQualifiedName() { - if (adapterNode instanceof SessionBean){ - return ((SessionBean)adapterNode).getEjbClass(); - } else if (adapterNode instanceof MessageDrivenBean){ - return ((MessageDrivenBean)adapterNode).getEjbClass(); - }else if (adapterNode instanceof EntityBean){ - return ((EntityBean)adapterNode).getEjbClass(); - } - return null; - } - - public JavaEEObject getEnterpriseBean(){ - return (JavaEEObject) adapterNode; - } - - @Override - public List getChildren() { - return null; - } - - @Override - public boolean hasChildren() { - return false; - } - - @Override - public Image getImage() { - return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CUNIT); - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanNodePropertyTester.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanNodePropertyTester.java deleted file mode 100644 index 68355cc2c..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/BeanNodePropertyTester.java +++ /dev/null @@ -1,57 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.jst.javaee.ejb.MessageDrivenBean; -import org.eclipse.jst.javaee.ejb.SessionBean; - -public class BeanNodePropertyTester extends PropertyTester { - - public static final String BEAN_TYPE = "beanType"; //$NON-NLS-1$ - public static final String IS_SESSION_BEAN = "isSessionBean"; //$NON-NLS-1$ - public static final String IS_MESSAGE_DRIVEN = "isMessageDrivenBean"; //$NON-NLS-1$ - - public boolean test(Object receiver, String property, Object[] args, - Object expectedValue) { - - if (!(receiver instanceof BeanNode)) { - return false; - } - - Object adapterNode = ((BeanNode) receiver).getAdapterNode(); - - String val = (String) expectedValue; - if (BEAN_TYPE.equals(property)) { - if (IS_SESSION_BEAN.equals(val)) { - return isSessionBean(adapterNode); - } else if (IS_MESSAGE_DRIVEN.equals(val)) { - return isMessageDrivenBean(adapterNode); - } - return false; - } - return false; - } - - private boolean isMessageDrivenBean(Object obj) { - if (obj instanceof MessageDrivenBean) { - return true; - } - return false; - } - - private boolean isSessionBean(Object obj) { - if (obj instanceof SessionBean) - return true; - return false; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEJBProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEJBProvider.java deleted file mode 100644 index 1870fe61c..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEJBProvider.java +++ /dev/null @@ -1,90 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.javaee.ejb.EJBJar; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; -/** - * Deployment Descriptor root node. - * - * @author Dimitar Giormov - * - */ -public class GroupEJBProvider extends AbstractEjbGroupProvider implements IAdaptable { - - private GroupEjbSession groupEjbSession; - private GroupEjbMessageDriven groupEjbMessageDriven; - private GroupEjbEntity groupEjbEntity; - private String projectName = null; - - - public GroupEJBProvider(EJBJar ejbJar) { - super(ejbJar); - - groupEjbSession = new GroupEjbSession(ejbJar); - groupEjbMessageDriven = new GroupEjbMessageDriven(ejbJar); - groupEjbEntity = new GroupEjbEntity(ejbJar); - - children.add(groupEjbSession); - children.add(groupEjbMessageDriven); - children.add(groupEjbEntity); - } - - @Override - public List getChildren() { - return children; - } - - public EJBJar getEjbJar() { - return (EJBJar) javaee; - } - - @Override - public String getText() { - return NLS.bind(Messages.DEPLOYMENT_DESCRIPTOR, projectName); - } - - public String getProjectName() { - return projectName; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - @Override - public Image getImage() { - return null; - } - - @Override - public void reinit(JavaEEObject modelObject) { - super.reinit(modelObject); - groupEjbSession.reinit(modelObject); - groupEjbMessageDriven.reinit(modelObject); - groupEjbEntity.reinit(modelObject); - } - - public Object getAdapter(Class adapter) { - if (IProject.class == adapter){ - return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName()); - } - return null; - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbEntity.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbEntity.java deleted file mode 100644 index 598c93a19..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbEntity.java +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.ejb.EJBJar; -import org.eclipse.jst.javaee.ejb.EnterpriseBeans; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractDDNode; -import org.eclipse.swt.graphics.Image; - -/** - * Entity Beans group Deployment Descriptor node that has a number of sub nodes - * - * @author Dimitar Giormov - * - */ -public class GroupEjbEntity extends AbstractDDNode { - - public GroupEjbEntity(EJBJar parent) { - super(parent); - image = null; - text = Messages.ENTITY_BEANS; - } - - @Override - public List getChildren() { - List children = new ArrayList(); - List entities = null; - EnterpriseBeans enterpriseBeans = ((EJBJar) adapterNode).getEnterpriseBeans(); - if (enterpriseBeans != null) - entities = enterpriseBeans.getEntityBeans(); - if (entities != null && entities.size() >0){ - children.addAll(entities); - } - return children; - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - @Override - public Image getImage() { - URL url = (URL) J2EEPlugin.getPlugin().getImage("cmpEntity_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbMessageDriven.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbMessageDriven.java deleted file mode 100644 index d0f88466a..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbMessageDriven.java +++ /dev/null @@ -1,61 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.ejb.EJBJar; -import org.eclipse.jst.javaee.ejb.EnterpriseBeans; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractDDNode; -import org.eclipse.swt.graphics.Image; -/** - * Message Driven Beans group Deployment Descriptor node that has a number of sub nodes - * - * @author Dimitar Giormov - * - */ -public class GroupEjbMessageDriven extends AbstractDDNode { - - public GroupEjbMessageDriven(EJBJar parent) { - super(parent); - image = null; - text = Messages.MESSAGE_DRIVEN_BEANS; - } - - @Override - public List getChildren() { - List children = new ArrayList(); - List msgBeans = null; - EnterpriseBeans enterpriseBeans = ((EJBJar) adapterNode).getEnterpriseBeans(); - if (enterpriseBeans != null) - msgBeans = enterpriseBeans.getMessageDrivenBeans(); - if (msgBeans != null && msgBeans.size()>0){ - children.addAll(msgBeans); - } - return children; - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - @Override - public Image getImage() { - URL url = (URL) J2EEPlugin.getPlugin().getImage("message_bean_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbSession.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbSession.java deleted file mode 100644 index de7d7faa7..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ejb/GroupEjbSession.java +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.ejb; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.ejb.EJBJar; -import org.eclipse.jst.javaee.ejb.EnterpriseBeans; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractDDNode; -import org.eclipse.swt.graphics.Image; - - -/** - * Session Beans group Deployment Descriptor node that has a number of sub nodes - * - * @author Dimitar Giormov - */ -public class GroupEjbSession extends AbstractDDNode { - - public GroupEjbSession(EJBJar parent) { - super(parent); - image = null; - text = Messages.SESSION_BEANS; - } - - @Override - public List getChildren() { - List children = new ArrayList(); - List sessionBeans = null; - EnterpriseBeans enterpriseBeans = ((EJBJar) adapterNode).getEnterpriseBeans(); - if (enterpriseBeans != null) - sessionBeans = enterpriseBeans.getSessionBeans(); - - if (sessionBeans != null && sessionBeans.size()>0){ - children.addAll(sessionBeans); - } - return children; - } - - @Override - public boolean hasChildren() { - return !this.getChildren().isEmpty(); - } - - @Override - public Image getImage() { - URL url = (URL) J2EEPlugin.getPlugin().getImage("sessionBean_obj"); //$NON-NLS-1$ - return ImageDescriptor.createFromURL(url).createImage(); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/AbstractConnectorGroupProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/AbstractConnectorGroupProvider.java deleted file mode 100644 index f2e1add9b..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/AbstractConnectorGroupProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.jee.ui.internal.navigator.AbstractGroupProvider;
-
-public abstract class AbstractConnectorGroupProvider extends AbstractGroupProvider {
-
- public AbstractConnectorGroupProvider(JavaEEObject javaee) {
- super(javaee);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/ActicationSpecNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/ActicationSpecNode.java deleted file mode 100644 index b8b6c87f5..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/ActicationSpecNode.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.javaee.jca.ActivationSpec;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.swt.graphics.Image;
-
-public class ActicationSpecNode extends AbstractConnectorGroupProvider {
-
- public ActicationSpecNode(JavaEEObject javaee) {
- super(javaee);
- }
-
- @Override
- public String getText() {
- return Messages.ActicationSpecNode_ActivationSpec + (((ActivationSpec)javaee).getActivationspecClass() != null ? ((ActivationSpec)javaee).getActivationspecClass() :""); //$NON-NLS-1$
- }
-
- @Override
- public boolean hasChildren() {
- return ((ActivationSpec)javaee).getRequiredConfigProperty() != null && ((ActivationSpec)javaee).getRequiredConfigProperty().size() > 0;
- }
-
- @Override
- public List getChildren() {
- List children = new ArrayList();
- children.addAll(((ActivationSpec)javaee).getRequiredConfigProperty());
- return children;
- }
-
- @Override
- public Image getImage() {
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/AdminObjectNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/AdminObjectNode.java deleted file mode 100644 index 24d6e2922..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/AdminObjectNode.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.javaee.jca.AdminObject;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.swt.graphics.Image;
-
-public class AdminObjectNode extends AbstractConnectorGroupProvider {
-
- public AdminObjectNode(JavaEEObject javaee) {
- super(javaee);
- }
-
- @Override
- public List getChildren() {
- List children = new ArrayList();
-// children.addAll(((AdminObject)javaee).getConfigProperty());
- return children;
- }
-
-
-
- @Override
- public boolean hasChildren() {
- return false;
- }
-
- @Override
- public Image getImage() {
- return null;
- }
-
- @Override
- public String getText() {
- return Messages.ConnectorLabelProvider_ADMIN_OBJECT + (((AdminObject)javaee).getAdminobjectInterface() != null ? ((AdminObject)javaee).getAdminobjectInterface() :""); //$NON-NLS-1$
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/GroupRaContentProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/GroupRaContentProvider.java deleted file mode 100644 index b5ee3aa71..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/GroupRaContentProvider.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.javaee.jca.Connector;
-import org.eclipse.jst.javaee.jca.ResourceAdapter;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin;
-import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons;
-import org.eclipse.swt.graphics.Image;
-
-public class GroupRaContentProvider extends AbstractConnectorGroupProvider {
-
-
- private Image RA_IMAGE;
-
- public GroupRaContentProvider(JavaEEObject javaee1) {
- super(javaee1);
- }
-
- @Override
- public List getChildren() {
- List children = new ArrayList();
- Connector connector = (Connector) javaee;
- ResourceAdapter ra = connector.getResourceadapter();
- if (ra == null){
- return children;
- }
- if (ra.getAdminobject() != null){
- for (Object object : ra.getAdminobject() ) {
- children.add(new AdminObjectNode((JavaEEObject) object));
- }
- }
- if (ra.getConfigProperty() != null){
- children.addAll(ra.getConfigProperty());
- }
-
- if (ra.getSecurityPermission() != null){
- children.addAll(ra.getSecurityPermission());
- }
- if (ra.getInboundResourceadapter() != null){
- children.add(new InboundRaNode(ra.getInboundResourceadapter()));
- }
- if (ra.getOutboundResourceadapter()!= null){
- children.add(new OutboundRaNode(ra.getOutboundResourceadapter()));
-
- }
- return children;
- }
-
- @Override
- public Image getImage() {
- if (RA_IMAGE == null) {
- RA_IMAGE = JEEUIPlugin.getDefault().getImage(JEEUIPluginIcons.IMG_RESOURCE_ADAPTER);
- }
- return RA_IMAGE;
- }
-
- @Override
- public String getText() {
- return Messages.GroupRaContentProvider_RESOURCE_ADAPTER;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/InboundRaNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/InboundRaNode.java deleted file mode 100644 index 70079672b..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/InboundRaNode.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.javaee.jca.InboundResourceAdapter;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.swt.graphics.Image;
-
-public class InboundRaNode extends AbstractConnectorGroupProvider {
-
- public InboundRaNode(JavaEEObject javaee) {
- super(javaee);
- }
-
- @Override
- public List getChildren() {
- List children = new ArrayList();
- children.add(new MessageAdapterNode(((InboundResourceAdapter)javaee).getMessageadapter()));
- return children;
- }
-
- @Override
- public Image getImage() {
- return null;
- }
-
- @Override
- public String getText() {
- return Messages.InboundRaNode_Inbound_Resource_adapter;
- }
-
- @Override
- public boolean hasChildren() {
- return ((InboundResourceAdapter)javaee).getMessageadapter() != null;
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/MessageAdapterNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/MessageAdapterNode.java deleted file mode 100644 index 9398db4d6..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/MessageAdapterNode.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.javaee.jca.MessageAdapter;
-import org.eclipse.jst.javaee.jca.MessageListener;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.swt.graphics.Image;
-
-public class MessageAdapterNode extends AbstractConnectorGroupProvider {
-
- public MessageAdapterNode(JavaEEObject javaee) {
- super(javaee);
- }
-
- @Override
- public List getChildren() {
- List children = new ArrayList();
- List<MessageListener> messagelistener = ((MessageAdapter)javaee).getMessagelistener();
- for (MessageListener messageListener2 : messagelistener) {
- children.add(new MessageListenerNode(messageListener2));
- }
- return children;
- }
-
- @Override
- public Image getImage() {
- return null;
- }
-
- @Override
- public String getText() {
- return Messages.MessageAdapterNode_MESSAGE_ADAPTER;
- }
-
- @Override
- public boolean hasChildren() {
- List<MessageListener> messagelistener = ((MessageAdapter)javaee).getMessagelistener();
- return messagelistener != null && messagelistener.size()>0;
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/MessageListenerNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/MessageListenerNode.java deleted file mode 100644 index dc6b2ece9..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/MessageListenerNode.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.javaee.jca.MessageListener;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.swt.graphics.Image;
-
-public class MessageListenerNode extends AbstractConnectorGroupProvider {
-
- public MessageListenerNode(JavaEEObject javaee) {
- super(javaee);
- }
-
-
-
- @Override
- public List getChildren() {
- List children = new ArrayList();
- children.add(new ActicationSpecNode(((MessageListener)javaee).getActivationspec()));
- return children;
- }
-
-
-
- @Override
- public boolean hasChildren() {
- return ((MessageListener)javaee).getActivationspec() != null;
- }
-
- @Override
- public Image getImage() {
- return null;
- }
-
- @Override
- public String getText() {
- return Messages.MessageListenerNode_MessageListener + (((MessageListener)javaee).getMessagelistenerType() != null ? ((MessageListener)javaee).getMessagelistenerType() :""); //$NON-NLS-1$
- }
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/OutboundRaNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/OutboundRaNode.java deleted file mode 100644 index e65d4dbb3..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/OutboundRaNode.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.javaee.jca.OutboundResourceAdapter;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.swt.graphics.Image;
-
-public class OutboundRaNode extends AbstractConnectorGroupProvider {
-
- public OutboundRaNode(JavaEEObject javaee) {
- super(javaee);
- }
-
- @Override
- public List getChildren() {
- List children = new ArrayList();
- children.addAll(((OutboundResourceAdapter)javaee).getConnectionDefinition());
- return children;
- }
- @Override
- public Image getImage() {
- return null;
- }
-
- @Override
- public boolean hasChildren() {
- return ((OutboundResourceAdapter)javaee).getConnectionDefinition() != null && ((OutboundResourceAdapter)javaee).getConnectionDefinition().size() >0;
- }
-
- @Override
- public String getText() {
- return Messages.OutboundRaNode_OutboundResourceAdapter;
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/RaGroupContentProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/RaGroupContentProvider.java deleted file mode 100644 index 56172ad66..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/ra/RaGroupContentProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.ra;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.javaee.core.JavaEEObject;
-import org.eclipse.jst.javaee.jca.Connector;
-import org.eclipse.jst.jee.ui.internal.Messages;
-import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin;
-import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.graphics.Image;
-
-public class RaGroupContentProvider extends AbstractConnectorGroupProvider {
-
- private IProject project;
- private Image CONNECTOR_IMAGE;
-
- public RaGroupContentProvider(JavaEEObject javaee, IProject project) {
- super(javaee);
- this.project = project;
- }
-
- @Override
- public List getChildren() {
- List children = new ArrayList();
- children.add(new GroupRaContentProvider(javaee));
- if(((Connector)javaee).getLicense() != null){
- children.add(((Connector)javaee).getLicense());
- }
- return children;
- }
-
- @Override
- public Image getImage() {
- if (CONNECTOR_IMAGE == null) {
- CONNECTOR_IMAGE = JEEUIPlugin.getDefault().getImage(JEEUIPluginIcons.IMG_CONNECTOR);
- }
- return CONNECTOR_IMAGE;
- }
-
-
- @Override
- public String getText() {
- return NLS.bind(Messages.DEPLOYMENT_DESCRIPTOR, project.getName());
- }
-
-}
diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/AbstractWebGroupProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/AbstractWebGroupProvider.java deleted file mode 100644 index 16f020b99..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/AbstractWebGroupProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractGroupProvider; - -public abstract class AbstractWebGroupProvider extends AbstractGroupProvider { - - public AbstractWebGroupProvider(JavaEEObject javaee) { - super(javaee); - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupContextParamsItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupContextParamsItemProvider.java deleted file mode 100644 index 6a8aa775f..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupContextParamsItemProvider.java +++ /dev/null @@ -1,65 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * Context Parameters group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupContextParamsItemProvider extends AbstractWebGroupProvider{ - - private static Image CONTEXT_PARAM_IMAGE; - - public GroupContextParamsItemProvider(WebApp webApp) { - super(webApp); - text = Messages.CONTEXT_PARAMS_ITEM_PROVIDER; - } - - @Override - public List getChildren() { - if (javaee != null){ - return ((WebApp) javaee).getContextParams(); - } - return null; - } - - @Override - public Image getImage() { - return getContextParamsImage(); - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - public static Image getContextParamsImage() { - if (CONTEXT_PARAM_IMAGE == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.GROUP_CONTEXT_PARAM); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - CONTEXT_PARAM_IMAGE = imageDescriptor.createImage(); - } - return CONTEXT_PARAM_IMAGE; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupErrorPagesItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupErrorPagesItemProvider.java deleted file mode 100644 index fd504a59f..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupErrorPagesItemProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.web.ErrorPage; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * Error pages group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupErrorPagesItemProvider extends AbstractWebGroupProvider{ - - private static Image ERROR_PAGES; - private static Image EXCEPTION_ERROR_PAGES; - - public GroupErrorPagesItemProvider(WebApp webApp) { - super(webApp); - text = Messages.ERROR_PAGES_ITEM_PROVIDER; - } - - @Override - public List getChildren() { - if (javaee != null){ - return ((WebApp) javaee).getErrorPages(); - } - return null; - } - - @Override - public Image getImage() { - return getErrorPagesImage(); - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - public static Image getErrorPagesImage() { - if (ERROR_PAGES == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.GROUP_ERROR_PAGE); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - ERROR_PAGES = imageDescriptor.createImage(); - } - return ERROR_PAGES; - } - - public static Image getErrorPagesImage(ErrorPage element) { - if (element.getErrorCode() != null){ - - } - if (EXCEPTION_ERROR_PAGES == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.GROUP_ERROR_PAGE); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - EXCEPTION_ERROR_PAGES = imageDescriptor.createImage(); - } - return EXCEPTION_ERROR_PAGES; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupFilterMappingItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupFilterMappingItemProvider.java deleted file mode 100644 index 35c131dbd..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupFilterMappingItemProvider.java +++ /dev/null @@ -1,105 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.core.UrlPatternType; -import org.eclipse.jst.javaee.web.FilterMapping; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * Filter mappings group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupFilterMappingItemProvider extends AbstractWebGroupProvider { - - private static Image FILTER_MAPPING; - - public GroupFilterMappingItemProvider(WebApp webApp) { - super(webApp); - text = Messages.FILTER_MAPPING_ITEM_PROVIDER; - } - - @Override - public List<?> getChildren() { - if (javaee != null){ - return flattenMapping(((WebApp) javaee).getFilterMappings()); - } - return null; - } - - private List<?> flattenMapping(List<FilterMapping> filterMappings) { - List<FilterMappingUIWrapper> result = new ArrayList<FilterMappingUIWrapper>(); - if (filterMappings != null && filterMappings.size() > 0){ - for (FilterMapping filterMapping : filterMappings) { - result.addAll(getFilterMappingDisplay(filterMapping)); - } - } - return result; - } - - @Override - public Image getImage() { - return getFilterMappingImage(); - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - public static Image getFilterMappingImage() { - if (FILTER_MAPPING == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.GROUP_FILTER_MAPPING); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - FILTER_MAPPING = imageDescriptor.createImage(); - } - return FILTER_MAPPING; - } - - private List<FilterMappingUIWrapper> getFilterMappingDisplay(FilterMapping element) { - List<FilterMappingUIWrapper> result = new ArrayList<FilterMappingUIWrapper>(); - String value = null; - if (element.getUrlPatterns().size() > 0){ - for (UrlPatternType pattern : element.getUrlPatterns()) { - value = pattern.getValue(); - result.add(new FilterMappingUIWrapper(value + " -> " + element.getFilterName())); //$NON-NLS-1$ - } - - } - return result; - } - - public class FilterMappingUIWrapper { - private String value; - - public String getValue() { - return value; - } - - public FilterMappingUIWrapper(String value) { - super(); - this.value = value; - } - } - - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupFiltersItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupFiltersItemProvider.java deleted file mode 100644 index 20f107c49..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupFiltersItemProvider.java +++ /dev/null @@ -1,66 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * Filters group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupFiltersItemProvider extends AbstractWebGroupProvider{ - - private static Image FILTER; - - public GroupFiltersItemProvider(WebApp webApp) { - super(webApp); - text = Messages.FILTERS_ITEM_PROVIDER; - } - - @Override - public List getChildren() { - if (javaee != null){ - return ((WebApp) javaee).getFilters(); - } - return null; - } - - @Override - public Image getImage() { - return getFiltersImage(); - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - public static Image getFiltersImage() { - if (FILTER == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.FILTER_MAPPING); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - FILTER = imageDescriptor.createImage(); - } - return FILTER; - } - - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupListenerItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupListenerItemProvider.java deleted file mode 100644 index d99360e05..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupListenerItemProvider.java +++ /dev/null @@ -1,66 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * Listener group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupListenerItemProvider extends AbstractWebGroupProvider{ - - private static Image LISTENER; - - public GroupListenerItemProvider(WebApp webApp) { - super(webApp); - text = Messages.LISTENER_ITEM_PROVIDER; - } - - @Override - public List getChildren() { - if (javaee != null){ - return ((WebApp) javaee).getListeners(); - } - return null; - } - - @Override - public Image getImage() { - return getListenersImage(); - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - public static Image getListenersImage() { - if (LISTENER == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.GROUP_LISTENER); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - LISTENER = imageDescriptor.createImage(); - } - return LISTENER; - } - - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupReferenceItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupReferenceItemProvider.java deleted file mode 100644 index 103add592..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupReferenceItemProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * JNDI References group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupReferenceItemProvider extends AbstractWebGroupProvider{ - - private static Image REFERENCES; - - public GroupReferenceItemProvider(WebApp webApp) { - super(webApp); - text = Messages.REFERENCES; - } - - - @Override - public List getChildren() { - List result = new ArrayList(); - if (javaee != null){ - result.addAll(((WebApp) javaee).getEjbRefs()); - result.addAll(((WebApp) javaee).getEjbLocalRefs()); - result.addAll(((WebApp) javaee).getResourceRefs()); - result.addAll(((WebApp) javaee).getResourceEnvRefs()); - result.addAll(((WebApp) javaee).getEnvEntries()); - result.addAll(((WebApp) javaee).getMessageDestinationRefs()); - result.addAll(((WebApp) javaee).getPersistenceContextRefs()); - result.addAll(((WebApp) javaee).getPersistenceUnitRefs()); - result.addAll(((WebApp) javaee).getServiceRefs()); - return result; - } - return null; - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - - @Override - public Image getImage() { - return getReferencesImage(); - } - - - public static Image getReferencesImage() { - if (REFERENCES == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.RESOURCE_REFERENCE_OBJ); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - REFERENCES = imageDescriptor.createImage(); - } - return REFERENCES; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupServletItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupServletItemProvider.java deleted file mode 100644 index b737d317c..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupServletItemProvider.java +++ /dev/null @@ -1,68 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * Servlets group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupServletItemProvider extends AbstractWebGroupProvider{ - - private static Image SERVLET; - - public GroupServletItemProvider(WebApp webApp) { - super(webApp); - text = Messages.SERVLET_ITEM_PROVIDER; - } - - - @Override - public List getChildren() { - if (javaee != null){ - return ((WebApp) javaee).getServlets(); - } - return null; - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - - @Override - public Image getImage() { - return getServletImage(); - } - - - public static Image getServletImage() { - if (SERVLET == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.GROUP_SERVLET); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - SERVLET = imageDescriptor.createImage(); - } - return SERVLET; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupServletMappingItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupServletMappingItemProvider.java deleted file mode 100644 index 66d5af57c..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupServletMappingItemProvider.java +++ /dev/null @@ -1,106 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.core.UrlPatternType; -import org.eclipse.jst.javaee.web.ServletMapping; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * Servlet Mappings group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupServletMappingItemProvider extends AbstractWebGroupProvider{ - - private static Image SERVLETMAPPING; - - public GroupServletMappingItemProvider(WebApp webApp) { - super(webApp); - text = Messages.SERVLET_MAPPING_ITEM_PROVIDER; - } - - @Override - public List getChildren() { - if (javaee != null){ - return flattenMapping(((WebApp) javaee).getServletMappings()); - } - return null; - } - - @Override - public Image getImage() { - return getServletMappingImage(); - } - - @Override - public boolean hasChildren() { - return !getChildren().isEmpty(); - } - - public static Image getServletMappingImage() { - if (SERVLETMAPPING == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.SERVLET_MAPPING); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - SERVLETMAPPING = imageDescriptor.createImage(); - } - return SERVLETMAPPING; - } - - private List<?> flattenMapping(List<ServletMapping> servletMappings) { - List<ServletMappingUIWrapper> result = new ArrayList<ServletMappingUIWrapper>(); - if (servletMappings != null && servletMappings.size() > 0){ - for (ServletMapping filterMapping : servletMappings) { - result.addAll(getServletMappingDisplay(filterMapping)); - } - } - return result; - } - - - private List<ServletMappingUIWrapper> getServletMappingDisplay(ServletMapping element) { - List<ServletMappingUIWrapper> result = new ArrayList<ServletMappingUIWrapper>(); - String value = null; - if (element.getUrlPatterns().size() > 0){ - for (UrlPatternType pattern : element.getUrlPatterns()) { - value = pattern.getValue(); - result.add(new ServletMappingUIWrapper(value + " -> " + element.getServletName())); //$NON-NLS-1$ - } - - } - return result; - } - - public class ServletMappingUIWrapper{ - private String value; - - public String getValue() { - return value; - } - - public ServletMappingUIWrapper(String value) { - super(); - this.value = value; - } - } - - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupWelcomePagesItemProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupWelcomePagesItemProvider.java deleted file mode 100644 index da8bfac7a..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/GroupWelcomePagesItemProvider.java +++ /dev/null @@ -1,95 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.javaee.web.WelcomeFileList; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.swt.graphics.Image; - -/** - * Welcome pages group in Deployment Descriptor node. - * - * @author Dimitar Giormov - * - */ -public class GroupWelcomePagesItemProvider extends AbstractWebGroupProvider{ - - private static Image WELCOME_PAGES; - - private static Image WELCOME_PAGE; - - public GroupWelcomePagesItemProvider(WebApp webApp) { - super(webApp); - text = Messages.WELCOME_PAGES_ITEM_PROVIDER; - } - - @Override - public List getChildren() { -// if (children != null){ -// return children; -// } - children.clear(); - if (javaee != null){ - List welcomeFileLists = ((WebApp) javaee).getWelcomeFileLists(); - if (welcomeFileLists.size()>0){ - children = new ArrayList(); - for (Object object : welcomeFileLists) { - List welcomeFiles = ((WelcomeFileList)object).getWelcomeFiles(); - for (Object object2 : welcomeFiles) { - if(object2 != null && !"".equals( ((String)object2).trim())){ //$NON-NLS-1$ - children.add(new WebArtifactNode((WebApp)javaee, (String) object2, getWelcomePageImage())); - } - } - } - return children; - } - return null; - } - return null; - } - - @Override - public Image getImage() { - return getWelcomePagesImage(); - } - - @Override - public boolean hasChildren() { - List children2 = getChildren(); - return children2 != null && !children2.isEmpty(); - } - - public static Image getWelcomePagesImage() { - if (WELCOME_PAGES == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.GROUP_WELCOME_PAGES); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - WELCOME_PAGES = imageDescriptor.createImage(); - } - return WELCOME_PAGES; - } - - public static Image getWelcomePageImage() { - if (WELCOME_PAGE == null) { - URL url = (URL) J2EEPlugin.getPlugin().getImage(JEEUIPluginIcons.GROUP_WELCOME_PAGE); - ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url); - WELCOME_PAGE = imageDescriptor.createImage(); - } - return WELCOME_PAGE; - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/WebAppProvider.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/WebAppProvider.java deleted file mode 100644 index 72af77526..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/WebAppProvider.java +++ /dev/null @@ -1,147 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008, 2010 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.jee.ui.internal.Messages; -import org.eclipse.jst.jee.ui.internal.navigator.AbstractGroupProvider; -import org.eclipse.jst.jee.ui.plugin.JEEUIPlugin; -import org.eclipse.jst.jee.ui.plugin.JEEUIPluginIcons; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; - -/** - * Content and Label Provider helper class for WebApp element. - * - * @author Dimitar Giormov - * @author Kaloyan Raev - */ -public class WebAppProvider extends AbstractWebGroupProvider implements IAdaptable { - - private static final String PROJECT_RELATIVE_PATH = "WEB-INF/web.xml"; //$NON-NLS-1$ - - private GroupErrorPagesItemProvider errors; - private GroupServletItemProvider servlets; - private GroupFiltersItemProvider filters; - private GroupListenerItemProvider listeners; - private GroupServletMappingItemProvider servletMapping; - private GroupFilterMappingItemProvider filterMapping; - private GroupReferenceItemProvider references; - private GroupWelcomePagesItemProvider welcome; - private GroupContextParamsItemProvider contextParams; - - private List<Object> children = new ArrayList<Object>(); - - private String text; - - private Image web25Image; - private Image web30Image; - - private IProject prjct = null; - private IFile ddFile = null; - - public WebAppProvider(WebApp webApp, IProject project) { - super(webApp); - text = NLS.bind(Messages.DEPLOYMENT_DESCRIPTOR, project.getName()); - contextParams = new GroupContextParamsItemProvider(webApp); - errors = new GroupErrorPagesItemProvider(webApp); - servlets = new GroupServletItemProvider(webApp); - servletMapping = new GroupServletMappingItemProvider(webApp); - filters = new GroupFiltersItemProvider(webApp); - filterMapping = new GroupFilterMappingItemProvider(webApp); - listeners = new GroupListenerItemProvider(webApp); - references = new GroupReferenceItemProvider(webApp); - welcome = new GroupWelcomePagesItemProvider(webApp); - children.add(contextParams); - children.add(errors); - children.add(servlets); - children.add(filters); - children.add(listeners); - children.add(servletMapping); - children.add(filterMapping); - children.add(references); - children.add(welcome); - prjct = project; - } - - @Override - public List getChildren(){ - return children; - } - - @Override - public String getText(){ - return text; - } - - @Override - public Image getImage() { - String version = ((WebApp) javaee).getVersion().getLiteral(); - if (J2EEVersionConstants.VERSION_2_5_TEXT.equals(version)) { - return getWeb25Image(); - } else if (J2EEVersionConstants.VERSION_3_0_TEXT.equals(version)) { - return getWeb30Image(); - } - return getWeb25Image(); - } - - public IProject getProject(){ - return prjct; - } - - public IFile getDDFile() { - if (ddFile != null){ - return ddFile; - } - - IVirtualFolder virtualFolder = ComponentCore.createComponent(getProject()).getRootFolder(); - return virtualFolder.getFile(PROJECT_RELATIVE_PATH).getUnderlyingFile(); - } - - @Override - public void reinit(JavaEEObject modelObject) { - super.reinit(modelObject); - for (Object child : children) { - ((AbstractGroupProvider)child).reinit(modelObject); - } - } - - public Object getAdapter(Class adapter) { - if (IProject.class == adapter){ - return getProject(); - } - return null; - } - - private Image getWeb25Image() { - if (web25Image == null) { - web25Image = JEEUIPlugin.getDefault().getImageDescriptor(JEEUIPluginIcons.IMG_WEBEEMODEL).createImage(); - } - return web25Image; - } - - private Image getWeb30Image() { - if (web30Image == null) { - web30Image = JEEUIPlugin.getDefault().getImageDescriptor(JEEUIPluginIcons.IMG_WEBEE6MODEL).createImage(); - } - return web30Image; - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/WebArtifactNode.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/WebArtifactNode.java deleted file mode 100644 index c95c7790f..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/internal/navigator/web/WebArtifactNode.java +++ /dev/null @@ -1,50 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.internal.navigator.web; - -import org.eclipse.jst.javaee.core.JavaEEObject; -import org.eclipse.swt.graphics.Image; - -/** - * - * Wrapper node for representing string values of the model in Deployment descriptor tree. - * (e.g. Welcome Files) - * - * @author Dimitar Giormov - * - */ -public class WebArtifactNode implements JavaEEObject{ - - private Image image; - private String text; - private JavaEEObject javaee; - - public WebArtifactNode(JavaEEObject javaee, String text, Image image) { - super(); - this.javaee = javaee; - this.text = text; - this.image = image; - } - - - public Image getImage() { - return image; - } - - public String getText() { - return text; - } - - public JavaEEObject getJavaEEObject() { - return javaee; - } - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/plugin/JEEUIPlugin.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/plugin/JEEUIPlugin.java deleted file mode 100644 index 91d30e2f1..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/plugin/JEEUIPlugin.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.plugin; - -import java.net.URL; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class JEEUIPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jst.jee.ui"; //$NON-NLS-1$ - - // The shared instance - private static JEEUIPlugin plugin; - - /** - * The constructor - */ - public JEEUIPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static JEEUIPlugin getDefault() { - return plugin; - } - - /** - * This gets a .gif from the icons folder. - */ - public ImageDescriptor getImageDescriptor(String key) { - ImageDescriptor imageDescriptor = null; - URL gifImageURL = getImageURL(key); - if (gifImageURL != null) - imageDescriptor = ImageDescriptor.createFromURL(gifImageURL); - return imageDescriptor; - } - - /** - * @param key - * @return - */ - private URL getImageURL(String key) { - return J2EEPlugin.getImageURL(key, getBundle()); - } - - /** - * - * Record a message against this plugin's log. - * - * @param severity - * @param aCode - * @param aMessage - * @param exception - */ - public static void log(int severity, int aCode, String aMessage, - Throwable exception) { - log(createStatus(severity, aCode, aMessage, exception)); - } - - /** - * Create a status associated with this plugin. - * - * @param severity - * @param aCode - * @param aMessage - * @param exception - * @return A status configured with this plugin's id and the given parameters. - */ - public static IStatus createStatus(int severity, int aCode, - String aMessage, Throwable exception) { - return new Status(severity, PLUGIN_ID, aCode, - aMessage != null ? aMessage : "No message.", exception); //$NON-NLS-1$ - } - - /** - * - * Record a status against this plugin's log. - * - * @param aStatus - */ - public static void log(IStatus aStatus) { - getDefault().getLog().log(aStatus); - } - - public static void logError(String message, Exception e) { - log(IStatus.ERROR, IStatus.ERROR,message,e); - } - - public static IStatus createStatus(int severity, String message, Throwable exception) { - return new Status(severity, PLUGIN_ID, message, exception); - } - - public static IStatus createStatus(int severity, String message) { - return createStatus(severity, message, null); - } - - public static void logError(Throwable exception) { - Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception)); - } - - public static void logError(CoreException exception) { - Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() ); - } - - public Image getImage(String key){ - return getImageDescriptor(key).createImage(); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/plugin/JEEUIPluginIcons.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/plugin/JEEUIPluginIcons.java deleted file mode 100644 index 40cbac117..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/plugin/JEEUIPluginIcons.java +++ /dev/null @@ -1,46 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2008, 2010 by SAP AG, Walldorf. - * 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: - * SAP AG - initial API and implementation - ***********************************************************************/ -package org.eclipse.jst.jee.ui.plugin; - -public class JEEUIPluginIcons { - - public static String IMG_EJBEEMODEL = "30_ejbjar_obj"; //$NON-NLS-1$ - public static String IMG_EJBEE6MODEL = "31_ejbjar_obj"; //$NON-NLS-1$ - public static String IMG_WEBEEMODEL = "webapp_25"; //$NON-NLS-1$ - public static String IMG_WEBEE6MODEL = "webapp_30"; //$NON-NLS-1$ - public static String IMG_CONNECTOR = "connection"; //$NON-NLS-1$ - public static String IMG_CONFIG_PROP = "config_prop_obj"; //$NON-NLS-1$ - public static String IMG_LICENSE = "license_obj"; //$NON-NLS-1$ - public static String IMG_RESOURCE_ADAPTER = "resource_adapter_obj"; //$NON-NLS-1$ - - public static String SERVLET_MAPPING = "webuiIcons/servlet_mapping"; //$NON-NLS-1$ - public static String FILTER_MAPPING = "webuiIcons/filter"; //$NON-NLS-1$ - public static String GROUP_FILTER_MAPPING = "webuiIcons/filter_mapping"; //$NON-NLS-1$ - public static String GROUP_LISTENER = "webuiIcons/listener"; //$NON-NLS-1$ - public static String GROUP_SERVLET = "webuiIcons/servlet"; //$NON-NLS-1$ - public static String GROUP_ERROR_PAGE = "webuiIcons/error_page"; //$NON-NLS-1$ - public static String GROUP_CONTEXT_PARAM = "webuiIcons/initializ_parameter_context"; //$NON-NLS-1$ - public static String GROUP_WELCOME_PAGES = "webuiIcons/welcome_list"; //$NON-NLS-1$ - public static String GROUP_WELCOME_PAGE = "webuiIcons/welcome_file"; //$NON-NLS-1$ - public static String RESOURCE_REFERENCE_OBJ = "resourceRef_obj"; //$NON-NLS-1$ - - public static String BUSSINESS_LOCAL = "ovr/business_local_ovr"; //$NON-NLS-1$ - public static String BUSSINESS_REMOTE = "ovr/business_remote_ovr"; //$NON-NLS-1$ - public static String REMOTE = "ovr/remote_ovr"; //$NON-NLS-1$ - public static String REMOTE_HOME = "ovr/home_ovr"; //$NON-NLS-1$ - public static String LOCAL = "ovr/local_ovr"; //$NON-NLS-1$ - public static String LOCAL_HOME = "ovr/local_home_ovr"; //$NON-NLS-1$ - public static String EAR_IMAGE = "ear_50"; //$NON-NLS-1$ - public static String EAR6_IMAGE = "ear_60"; //$NON-NLS-1$ - public static String APP_CLIENT50 = "appclient_50"; //$NON-NLS-1$ - public static String APP_CLIENT60 = "appclient_60"; //$NON-NLS-1$ - -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/EarJavaEEFacetInstallPage.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/EarJavaEEFacetInstallPage.java deleted file mode 100644 index a5249bb3f..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/EarJavaEEFacetInstallPage.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.jst.jee.ui.project.facet; - -/*************************************************************************************************** - /*************************************************************************************************** - * Copyright (c) 2007 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 - **************************************************************************************************/ - -/** - * @deprecated - For consistency with other FacetInstallPage classes this class should be removed. Please use {@link org.eclipse.jst.j2ee.ui.project.facet.EarFacetInstallPage} - */ -public class EarJavaEEFacetInstallPage extends - org.eclipse.jst.j2ee.ui.project.facet.EarFacetInstallPage { - - public EarJavaEEFacetInstallPage() { - super(); - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/Messages.java b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/Messages.java deleted file mode 100644 index 61ee08d20..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/Messages.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - *******************************************************************************/ -package org.eclipse.jst.jee.ui.project.facet; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jee.ui.project.facet.messages"; //$NON-NLS-1$ - public static String EarJavaEEFacetInstallPage_0; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/messages.properties b/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/messages.properties deleted file mode 100644 index 2383078bc..000000000 --- a/plugins/org.eclipse.jst.jee.ui/src/org/eclipse/jst/jee/ui/project/facet/messages.properties +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 2007 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 -############################################################################### -EarJavaEEFacetInstallPage_0=Generate Deployment Descriptor |