diff options
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project')
20 files changed, 0 insertions, 1386 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java deleted file mode 100644 index ccca86779..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetProjectCreationDataModelProvider.java +++ /dev/null @@ -1,24 +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.j2ee.project.facet; - -/** - * This class was not intended to be public API. Please use {@link org.eclipse.jst.j2ee.earcreation.IEarFacetInstallDataModelProperties} - * - * @deprecated - * @see org.eclipse.jst.j2ee.internal.project.facet.EARFacetProjectCreationDataModelProvider - */ -public class EARFacetProjectCreationDataModelProvider extends org.eclipse.jst.j2ee.internal.project.facet.EARFacetProjectCreationDataModelProvider { - - public EARFacetProjectCreationDataModelProvider() { - super(); - } -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetUtils.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetUtils.java deleted file mode 100644 index 924a50bed..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EARFacetUtils.java +++ /dev/null @@ -1,26 +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.j2ee.project.facet; - -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -public class EARFacetUtils { - - public static final IProjectFacet EAR_FACET = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE); - public static final IProjectFacetVersion EAR_12 = EAR_FACET.getVersion("1.2"); //$NON-NLS-1$ - public static final IProjectFacetVersion EAR_13 = EAR_FACET.getVersion("1.3"); //$NON-NLS-1$ - public static final IProjectFacetVersion EAR_14 = EAR_FACET.getVersion("1.4"); //$NON-NLS-1$ - - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java deleted file mode 100644 index 8b949531a..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java +++ /dev/null @@ -1,77 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.j2ee.project.facet; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jst.common.project.facet.WtpUtils; -import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil; -import org.eclipse.jst.j2ee.internal.earcreation.IEarFacetInstallDataModelProperties; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public final class EarFacetInstallDelegate implements IDelegate { - - public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException { - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - IDataModel model = (IDataModel) cfg; - - if (monitor != null) { - monitor.worked(1); - } - // Add WTP natures. - - WtpUtils.addNaturestoEAR(project); - - final IVirtualComponent c = ComponentCore.createComponent(project, false); - c.create(0, null); - - final IVirtualFolder earroot = c.getRootFolder(); - earroot.createLink(new Path("/" + model.getStringProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR)), 0, null); //$NON-NLS-1$ - - if (!earroot.getFile(J2EEConstants.APPLICATION_DD_URI).exists()) { - String ver = fv.getVersionString(); - int nVer = J2EEVersionUtil.convertVersionStringToInt(ver); - EARArtifactEdit.createDeploymentDescriptor(project, nVer); - } - - try { - ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null); - } catch (ExecutionException e) { - Logger.getLogger().logError(e); - } - } - - finally { - if (monitor != null) { - monitor.done(); - } - } - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetPostInstallDelegate.java deleted file mode 100644 index fee5cac65..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetPostInstallDelegate.java +++ /dev/null @@ -1,90 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.j2ee.project.facet; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider; -import org.eclipse.jst.j2ee.internal.earcreation.IEarFacetInstallDataModelProperties; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public final class EarFacetPostInstallDelegate implements IDelegate { - - public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException { - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - IDataModel model = (IDataModel) cfg; - - if (monitor != null) { - monitor.worked(1); - } - - final IVirtualComponent c = ComponentCore.createComponent(project); - - Set dependentProjects = new HashSet(); - dependentProjects.addAll((List) model.getProperty(IEarFacetInstallDataModelProperties.J2EE_PROJECTS_LIST)); - dependentProjects.addAll((List) model.getProperty(IEarFacetInstallDataModelProperties.JAVA_PROJECT_LIST)); - if (!dependentProjects.isEmpty()) { - List dependentComponents = new ArrayList(dependentProjects.size()); - for (Iterator iterator = dependentProjects.iterator(); iterator.hasNext();) { - IProject depProject = (IProject) iterator.next(); - IVirtualComponent depComp = ComponentCore.createComponent(depProject); - if (depComp == null) { - JavaProjectMigrationOperation utilOp = J2EEProjectUtilities.createFlexJavaProjectForProjectOperation(depProject); - utilOp.execute(null, null); - depComp = ComponentCore.createComponent(depProject); - } - - dependentComponents.add(depComp); - } - - final IDataModel dataModel = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider()); - dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, c); - List modList = (List) dataModel.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST); - modList.addAll(dependentComponents); - dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modList); - try { - dataModel.getDefaultOperation().execute(null, null); - } catch (ExecutionException e) { - Logger.getLogger().logError(e); - } - } - - } - - finally { - if (monitor != null) { - monitor.done(); - } - } - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetRuntimeHandler.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetRuntimeHandler.java deleted file mode 100644 index 4dd10c7b8..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetRuntimeHandler.java +++ /dev/null @@ -1,214 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2006 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.j2ee.project.facet; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; -import org.eclipse.wst.common.project.facet.core.IDelegate; -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; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; - -/** - * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> - */ - -public final class EarFacetRuntimeHandler -{ - /** - * Private constructor. This class is not meant to be instantiated. - */ - - private EarFacetRuntimeHandler() {} - - public static void updateModuleProjectRuntime( final IProject earProject, - final IProject moduleProject, - final IProgressMonitor monitor ) - - throws CoreException - - { - if( monitor != null ) - { - monitor.beginTask( "", 1 ); - } - - try - { - final IFacetedProject earFacetedProject - = ProjectFacetsManager.create( earProject ); - - final IRuntime earRuntime = earFacetedProject.getRuntime(); - - final IFacetedProject moduleFacetedProject - = ProjectFacetsManager.create( moduleProject ); - - if( moduleFacetedProject != null && - ! equals( earRuntime, moduleFacetedProject.getRuntime() ) ) - { - boolean supports = true; - - if( earRuntime != null ) - { - for( Iterator itr = moduleFacetedProject.getProjectFacets().iterator(); - itr.hasNext(); ) - { - final IProjectFacetVersion fver - = (IProjectFacetVersion) itr.next(); - - if( ! earRuntime.supports( fver ) ) - { - supports = false; - break; - } - } - } - - if( supports ) - { - moduleFacetedProject.setRuntime( earRuntime, submon( monitor, 1 ) ); - } - } - } - finally - { - if( monitor != null ) - { - monitor.done(); - } - } - } - - public static void updateModuleProjectRuntime( final IProject earProject, - final Set moduleProjects, - final IProgressMonitor monitor ) - - throws CoreException - - { - if( monitor != null ) - { - monitor.beginTask( "", moduleProjects.size() ); - } - - try - { - for( Iterator itr = moduleProjects.iterator(); itr.hasNext(); ) - { - final IProject moduleProject = (IProject) itr.next(); - - updateModuleProjectRuntime( earProject, moduleProject, - submon( monitor, 1 ) ); - } - } - finally - { - if( monitor != null ) - { - monitor.done(); - } - } - } - - public static final class RuntimeChangedDelegate - - implements IDelegate - - { - public void execute( final IProject project, - final IProjectFacetVersion fv, - final Object cfg, - final IProgressMonitor monitor ) - - throws CoreException - - { - if( monitor != null ) - { - monitor.beginTask( "", 10 ); //$NON-NLS-1$ - } - - try - { - // Compile the list of projects referenced by this ear project. - - final Set moduleProjects = new HashSet(); - - final IVirtualComponent earvc - = ComponentCore.createComponent( project ); - - final IVirtualReference[] vrefs = earvc.getReferences(); - - for( int i = 0; i < vrefs.length; i++ ) - { - final IVirtualReference vref = vrefs[ i ]; - final IVirtualComponent vc = vref.getReferencedComponent(); - - moduleProjects.add( vc.getProject() ); - } - - if( monitor != null ) - { - monitor.worked( 1 ); - } - - // Attempt to change the runtime for each of the referenced projects. - - updateModuleProjectRuntime( project, moduleProjects, - submon( monitor, 9 ) ); - } - finally - { - if( monitor != null ) - { - monitor.done(); - } - } - } - } - - private static IProgressMonitor submon( final IProgressMonitor parent, - final int ticks ) - { - return ( parent == null ? null : new SubProgressMonitor( parent, ticks ) ); - } - - private static boolean equals( final Object obj1, - final Object obj2 ) - { - if( obj1 == obj2 ) - { - return true; - } - else if( obj1 == null || obj2 == null ) - { - return false; - } - else - { - return obj1.equals( obj2 ); - } - } - - - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.java deleted file mode 100644 index 024ec3e3d..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.java +++ /dev/null @@ -1,138 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.j2ee.project.facet; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.componentcore.ComponentCore; -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.IFacetedProjectValidator; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; - -/** - * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> - */ - -public final class EarFacetValidator - - implements IFacetedProjectValidator - -{ - private static final String MARKER_ID - = J2EEPlugin.PLUGIN_ID + ".differentRuntimesDetected"; - - public void validate( final IFacetedProject fproj ) - - throws CoreException - - { - final IVirtualComponent vc - = ComponentCore.createComponent( fproj.getProject() ); - - if( vc == null ) - { - return; - } - - if( fproj.hasProjectFacet( EARFacetUtils.EAR_FACET ) ) - { - fproj.getProject().deleteMarkers( MARKER_ID, false, - IResource.DEPTH_ZERO ); - - final IVirtualReference[] refs = vc.getReferences(); - - for( int i = 0; i < refs.length; i++ ) - { - final IVirtualReference ref = refs[ i ]; - final IVirtualComponent refvc = ref.getReferencedComponent(); - - if( refvc != null && !refvc.isBinary()) - { - final IProject refpj = refvc.getProject(); - validate( fproj, ProjectFacetsManager.create( refpj ) ); - } - } - } - else - { - final IVirtualComponent[] referencing - = vc.getReferencingComponents(); - - for( int i = 0; i < referencing.length; i++ ) - { - final IVirtualComponent refvc = referencing[ i ]; - - final IFacetedProject reffpj - = ProjectFacetsManager.create( refvc.getProject() ); - - if( reffpj.hasProjectFacet( EARFacetUtils.EAR_FACET ) ) - { - validate( reffpj ); - } - } - } - } - - private void validate( final IFacetedProject ear, - final IFacetedProject module ) - - throws CoreException - - { - final IRuntime earRuntime = ear.getRuntime(); - final IRuntime moduleRuntime = module.getRuntime(); - - if( earRuntime == null && moduleRuntime != null ) - { - // Should this also be a warning? - } - else if( earRuntime != null && moduleRuntime == null ) - { - // Should this also be a warning? - } - else if( earRuntime != null && moduleRuntime != null && - ! earRuntime.equals( moduleRuntime ) ) - { - final String msg - = NLS.bind( Resources.targetingDifferentRuntimes, - module.getProject().getName() ); - - final IMarker m = ear.createWarningMarker( MARKER_ID, msg ); - - m.setAttribute( "moduleProject", module.getProject().getName() ); - m.setAttribute( "runtime1", ear.getRuntime().getName() ); - m.setAttribute( "runtime2", module.getRuntime().getName() ); - } - } - - private static final class Resources - - extends NLS - - { - public static String targetingDifferentRuntimes; - - static - { - initializeMessages( EarFacetValidator.class.getName(), - Resources.class ); - } - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.properties b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.properties deleted file mode 100644 index edb3d0d3d..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetValidator.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 -############################################################################### -targetingDifferentRuntimes = Referenced module project {0} is targeting a different runtime. diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetVersionChangeDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetVersionChangeDelegate.java deleted file mode 100644 index e121e6b05..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetVersionChangeDelegate.java +++ /dev/null @@ -1,92 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.j2ee.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -/** - * Warning clean-up 12/05/2005 - */ -//import org.eclipse.wst.common.componentcore.ComponentCore; -//import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> - */ - -public final class EarFacetVersionChangeDelegate - - implements IDelegate - -{ - public void execute( final IProject project, - final IProjectFacetVersion fv, - final Object cfg, - final IProgressMonitor monitor ) - - throws CoreException - - { - if( monitor != null ) - { - monitor.beginTask( "", 1 ); - } - - try - { - /** - * Warning clean-up 12/05/2005 - */ - //final IVirtualComponent c = ComponentCore.createComponent(project); - -// final StructureEdit edit -// = StructureEdit.getStructureEditForWrite( project ); -// -// try -// { -// final ComponentType oldctype -// = StructureEdit.getComponentType( c ); -// -// final ComponentType newctype -// = ComponentcoreFactory.eINSTANCE.createComponentType(); -// -// newctype.setComponentTypeId( oldctype.getComponentTypeId() ); -// newctype.setVersion( fv.getVersionString() ); -// newctype.getProperties().addAll( oldctype.getProperties() ); -// -// StructureEdit.setComponentType( c, newctype ); -// -// edit.saveIfNecessary( null ); -// } -// finally -// { -// edit.dispose(); -// } - - if( monitor != null ) - { - monitor.worked( 1 ); - } - } - finally - { - if( monitor != null ) - { - monitor.done(); - } - } - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java deleted file mode 100644 index 34bd30d3c..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaProjectMigrationDataModelProperties.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.project.facet; - - -public interface IJavaProjectMigrationDataModelProperties { - - /** - * Required - */ - public static final String PROJECT_NAME = "IJavaProjectMigrationDataModelProperties.PROJECT_NAME"; //$NON-NLS-1$ - - /** - * Optional - */ - public static final String ADD_TO_EAR = "IJavaProjectMigrationDataModelProperties.ADD_TO_EAR"; //$NON-NLS-1$ - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java deleted file mode 100644 index 73344f2ee..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IJavaUtilityProjectCreationDataModelProperties.java +++ /dev/null @@ -1,30 +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.j2ee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties; - -public interface IJavaUtilityProjectCreationDataModelProperties extends IDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = JavaUtilityProjectCreationDataModelProvider.class; - - public static final String PROJECT_NAME = "IJavaUtilityProjectCreationDataModelProperties.PROJECT_NAME"; //$NON-NLS-1$ - -// public static final String PROJECT_LOCATION = "IJavaUtilityProjectCreationDataModelProperties.PROJECT_LOCATION"; //$NON-NLS-1$ - - public static final String EAR_PROJECT_NAME = "IJavaUtilityProjectCreationDataModelProperties.EAR_PROJECT_NAME"; //$NON-NLS-1$ - - public static final String RUNTIME = "IJavaUtilityProjectCreationDataModelProperties.RUNTIME"; //$NON-NLS-1$ - - public static final String SOURCE_FOLDER = "IJavaUtilityProjectCreationDataModelProperties.SOURCE_FOLDER"; //$NON-NLS-1$ -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java deleted file mode 100644 index 2f1520755..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java +++ /dev/null @@ -1,19 +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.j2ee.project.facet; - -public interface IUtilityFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties { - - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = org.eclipse.jst.j2ee.internal.project.facet.UtilityFacetInstallDataModelProvider.class; -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java deleted file mode 100644 index a60d0cc99..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationDataModelProvider.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.project.facet; - -import java.util.Set; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -/** - * This dataModel is a common super class used for creation of WTP Components. - * - * This class (and all its fields and methods) is likely to change during the WTP 1.0 milestones as - * the new project structures are adopted. Use at your own risk. - * - * @plannedfor WTP 1.0 - */ -public class JavaProjectMigrationDataModelProvider extends AbstractDataModelProvider implements IJavaProjectMigrationDataModelProperties { - - public void init() { - super.init(); - } - - public Set getPropertyNames() { - Set propertyNames = super.getPropertyNames(); - propertyNames.add(PROJECT_NAME); - propertyNames.add(ADD_TO_EAR); - return propertyNames; - } - - public void propertyChanged(DataModelEvent event) { - if (event.getFlag() == DataModelEvent.VALUE_CHG) { - event.getDataModel(); - } - } - - public boolean propertySet(String propertyName, Object propertyValue) { - return true; - } - - public Object getDefaultProperty(String propertyName) { - return super.getDefaultProperty(propertyName); - } - - public IStatus validate(String propertyName) { - - return OK_STATUS; - } - - public IDataModelOperation getDefaultOperation() { - return new JavaProjectMigrationOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java deleted file mode 100644 index e6fcb8d08..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java +++ /dev/null @@ -1,99 +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.j2ee.project.facet; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jem.workbench.utility.JemProjectUtilities; -import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider; -import org.eclipse.jst.common.project.facet.JavaFacetUtils; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - - -public class JavaProjectMigrationOperation extends AbstractDataModelOperation implements IJavaProjectMigrationDataModelProperties { - - - - public JavaProjectMigrationOperation(IDataModel model) { - super(model); - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) { - - - - IDataModel jdm = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider()); - - jdm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(PROJECT_NAME)); - - jdm.setProperty(IFacetDataModelProperties.FACET_VERSION, getJavaFacetVersion() ); - - IDataModel udm = DataModelFactory.createDataModel(new UtilityFacetInstallDataModelProvider()); - try { - if(model.isPropertySet(ADD_TO_EAR)){ - udm.setProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, model.getProperty(ADD_TO_EAR)); - } - udm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(PROJECT_NAME)); - udm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, "1.0"); //$NON-NLS-1$ - udm.setProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI, - model.getStringProperty(PROJECT_NAME) + ".jar"); //$NON-NLS-1$ - // we do not want to add to ear by default - udm.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, false); - } catch (Exception e) { - Logger.getLogger().logError(e); - } - - IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider()); - dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(PROJECT_NAME)); - - FacetDataModelMap map = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP); - map.add(jdm); - map.add(udm); - - try { - dm.getDefaultOperation().execute(monitor, null); - } catch (ExecutionException e) { - Logger.getLogger().logError(e); - } - return OK_STATUS; - } - - private IProjectFacetVersion getJavaFacetVersion(){ - - IProject project = J2EEProjectUtilities.getProject( model.getStringProperty(PROJECT_NAME) ); - IJavaProject jProj = JemProjectUtilities.getJavaProject( project ); - String jdtVersion = jProj.getOption(JavaCore.COMPILER_COMPLIANCE, true ); - - if (jdtVersion.startsWith("1.3")) { //$NON-NLS-1$ - return JavaFacetUtils.JAVA_13; - } else if (jdtVersion.startsWith("1.4")) { //$NON-NLS-1$ - return JavaFacetUtils.JAVA_14; - }else if (jdtVersion.startsWith("1.5")) { //$NON-NLS-1$ - return JavaFacetUtils.JAVA_50; - } - return JavaFacetUtils.JAVA_60; - } -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationDataModelProvider.java deleted file mode 100644 index ba73143ba..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationDataModelProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.project.facet; - - -import java.util.Set; - -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - - - -public class JavaUtilityProjectCreationDataModelProvider - extends AbstractDataModelProvider implements IJavaUtilityProjectCreationDataModelProperties{ - - public JavaUtilityProjectCreationDataModelProvider() { - super(); - } - - public Set getPropertyNames() { - Set propertyNames = super.getPropertyNames(); - propertyNames.add(PROJECT_NAME); - //propertyNames.add(PROJECT_LOCATION); - propertyNames.add(EAR_PROJECT_NAME); - propertyNames.add(RUNTIME); - propertyNames.add(SOURCE_FOLDER); - return propertyNames; - } - - - public IDataModelOperation getDefaultOperation() { - return new JavaUtilityProjectCreationOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationOperation.java deleted file mode 100644 index a7baf7597..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaUtilityProjectCreationOperation.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.project.facet; - - - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap; -import org.eclipse.wst.common.componentcore.internal.operation.FacetProjectCreationOperation; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; - -public class JavaUtilityProjectCreationOperation extends AbstractDataModelOperation implements IJavaUtilityProjectCreationDataModelProperties{ - - - - public JavaUtilityProjectCreationOperation(IDataModel model) { - super(model); - } - - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - IStatus stat = OK_STATUS; - - String projectName = model.getStringProperty( IJavaUtilityProjectCreationDataModelProperties.PROJECT_NAME ); - String earProjectName = model.getStringProperty( IJavaUtilityProjectCreationDataModelProperties.EAR_PROJECT_NAME );; - String javaSourceFolder = model.getStringProperty( IJavaUtilityProjectCreationDataModelProperties.SOURCE_FOLDER ); - - org.eclipse.wst.common.project.facet.core.runtime.IRuntime runtime = (IRuntime) model.getProperty(IJavaUtilityProjectCreationDataModelProperties.RUNTIME); - - IDataModel dm = DataModelFactory.createDataModel(new UtilityProjectCreationDataModelProvider()); - - - //IDataModel pdm = dm.getNestedModel( IFacetProjectCreationDataModelProperties.NESTED_PROJECT_DM ); - //pdm.setStringProperty( IProjectCreationPropertiesNew.PROJECT_LOCATION, model.getStringProperty( IJavaUtilityProjectCreationDataModelProperties.PROJECT_LOCATION ) ); - - FacetDataModelMap map = (FacetDataModelMap) dm.getProperty(UtilityProjectCreationDataModelProvider.FACET_DM_MAP); - - IDataModel javadm = map.getFacetDataModel( IModuleConstants.JST_JAVA ); - IDataModel utildm = map.getFacetDataModel( J2EEProjectUtilities.UTILITY ); - - - javadm.setProperty( JavaFacetInstallDataModelProvider.FACET_PROJECT_NAME, - projectName); - - - javadm.setProperty( JavaFacetInstallDataModelProvider.SOURCE_FOLDER_NAME, - javaSourceFolder); - - - utildm.setProperty( IUtilityFacetInstallDataModelProperties.EAR_PROJECT_NAME, earProjectName); - - utildm.setProperty( IUtilityFacetInstallDataModelProperties.FACET_RUNTIME, runtime ); - dm.setProperty(UtilityProjectCreationDataModelProvider.FACET_RUNTIME, runtime); - - FacetProjectCreationOperation op = new FacetProjectCreationOperation(dm); - try { - stat = op.execute( monitor, null ); - } catch (ExecutionException e) { - Logger.getLogger().logError(e); - } - return stat; - } - -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java deleted file mode 100644 index 05b5c5c84..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.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.j2ee.project.facet; - -/** - * This class was not intended to be public API. Please use {@link org.eclipse.jst.j2ee.project.facet.IUtilityFacetInstallDataModelProperties} - * - * @deprecated - * @see org.eclipse.jst.j2ee.internal.project.facet.UtilityFacetInstallDataModelProvider - */ - -public class UtilityFacetInstallDataModelProvider extends org.eclipse.jst.j2ee.internal.project.facet.UtilityFacetInstallDataModelProvider { - public UtilityFacetInstallDataModelProvider() - { - super(); - } -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java deleted file mode 100644 index 8b839c695..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDelegate.java +++ /dev/null @@ -1,128 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.j2ee.project.facet; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jst.common.project.facet.WtpUtils; -import org.eclipse.jst.common.project.facet.core.ClasspathHelper; -import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer; -import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainerUtils; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public final class UtilityFacetInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate { - - public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException { - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - - final IDataModel model = (IDataModel) cfg; - - // Add WTP natures. - - WtpUtils.addNatures(project); - - // Setup the flexible project structure. - - final IVirtualComponent c = ComponentCore.createComponent(project, false); - - c.create(0, null); - - final IVirtualFolder jsrc = c.getRootFolder(); - final IJavaProject jproj = JavaCore.create(project); - - final IClasspathEntry[] cp = jproj.getRawClasspath(); - - for (int i = 0; i < cp.length; i++) { - final IClasspathEntry cpe = cp[i]; - - if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) { - IPath path = cpe.getPath().removeFirstSegments(1); - if (path.isEmpty()) { - path = new Path("/"); //$NON-NLS-1$ - } - jsrc.createLink(path, 0, null); - } - } - -// final IWorkspace ws = ResourcesPlugin.getWorkspace(); - - final IVirtualFolder root = c.getRootFolder(); - - IContainer container = null; - - if (root.getProjectRelativePath().segmentCount() == 0) { - container = project; - } else { - container = project.getFolder(root.getProjectRelativePath()); - } - - try { - if (container != null) - createManifest(project, container, monitor); - } catch (InvocationTargetException e) { - Logger.getLogger().logError(e); - } catch (InterruptedException e) { - Logger.getLogger().logError(e); - } - - - ClasspathHelper.removeClasspathEntries(project, fv); - - if (!ClasspathHelper.addClasspathEntries(project, fv)) { - // TODO: Support the no runtime case. - // ClasspathHelper.addClasspathEntries( project, fv, <something> ); - } - - if(J2EEComponentClasspathContainerUtils.getDefaultUseEARLibraries()){ - final IPath earLibContainer = new Path(J2EEComponentClasspathContainer.CONTAINER_ID); - addToClasspath(jproj, JavaCore.newContainerEntry(earLibContainer)); - } - - try { - ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null); - } catch (ExecutionException e) { - Logger.getLogger().logError(e); - } - if (monitor != null) { - monitor.worked(1); - } - } catch (Exception e) { - Logger.getLogger().logError(e); - } finally { - if (monitor != null) { - monitor.done(); - } - } - } -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetPostInstallDelegate.java deleted file mode 100644 index 8145285ea..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetPostInstallDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.j2ee.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; - -public final class UtilityFacetPostInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate { - - public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException { - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try { - - final IDataModel model = (IDataModel) cfg; - - // Associate with an EAR, if necessary. - if (model.getBooleanProperty(IUtilityFacetInstallDataModelProperties.ADD_TO_EAR)) { - final String earProjectName = model.getStringProperty(IUtilityFacetInstallDataModelProperties.EAR_PROJECT_NAME); - if (earProjectName != null && earProjectName != "") //$NON-NLS-1$ - { - final String moduleURI = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI); - - installAndAddModuletoEAR( null, - earProjectName, - (IRuntime) model.getProperty(IJ2EEFacetInstallDataModelProperties.FACET_RUNTIME), - project, - moduleURI, - monitor ); - } - } - } catch (Exception e) { - Logger.getLogger().logError(e); - } finally { - if (monitor != null) { - monitor.done(); - } - } - } -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetUnInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetUnInstallDelegate.java deleted file mode 100644 index a5f3eadca..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetUnInstallDelegate.java +++ /dev/null @@ -1,72 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2005 BEA Systems, Inc. - * 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: - * Konstantin Komissarchik - initial API and implementation - ******************************************************************************/ - -package org.eclipse.jst.j2ee.project.facet; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.common.project.facet.WtpUtils; -import org.eclipse.jst.common.project.facet.core.ClasspathHelper; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.internal.StructureEdit; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public final class UtilityFacetUnInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate { - - public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException { - if (monitor != null) { - monitor.beginTask("", 1); //$NON-NLS-1$ - } - - try{ - //remove .component file - IFile file = project.getFile( StructureEdit.MODULE_META_FILE_NAME ); - file.delete( true, monitor ); - - //remove manifest file - final IVirtualComponent c = ComponentCore.createComponent(project); - final IVirtualFolder root = c.getRootFolder(); - IContainer container = null; - - if (root.getProjectRelativePath().segmentCount() == 0) { - container = project; - } else { - container = project.getFolder(root.getProjectRelativePath()); - } - - IFile manifestFile = container.getFile(new Path(J2EEConstants.MANIFEST_URI)); - manifestFile.delete( true, monitor ); - - IFolder manifestFolder = container.getFolder( new Path(J2EEConstants.META_INF) ); - manifestFolder.delete( true, monitor ); - - //remove module core nature - WtpUtils.removeNatures( project ); - - //remove server class path container - ClasspathHelper.removeClasspathEntries( project, fv ); - - }finally { - if (monitor != null) { - monitor.done(); - } - } - } -} diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java deleted file mode 100644 index 6de9a4d2b..000000000 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java +++ /dev/null @@ -1,68 +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.j2ee.project.facet; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties; -import org.eclipse.jst.common.project.facet.JavaFacetUtils; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.project.facet.ProductManager; - -public class UtilityProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider { - - public UtilityProjectCreationDataModelProvider() { - super(); - } - - public void init() { - super.init(); - - Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>(); - requiredFacets.add(JavaFacetUtils.JAVA_FACET); - requiredFacets.add(IJ2EEFacetConstants.UTILITY_FACET); - setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets); - - FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP); - IDataModel javaFacet = map.getFacetDataModel(JavaFacetUtils.JAVA_FACET.getId()); - // If applicable, keep project structure optimized by making output directory the same as the content root - if (ProductManager.shouldUseSingleRootStructure()) - javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, javaFacet.getStringProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME)); - IDataModel utilFacet = map.getFacetDataModel(IJ2EEFacetConstants.UTILITY_FACET.getId()); - utilFacet.addListener(new IDataModelListener() { - public void propertyChanged(DataModelEvent event) { - if (IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME.equals(event.getPropertyName())) { - if (isPropertySet(EAR_PROJECT_NAME)) - setProperty(EAR_PROJECT_NAME, event.getProperty()); - else - model.notifyPropertyChange(EAR_PROJECT_NAME, IDataModel.DEFAULT_CHG); - }else if (IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR.equals(event.getPropertyName())) { - setProperty(ADD_TO_EAR, event.getProperty()); - } - } - }); - - } - - public boolean propertySet(String propertyName, Object propertyValue) { - if( propertyName.equals( MODULE_URI )){ - FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP); - IDataModel utilFacet = map.getFacetDataModel( J2EEProjectUtilities.UTILITY ); - utilFacet.setProperty( IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI, propertyValue ); - } - return super.propertySet(propertyName, propertyValue); - } -} |