Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst')
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java90
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationDataModelProvider.java326
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationFacetOperation.java83
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java86
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java51
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java126
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java106
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java95
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java110
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java61
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.java112
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.properties2
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainerInitializer.java37
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java66
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java63
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java34
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java29
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java33
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java994
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java133
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java94
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java581
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java99
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java19
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java42
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java51
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/WebArtifactEdit.java651
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/package.xml19
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentCreationDataModelProperties.java54
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentExportDataModelProperties.java37
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentImportDataModelProperties.java58
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/package.xml19
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java24
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java111
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java198
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetPostInstallDelegate.java70
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetRuntimeChangedDelegate.java67
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetUtils.java25
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetVersionChangeDelegate.java110
39 files changed, 0 insertions, 4966 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java
deleted file mode 100644
index 34c047791..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java
+++ /dev/null
@@ -1,90 +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.internal.web.archive.operations;
-
-
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-
-
-public class WTProjectStrategyUtils {
- public static File findSourceFile(Archive archive, String file) {
- if (isClassFile(file))
- return findSourceFileForClass(archive, file);
-
- // Look in the CLASSES directory
- try {
- if (!isOutputFile(file))
- return archive.getFile(file);
- } catch (java.io.FileNotFoundException ex) {
- //Do nothing
- }
- return null;
- }
-
- public static File findSourceFileForClass(Archive archive, String classFile) {
- // Look in the CLASSES directory
- IPath classFilePath = new Path(classFile);
- IPath sourceFilePath = classFilePath.removeFileExtension().addFileExtension("java");//$NON-NLS-1$
- try {
- File file = archive.getFile(sourceFilePath.toString());
- if (file != null)
- return file;
- } catch (java.io.FileNotFoundException ex) {
- //Do nothing
- }
-
- // Look in the LIB directory
- sourceFilePath = new Path(ArchiveConstants.WEBAPP_LIB_URI).append(sourceFilePath);
- try {
- File file = archive.getFile(sourceFilePath.toString());
- if (file != null)
- return file;
- } catch (java.io.FileNotFoundException ex) {
- //Do nothing
- }
- return null;
-
- }
-
- public static boolean isClassFile(String uri) {
- return uri.startsWith(ArchiveConstants.WEBAPP_CLASSES_URI) && uri.endsWith(".class");//$NON-NLS-1$
- }
-
- public static boolean isOutputFile(String uri) {
- return uri.startsWith(ArchiveConstants.WEBAPP_CLASSES_URI);
- }
-
- public static boolean isSourceFile(String uri) {
- // A file is considered a java source file if it is in the
- // WEB_INF directory and it does not end with .class.
- if (uri.startsWith(J2EEConstants.WEB_INF + "/") && //$NON-NLS-1$
- uri.endsWith(".java"))//$NON-NLS-1$
- return true;
- return false;
-
- }
-
- public static String makeRelative(String pathString, String relToPathString) {
- IPath relToPath = new Path(relToPathString);
- IPath path = new Path(pathString);
-
- if (path.matchingFirstSegments(relToPath) == relToPath.segmentCount())
- path = path.removeFirstSegments(relToPath.segmentCount());
-
- return path.toString();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationDataModelProvider.java
deleted file mode 100644
index 35e3a9c4b..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,326 +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.internal.web.archive.operations;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
-import org.eclipse.jst.j2ee.application.internal.operations.AddWebComponentToEARDataModelProvider;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModelProvider;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
-import org.eclipse.jst.j2ee.datamodel.properties.IAddWebComponentToEnterpriseApplicationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.CreationConstants;
-import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * @deprecated
- * @see WebFacetProjectCreationDataModelProvider
- */
-
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- */
-public class WebComponentCreationDataModelProvider extends J2EEComponentCreationDataModelProvider implements IWebComponentCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15 {
-
- public WebComponentCreationDataModelProvider() {
- super();
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new WebComponentCreationFacetOperation(model);
- //return new WebComponentCreationOperation(model);
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(USE_ANNOTATIONS);
- propertyNames.add(CONTEXT_ROOT);
- propertyNames.add(WEBCONTENT_FOLDER);
- return propertyNames;
- }
-
- /**
- * @return Returns the default J2EE spec level based on the Global J2EE Preference
- */
- protected Integer getDefaultComponentVersion() {
- int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID();
- switch (highestJ2EEPref) {
- case (J2EEVersionConstants.J2EE_1_4_ID) :
- return new Integer(J2EEVersionConstants.WEB_2_4_ID);
- case (J2EEVersionConstants.J2EE_1_3_ID) :
- return new Integer(J2EEVersionConstants.WEB_2_3_ID);
- case (J2EEVersionConstants.J2EE_1_2_ID) :
- return new Integer(J2EEVersionConstants.WEB_2_2_ID);
- default :
- return new Integer(J2EEVersionConstants.WEB_2_4_ID);
- }
- }
-
- public AddComponentToEnterpriseApplicationDataModelProvider createAddComponentToEAR() {
- return new AddWebComponentToEARDataModelProvider();
- }
-
- public void init() {
- super.init();
- // setJ2EENatureID(IWebNatureConstants.J2EE_NATURE_ID);
- // setProperty(EDIT_MODEL_ID, IWebNatureConstants.EDIT_MODEL_ID);
- // getProjectDataModel().setProperty(ProjectCreationDataModel.PROJECT_NATURES, new
- // String[]{IModuleConstants.MODULE_NATURE_ID});
- // getJavaProjectCreationDataModel().setProperty(JavaProjectCreationDataModel.SOURCE_FOLDERS,
- // new String[]{getDefaultJavaSourceFolderName()});
-
- updateOutputLocation();
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean retVal = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(USE_ANNOTATIONS)) {
- model.notifyPropertyChange(COMPONENT_VERSION, DataModelEvent.ENABLE_CHG);
- } else if (propertyName.equals(CONTEXT_ROOT)) {
- getAddComponentToEARDataModel().setProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, propertyValue);
- } else if (propertyName.equals(COMPONENT_NAME)) {
- if (!isPropertySet(CONTEXT_ROOT)) {
- model.notifyPropertyChange(CONTEXT_ROOT, DataModelEvent.VALUE_CHG);
- getAddComponentToEARDataModel().setProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, propertyValue);
- getAddComponentToEARDataModel().notifyPropertyChange(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, IDataModel.DEFAULT_CHG);
- }
- } else if (propertyName.equals(WEBCONTENT_FOLDER)) {
- model.setProperty(DD_FOLDER, "/" + propertyValue + IPath.SEPARATOR + J2EEConstants.WEB_INF); //$NON-NLS-1$
- model.setProperty(MANIFEST_FOLDER, "/" + propertyValue + IPath.SEPARATOR + J2EEConstants.META_INF); //$NON-NLS-1$
-
- }
- return retVal;
- }
-
- private void updateOutputLocation() {
- // getJavaProjectCreationDataModel().setProperty(JavaProjectCreationDataModel.OUTPUT_LOCATION,
- // getOutputLocation());
- }
-
- // private Object getOutputLocation() {
- // StringBuffer buf = new StringBuffer(getStringProperty(WEB_CONTENT));
- // buf.append(IPath.SEPARATOR);
- // buf.append(IWebNatureConstants.INFO_DIRECTORY);
- // buf.append(IPath.SEPARATOR);
- // buf.append(IWebNatureConstants.CLASSES_DIRECTORY);
- // return buf.toString();
- // }
-
-
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(ADD_TO_EAR)) {
- if (isEARSupported())
- setProperty(ADD_TO_EAR, Boolean.TRUE);
- }
- // if (propertyName.equals(WEB_CONTENT)) {
- // String webContentFolderPref =
- // J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName();
- // if (webContentFolderPref == null || webContentFolderPref.length() == 0)
- // webContentFolderPref = IWebNatureConstants.WEB_MODULE_DIRECTORY_;
- // return webContentFolderPref;
- // }
- if (propertyName.equals(CONTEXT_ROOT)) {
- return getProperty(COMPONENT_NAME);
- }
- // To do: after porting
- // if (propertyName.equals(SERVLET_VERSION)) {
- // int moduleVersion = getIntProperty(COMPONENT_VERSION);
- // int servletVersion = J2EEVersionConstants.SERVLET_2_2;
- // switch (moduleVersion) {
- // case J2EEVersionConstants.WEB_2_2_ID :
- // servletVersion = J2EEVersionConstants.SERVLET_2_2;
- // break;
- // case J2EEVersionConstants.WEB_2_3_ID :
- // case J2EEVersionConstants.WEB_2_4_ID :
- // servletVersion = J2EEVersionConstants.SERVLET_2_3;
- // break;
- // }
- // return new Integer(servletVersion);
- // }
- // if (propertyName.equals(JSP_VERSION)) {
- // int moduleVersion = getIntProperty(COMPONENT_VERSION);
- // int jspVersion = J2EEVersionConstants.JSP_1_2_ID;
- // switch (moduleVersion) {
- // case J2EEVersionConstants.WEB_2_2_ID :
- // jspVersion = J2EEVersionConstants.JSP_1_2_ID;
- // break;
- // case J2EEVersionConstants.WEB_2_3_ID :
- // case J2EEVersionConstants.WEB_2_4_ID :
- // jspVersion = J2EEVersionConstants.JSP_2_0_ID;
- // break;
- // }
- // return new Integer(jspVersion);
- // }
- if (propertyName.equals(DD_FOLDER)) {
- return IPath.SEPARATOR + WebArtifactEdit.WEB_CONTENT + IPath.SEPARATOR + J2EEConstants.WEB_INF;
- }
- if (propertyName.equals(JAVASOURCE_FOLDER)) {
- return CreationConstants.DEFAULT_WEB_SOURCE_FOLDER;
- }
- if (propertyName.equals(MANIFEST_FOLDER)) {
- return IPath.SEPARATOR + WebArtifactEdit.WEB_CONTENT + IPath.SEPARATOR + J2EEConstants.META_INF;
- } else if (propertyName.equals(WEBCONTENT_FOLDER)) {
- return WebArtifactEdit.WEB_CONTENT;
-
- } else if (propertyName.equals(MODULE_URI)) {
- return getProject().getName()+IJ2EEModuleConstants.WAR_EXT;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (propertyName.equals(COMPONENT_VERSION)) {
- Integer propertyValue = (Integer) getProperty(propertyName);
- String description = null;
- switch (propertyValue.intValue()) {
- case J2EEVersionConstants.WEB_2_2_ID :
- description = J2EEVersionConstants.VERSION_2_2_TEXT;
- break;
- case J2EEVersionConstants.WEB_2_3_ID :
- description = J2EEVersionConstants.VERSION_2_3_TEXT;
- break;
- case J2EEVersionConstants.WEB_2_4_ID :
- default :
- description = J2EEVersionConstants.VERSION_2_4_TEXT;
- break;
- }
- return new DataModelPropertyDescriptor(propertyValue, description);
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
- protected DataModelPropertyDescriptor[] getValidComponentVersionDescriptors() {
- int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID();
- DataModelPropertyDescriptor[] descriptors = null;
- switch (highestJ2EEPref) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- descriptors = new DataModelPropertyDescriptor[1];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT);
- break;
- case J2EEVersionConstants.J2EE_1_3_ID :
- descriptors = new DataModelPropertyDescriptor[2];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT);
- descriptors[1] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_3_ID), J2EEVersionConstants.VERSION_2_3_TEXT);
- break;
- case J2EEVersionConstants.J2EE_1_4_ID :
- default :
- descriptors = new DataModelPropertyDescriptor[3];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT);
- descriptors[1] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_3_ID), J2EEVersionConstants.VERSION_2_3_TEXT);
- descriptors[2] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_4_ID), J2EEVersionConstants.VERSION_2_4_TEXT);
- break;
- }
- return descriptors;
- }
-
- protected int convertModuleVersionToJ2EEVersion(int moduleVersion) {
- switch (moduleVersion) {
- case J2EEVersionConstants.WEB_2_2_ID :
- return J2EEVersionConstants.J2EE_1_2_ID;
- case J2EEVersionConstants.WEB_2_3_ID :
- return J2EEVersionConstants.J2EE_1_3_ID;
- case J2EEVersionConstants.WEB_2_4_ID :
- return J2EEVersionConstants.J2EE_1_4_ID;
- }
- return -1;
- }
-
- protected Integer convertJ2EEVersionToModuleVersion(Integer j2eeVersion) {
- switch (j2eeVersion.intValue()) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- return new Integer(J2EEVersionConstants.WEB_2_2_ID);
- case J2EEVersionConstants.J2EE_1_3_ID :
- return new Integer(J2EEVersionConstants.WEB_2_3_ID);
- case J2EEVersionConstants.J2EE_1_4_ID :
- return new Integer(J2EEVersionConstants.WEB_2_4_ID);
- }
- return super.convertJ2EEVersionToModuleVersion(j2eeVersion);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEModuleCreationDataModel#getModuleType()
- */
- protected EClass getComponentType() {
- return CommonarchivePackage.eINSTANCE.getWARFile();
- }
-
- protected String getComponentExtension() {
- return ".war"; //$NON-NLS-1$
- }
-
- public boolean isPropertyEnabled(String propertyName) {
- if (USE_ANNOTATIONS.equals(propertyName)) {
- if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3)
- return false;
- return true;
- }
- return super.isPropertyEnabled(propertyName);
- }
-
- public IStatus validate(String propertyName) {
- if (propertyName.equals(CONTEXT_ROOT)) {
- if (getBooleanProperty(ADD_TO_EAR)) {
- return getAddComponentToEARDataModel().validateProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT);
- }
- return OK_STATUS;
- } else if (propertyName.equals(WEBCONTENT_FOLDER)) {
- IStatus status = OK_STATUS;
- String webFolderName = model.getStringProperty(WEBCONTENT_FOLDER);
- if (webFolderName == null || webFolderName.length() == 0) {
- String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.WEBCONTENTFOLDER_EMPTY);
- status = WTPCommonPlugin.createErrorStatus(errorMessage);
- return status;
- }
- }
- return super.validate(propertyName);
- }
-
- public void propertyChanged(DataModelEvent event) {
- super.propertyChanged(event);
- if (event.getDataModel() == getAddComponentToEARDataModel() && event.getPropertyName().equals(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT) && event.getDataModel().isPropertySet(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT)) {
- setProperty(CONTEXT_ROOT, event.getProperty());
- }
- // else if (event.getDataModel() == getServerTargetDataModel() &&
- // event.getPropertyName().equals(ServerTargetDataModel.RUNTIME_TARGET_ID) &&
- // event.getDataModel().isSet(ServerTargetDataModel.RUNTIME_TARGET_ID))
- // setProperty(ADD_TO_EAR, updateAddToEar());
- }
-
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- protected String getJ2EEProjectType() {
- return J2EEProjectUtilities.DYNAMIC_WEB;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationFacetOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationFacetOperation.java
deleted file mode 100644
index b90a427dc..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationFacetOperation.java
+++ /dev/null
@@ -1,83 +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.internal.web.archive.operations;
-
-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.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.J2EEComponentCreationFacetOperation;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
-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.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- */
-public class WebComponentCreationFacetOperation extends J2EEComponentCreationFacetOperation implements DoNotUseMeThisWillBeDeletedPost15 {
-
- public WebComponentCreationFacetOperation(IDataModel model) {
- super(model);
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
- String projectName = model.getStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME);
-
- dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, projectName);
-
- FacetDataModelMap map = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- map.add(setupJavaInstallAction());
- IDataModel newModel = setupWebInstallAction();
- map.add(newModel);
- setRuntime(newModel, dm); // Setting runtime property
- setAddToEARFromWizard(newModel);
- IStatus stat = dm.getDefaultOperation().execute(monitor, info);
- if (stat.isOK()) {
- String earProjectName = (String) model.getProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_NAME);
- IProject earProject = ProjectUtilities.getProject(earProjectName);
- if (earProject != null && earProject.exists())
- stat = addtoEar(projectName, earProjectName);
- }
-
- return stat;
- }
-
- protected IDataModel setupWebInstallAction() {
- String versionStr = model.getPropertyDescriptor(IJ2EEComponentCreationDataModelProperties.COMPONENT_VERSION).getPropertyDescription();
- IDataModel webFacetInstallDataModel = DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
- webFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME));
- webFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, versionStr);
- webFacetInstallDataModel.setProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, model.getStringProperty(IWebComponentCreationDataModelProperties.WEBCONTENT_FOLDER));
- webFacetInstallDataModel.setProperty(IWebFacetInstallDataModelProperties.CONTEXT_ROOT, model.getStringProperty(IWebComponentCreationDataModelProperties.CONTEXT_ROOT));
- webFacetInstallDataModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR,model.getBooleanProperty(IJ2EEComponentCreationDataModelProperties.ADD_TO_EAR));
- if (model.getBooleanProperty(IJ2EEComponentCreationDataModelProperties.ADD_TO_EAR)) {
- webFacetInstallDataModel.setProperty(IWebFacetInstallDataModelProperties.EAR_PROJECT_NAME, model.getProperty(IJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_NAME));
- }
- webFacetInstallDataModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI, model.getProperty(IJ2EEComponentCreationDataModelProperties.MODULE_URI));
- webFacetInstallDataModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.RUNTIME_TARGET_ID, model.getProperty(IJ2EEComponentCreationDataModelProperties.RUNTIME_TARGET_ID));
- return webFacetInstallDataModel;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java
deleted file mode 100644
index a749b683f..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java
+++ /dev/null
@@ -1,86 +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.internal.web.archive.operations;
-
-import java.util.Set;
-
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentExportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentExportDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class WebComponentExportDataModelProvider extends J2EEComponentExportDataModelProvider implements IWebComponentExportDataModelProperties {
-
- public WebComponentExportDataModelProvider() {
- super();
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new WebComponentExportOperation(model);
- }
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(EXCLUDE_COMPILE_JSP);
- return propertyNames;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (EXCLUDE_COMPILE_JSP.equals(propertyName)) {
- return Boolean.FALSE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- protected String getProjectType() {
- return J2EEProjectUtilities.DYNAMIC_WEB;
- }
-
- protected String getWrongComponentTypeString(String projectName) {
- return EARCreationResourceHandler.getString(EARCreationResourceHandler.NOT_A_WAR, new Object[]{projectName});
- }
-
- protected String getModuleExtension() {
- return ".war"; //$NON-NLS-1$
- }
- /**
- * Exports the specified Web Module project to the specified WAR file.
- *
- * @param webProjectName
- * The name of the Web Module project to export.
- * @param warFileName
- * The fully qualified WAR file location to export the specified Web Module project.
- * @param overwriteExisting
- * If this is <code>true</code> then an existing file at the location specified by
- * <code>earFileName</code> will be overwritten.
- * @param exportSource
- * If this is <code>true</code> then all source files in the specified Web Module
- * will be included in the resulting WAR file.
- * @plannedfor WTP 1.0
- */
- // TODO: determine plan for new DM Provider
- // public static void exportProject(String webProjectName, String warFileName, boolean
- // overwriteExisting, boolean exportSource) {
- // WebModuleExportDataModel dataModel = new WebModuleExportDataModel();
- // dataModel.setProperty(PROJECT_NAME, webProjectName);
- // dataModel.setBooleanProperty(OVERWRITE_EXISTING, overwriteExisting);
- // dataModel.setProperty(ARCHIVE_DESTINATION, warFileName);
- // dataModel.setBooleanProperty(EXPORT_SOURCE_FILES, exportSource);
- // try {
- // dataModel.getDefaultOperation().run(null);
- // } catch (InvocationTargetException e) {
- // Logger.getLogger().logError(e);
- // } catch (InterruptedException e) {
- // Logger.getLogger().logError(e);
- // }
- // }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
deleted file mode 100644
index 2cb7bde3b..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
+++ /dev/null
@@ -1,51 +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.internal.web.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.internal.archive.operations.AppClientArchiveOpsResourceHandler;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class WebComponentExportOperation extends J2EEArtifactExportOperation {
-
- public WebComponentExportOperation() {
- super();
- }
-
- public WebComponentExportOperation(IDataModel model) {
- super(model);
- }
-
- protected void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
- try {
- CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory();
- WebComponentLoadStrategyImpl ls = new WebComponentLoadStrategyImpl(getComponent());
- ls.setExportSource(isExportSource());
- setModuleFile(caf.openWARFile(ls, getDestinationPath().toOSString()));
- getModuleFile().saveAsNoReopen(getDestinationPath().toOSString());
- } catch (SaveFailureException ex) {
- throw ex;
- } catch (Exception e) {
- throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e);
- } }
-
- protected String archiveString() {
- return "War File";
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java
deleted file mode 100644
index 1bf14b93e..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java
+++ /dev/null
@@ -1,126 +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.internal.web.archive.operations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEUtilityJarImportDataModelProvider;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
-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.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * This dataModel is used for to import Web Modules (from WAR files) into the workspace.
- *
- * 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 final class WebComponentImportDataModelProvider extends J2EEComponentImportDataModelProvider implements IWebComponentImportDataModelProperties {
-
- public Set getPropertyNames() {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(WEB_LIB_MODELS);
- propertyNames.add(WEB_LIB_ARCHIVES_SELECTED);
- propertyNames.add(CONTEXT_ROOT);
- return propertyNames;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(WEB_LIB_MODELS) || propertyName.equals(WEB_LIB_ARCHIVES_SELECTED)) {
- return Collections.EMPTY_LIST;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- protected int getType() {
- return XMLResource.WEB_APP_TYPE;
- }
-
- protected IStatus validateModuleType() {
- if (getArchiveFile() instanceof WARFile)
- return OK_STATUS;
-
- // TODO: STRING MOVE
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString("Temp String for none WARFile")); //$NON-NLS-1$);
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(FILE)) {
-
- IDataModel moduleDM = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- if (getModuleFile() != null) {
-
- FacetDataModelMap map = (FacetDataModelMap) moduleDM.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel webFacetDataModel = map.getFacetDataModel( J2EEProjectUtilities.DYNAMIC_WEB );
-
- int version = getModuleSpecVersion();
- String versionText = J2EEVersionUtil.getServletTextVersion( version );
- webFacetDataModel.setStringProperty(IFacetDataModelProperties.FACET_VERSION_STR, versionText);
- model.notifyPropertyChange(PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
- }
-
- Archive archive = (Archive) propertyValue;
- if (null != archive) {
- WARFile war = (WARFile) archive;
- List libs = war.getLibArchives();
- List nestedModels = new ArrayList();
- for (int i = 0; i < libs.size(); i++) {
- IDataModel localModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
- localModel.setProperty(FILE, libs.get(i));
- localModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME));
- nestedModels.add(localModel);
- }
- setProperty(WEB_LIB_MODELS, nestedModels);
- }
- }else if(propertyName.equals(CONTEXT_ROOT)){
- IDataModel creationModel = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- FacetDataModelMap map = (FacetDataModelMap) creationModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel webFacetDataModel = map.getFacetDataModel( J2EEProjectUtilities.DYNAMIC_WEB );
- webFacetDataModel.setStringProperty(IWebFacetInstallDataModelProperties.CONTEXT_ROOT, (String)propertyValue);
- }
- return true;
- }
-
- protected Archive openArchive(String uri) throws OpenFailureException {
- Archive archive = CommonarchiveFactory.eINSTANCE.openWARFile(getArchiveOptions(), uri);
- return archive;
- }
-
- protected IDataModel createJ2EEComponentCreationDataModel() {
- return DataModelFactory.createDataModel(new WebFacetProjectCreationDataModelProvider());
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new WebComponentImportOperation(model);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
deleted file mode 100644
index 9d1122981..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
+++ /dev/null
@@ -1,106 +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.internal.web.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactImportOperation;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class WebComponentImportOperation extends J2EEArtifactImportOperation {
- /**
- * @param model
- */
- public WebComponentImportOperation(IDataModel model) {
- super(model);
- }
-
- protected void doExecute(IProgressMonitor monitor) throws ExecutionException {
- super.doExecute(monitor);
- IVirtualFolder libFolder = virtualComponent.getRootFolder().getFolder(WebArtifactEdit.WEBLIB);
- if (!libFolder.exists()) {
- try {
- libFolder.create(IResource.FORCE, new NullProgressMonitor());
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
- try {
- importWebLibraryProjects(monitor);
- } catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- private void importWebLibraryProjects(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, ExecutionException {
- List selectedLibs = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
- List libProjects = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_MODELS);
- IDataModel importModel = null;
- IVirtualComponent nestedComponent = null;
- Archive libArchive = null;
- List targetComponents = new ArrayList();
- Map compToURIMap = new HashMap();
- for (int i = 0; null != libProjects && i < libProjects.size(); i++) {
- importModel = (IDataModel) libProjects.get(i);
- libArchive = (Archive) importModel.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
- if (selectedLibs.contains(libArchive)) {
- importModel.getDefaultOperation().execute(monitor, info);
- nestedComponent = (IVirtualComponent) importModel.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT);
- targetComponents.add(nestedComponent);
- String archiveURI = libArchive.getURI();
- int lastIndex = archiveURI.lastIndexOf('/');
- if (-1 != lastIndex && lastIndex + 1 < archiveURI.length()) {
- lastIndex++;
- archiveURI = archiveURI.substring(lastIndex);
- }
- compToURIMap.put(nestedComponent, archiveURI);
- }
- }
- /**
- * The J2EEComponentClasspathContainr will handle adding these to the classpath, so they
- * don't need to be added here.
- */
- if (targetComponents.size() > 0) {
- IDataModel createRefComponentsModel = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
- createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, virtualComponent);
- createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, "/WEB-INF/lib/"); //$NON-NLS-1$
- createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetComponents);
- createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, compToURIMap);
- createRefComponentsModel.getDefaultOperation().execute(monitor, info);
- }
- }
-
- protected SaveStrategy createSaveStrategy(IVirtualComponent aVirtualComponent) {
- return new WebComponentSaveStrategyImpl(aVirtualComponent);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java
deleted file mode 100644
index c57d25e6b..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java
+++ /dev/null
@@ -1,95 +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.internal.web.archive.operations;
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-
-public class WebComponentLoadStrategyImpl extends ComponentLoadStrategyImpl {
-
- public WebComponentLoadStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public List getFiles() {
- super.getFiles();
- addLooseLibJARsToFiles();
- return filesHolder.getFiles();
- }
-
- public IVirtualReference[] getLibModules() {
- WebArtifactEdit webArtifactEdit = null;
- try {
- webArtifactEdit = (WebArtifactEdit) ComponentUtilities.getArtifactEditForRead(getComponent());
- if (webArtifactEdit != null)
- return webArtifactEdit.getLibModules();
- } finally {
- if (webArtifactEdit != null)
- webArtifactEdit.dispose();
- }
- return null;
-
- }
-
- public void addLooseLibJARsToFiles() {
- IVirtualReference[] libModules = getLibModules();
- for (int i = 0; i < libModules.length; i++) {
- IVirtualReference iLibModule = libModules[i];
- IVirtualComponent looseComponent = iLibModule.getReferencedComponent();
- if (looseComponent.isBinary()) {
- VirtualArchiveComponent archiveComp = (VirtualArchiveComponent) looseComponent;
- java.io.File diskFile = archiveComp.getUnderlyingDiskFile();
- if (!diskFile.exists()) {
- IFile wbFile = archiveComp.getUnderlyingWorkbenchFile();
- diskFile = new File(wbFile.getLocation().toOSString());
- }
- String uri = iLibModule.getRuntimePath().makeRelative().toString() + "/" + diskFile.getName(); //$NON-NLS-1$
- addExternalFile(uri, diskFile);
- } else {
- String name = null;
- String archiveName = iLibModule.getArchiveName();
- if (archiveName != null && archiveName.length() > 0) {
- name = archiveName;
- } else {
- name = looseComponent.getName() + ".jar"; //$NON-NLS-1$
- }
- String prefix = iLibModule.getRuntimePath().makeRelative().toString();
- if (prefix.length() > 0 && prefix.charAt(prefix.length() - 1)!= '/') {
- prefix += "/"; //$NON-NLS-1$
- }
-
- String uri = prefix + name;
- try {
- Archive utilJAR = J2EEProjectUtilities.asArchive(uri, looseComponent.getProject(), isExportSource());
- if (utilJAR == null)
- continue;
- filesHolder.addFile(utilJAR);
- } catch (OpenFailureException oe) {
- String message = ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.UNABLE_TO_LOAD_MODULE_ERROR_, new Object[]{uri, getComponent().getProject().getName(), oe.getConcatenatedMessages()}); //$NON-NLS-1$
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logTrace(message);
- }
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
deleted file mode 100644
index bae5fd666..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,110 +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.internal.web.archive.operations;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEComponentSaveStrategyImpl;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class WebComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
-
- public WebComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- protected boolean shouldLinkAsComponentRef(Archive archive) {
- if (null != dataModel) {
- List list = (List) dataModel.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
- return !list.contains(archive);
- }
- return true;
- }
-
- /**
- * DoNotUseMeThisWillBeDeletedPost15
- *
- * @deprecated
- * @param archive
- * @return
- */
- protected boolean operationHandlesNested(Archive archive) {
- return !shouldLinkAsComponentRef(archive);
- }
-
- protected boolean shouldAddImportedClassesToClasspath() {
- return false; // never add to classpath because the web app container will pick this up.
- }
-
- protected String getImportedClassesURI(File aFile) {
- String uri = aFile.getURI();
- return WTProjectStrategyUtils.makeRelative(uri, ArchiveConstants.WEBAPP_CLASSES_URI);
- }
-
- protected IPath getImportedClassesRuntimePath() {
- return new Path("/" + ArchiveConstants.WEBAPP_CLASSES_URI);
- }
-
- protected IPath getOutputPathForFile(File aFile) {
- if (null != nonStandardSourceFiles && nonStandardSourceFiles.containsKey(aFile)) {
- return new Path((String) nonStandardSourceFiles.get(aFile));
- }
- return super.getOutputPathForFile(aFile);
- }
-
- /**
- * This map handles the case when a java source file is not in the same place as the .class
- * file. For example if all the source files were contained in WEB-INF/source
- */
- protected Map nonStandardSourceFiles;
-
- protected boolean isClassWithoutSource(File aFile) {
- String javaUri = ArchiveUtil.classUriToJavaUri(aFile.getURI());
- if (javaUri == null)
- return false;
- if (archive.containsFile(javaUri)) {
- return false;
- }
- // see if it is a JSP
- String jspUri = javaUri.substring(0, javaUri.indexOf(ArchiveUtil.DOT_JAVA));
- int lastSlash = jspUri.lastIndexOf('/');
- int _index = lastSlash == -1 ? ArchiveConstants.WEBAPP_CLASSES_URI.length() : lastSlash + 1;
- if (jspUri.charAt(_index) == '_') {
- jspUri = jspUri.substring(ArchiveConstants.WEBAPP_CLASSES_URI.length(), _index) + jspUri.substring(_index + 1) + ArchiveUtil.DOT_JSP;
- if (archive.containsFile(jspUri)) {
- return false;
- }
- }
-
- // see if the source is in another directory
- File sourceFile = ((WARFile) archive).getSourceFile(aFile);
- if (null == sourceFile) {
- return true;
- }
- if (nonStandardSourceFiles == null) {
- nonStandardSourceFiles = new HashMap();
- }
- if (!nonStandardSourceFiles.containsKey(nonStandardSourceFiles)) {
- nonStandardSourceFiles.put(sourceFile, javaUri);
- }
- return false;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java
deleted file mode 100644
index 2da9e16be..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,61 +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.internal.web.archive.operations;
-
-import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
-import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.J2EEFacetProjectCreationDataModelProvider;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetInstallDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-
-public class WebFacetProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider {
-
- public WebFacetProjectCreationDataModelProvider() {
- super();
- }
-
- public void init() {
- super.init();
- FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel javaFacet = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
- map.add(javaFacet);
- IDataModel webFacet = DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
- map.add(webFacet);
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME,webFacet.getStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER));
- webFacet.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, (String)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 webFacet = map.getFacetDataModel( J2EEProjectUtilities.DYNAMIC_WEB );
- webFacet.setProperty( IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI, propertyValue );
- }
- return super.propertySet(propertyName, propertyValue);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.java
deleted file mode 100644
index f0b00aebc..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-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.internal.web.classpath;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.common.jdt.internal.classpath.FlexibleProjectContainer;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class WebAppLibrariesContainer
-
- extends FlexibleProjectContainer
-
-{
- private static final IPath[] paths
- = new IPath[] { new Path( "WEB-INF/lib" ),
- new Path( "WEB-INF/classes" ) };
-
- private static final PathType[] types
- = new PathType[] { PathType.LIB_DIRECTORY, PathType.CLASSES_DIRECTORY };
-
- public static final String CONTAINER_ID
- = "org.eclipse.jst.j2ee.internal.web.container";
-
- public WebAppLibrariesContainer( final IPath path,
- final IJavaProject jproject )
- {
- super( path, jproject, getProject( path, jproject), paths, types );
- }
-
- public String getDescription()
- {
- if( this.owner.getProject() != this.project )
- {
- return NLS.bind( Resources.labelWithProject, this.project.getName() );
- }
- else
- {
- return Resources.label;
- }
- }
-
- public void install()
- {
- final IJavaProject[] projects = new IJavaProject[] { this.owner };
- final IClasspathContainer[] conts = new IClasspathContainer[] { this };
-
- try
- {
- JavaCore.setClasspathContainer( path, projects, conts, null );
- }
- catch( JavaModelException e )
- {
- WebPlugin.log( e );
- }
- }
-
- public void refresh()
- {
- ( new WebAppLibrariesContainer( this.path, this.owner ) ).install();
- }
-
- private static final IProject getProject( final IPath path,
- final IJavaProject jproject )
- {
- if( path.segmentCount() == 1 )
- {
- return jproject.getProject();
- }
- else
- {
- final String name = path.segment( 1 );
- return ResourcesPlugin.getWorkspace().getRoot().getProject( name );
- }
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String label;
- public static String labelWithProject;
-
- static
- {
- initializeMessages( WebAppLibrariesContainer.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.properties b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.properties
deleted file mode 100644
index a2985e74d..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-label = Web App Libraries
-labelWithProject = Web App Libraries [{0}] \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainerInitializer.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainerInitializer.java
deleted file mode 100644
index ed02a7d99..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainerInitializer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005-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.internal.web.classpath;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jst.common.jdt.internal.classpath.FlexibleProjectContainerInitializer;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class WebAppLibrariesContainerInitializer
-
- extends FlexibleProjectContainerInitializer
-
-{
- public void initialize( final IPath path,
- final IJavaProject jproj )
-
- throws CoreException
-
- {
- ( new WebAppLibrariesContainer( path, jproj ) ).install();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java
deleted file mode 100644
index d9bab661a..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 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.internal.web.operations;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jdt.core.IClasspathEntry;
-
-public class ClasspathUtilities {
-
- static public IClasspathEntry[] addClasspathEntries(IClasspathEntry[] entries1, IClasspathEntry[] entries2) {
- List list = new ArrayList(entries1.length + entries2.length);
- list.addAll(Arrays.asList(entries1));
-
- for (int i = 0; i < entries2.length; i++) {
- IClasspathEntry iClasspathEntry = entries2[i];
- if (!list.contains(iClasspathEntry))
- list.add(iClasspathEntry);
- }
-
- IClasspathEntry[] ret = new IClasspathEntry[list.size()];
- return (IClasspathEntry[]) list.toArray(ret);
- }
-
- static protected boolean entryExists(IClasspathEntry entry, IClasspathEntry[] col) {
- for (int i = 0; i < col.length; i++) {
- IClasspathEntry otherEntry = col[i];
- if (entry.getContentKind() != otherEntry.getContentKind())
- continue;
-
- if (entry.getEntryKind() != otherEntry.getEntryKind())
- continue;
-
- if (entry.isExported() != otherEntry.isExported())
- continue;
-
- if (!entry.getPath().equals(otherEntry.getPath()))
- continue;
- return true;
- }
- return false;
- }
-
- static public IClasspathEntry[] removeClasspathEntries(IClasspathEntry[] removeFromCol, IClasspathEntry[] removeCol) {
- List list = new ArrayList(removeFromCol.length);
- // list.addAll(Arrays.asList(removeFromCol));
-
- for (int i = 0; i < removeFromCol.length; i++) {
- IClasspathEntry iClasspathEntry = removeFromCol[i];
- if (!entryExists(iClasspathEntry, removeCol))
- list.add(iClasspathEntry);
- }
-
- IClasspathEntry[] ret = new IClasspathEntry[list.size()];
- return (IClasspathEntry[]) list.toArray(ret);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java
deleted file mode 100644
index e8de100ce..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 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.internal.web.operations;
-
-import org.eclipse.jdt.core.IClasspathEntry;
-
-public interface IWebProjectWizardInfo {
- /**
- * Adds entries to the class path for this project
- */
- public void addToClasspathEntries(IClasspathEntry[] entries);
-
- /**
- * Get the name of the specified project Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public String getProjectName();
-
- /**
- * Get the Enterprise Application Project
- */
- public String getEARProjectName();
-
- /**
- * Get the name of the web content folder. If not set then return the current default.
- */
- public String getWebContentName();
-
- /**
- * Set the name of the web content folder
- */
- public void setWebContentName(String name);
-
- /**
- * Get the name of the Java source folder If not set then return the current default.
- */
- public String getJavaSourceName();
-
- /**
- * Set the name of the Java source folder
- */
- public void setJavaSourceName(String name);
-
- /**
- * Return an Object for the assocated properties or null
- */
- public Object getProperty(String propertyName);
-
- /**
- * Set an Object for the assocated properties or null
- */
- public void setProperty(String propertyName, Object value);
-
-
-}
-
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java
deleted file mode 100644
index 9c5053087..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 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.internal.web.operations;
-
-
-
-/*
- * The IConfigurationConstants are the list of tags that are usuable for specifying a web
- * application parameters via XML
- *
- * @see WebApplicationSpecification for the full DTD
- */
-
-public interface IWebToolingConstants {
-
- public String TRUE = "true"; //$NON-NLS-1$
- public String FALSE = "false"; //$NON-NLS-1$
-
- public String HTTP_PATH_PREFIX = "http://"; //$NON-NLS-1$
- public String INDEX_FILE = "index.html"; //$NON-NLS-1$
- public String HTTP_PARAMETER_SEPARATOR = "?"; //$NON-NLS-1$
- public String CONTENT_LENGTH_HEADER_KEY = "Content-Length"; //$NON-NLS-1$
-
- public String SENTENCE_TERMINATOR = "."; //$NON-NLS-1$
-
- public String POST_COMMAND = "POST"; //$NON-NLS-1$
- public String GET_COMMAND = "GET"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java
deleted file mode 100644
index 1d9eaaaec..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 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.internal.web.operations;
-
-/**
- * The IWebToolingCoreConstants are the constants required by the ITP core
- */
-public interface IWebToolingCoreConstants {
- public String PLUG_IN_ID = "com.ibm.etools.webtools"; //$NON-NLS-1$
- public String PROP_SERVLET_JAR = "com.ibm.etools.webtools.servletjar"; //$NON-NLS-1$
- public String PROP_WEBAS_JAR = "com.ibm.etools.webtools.webasjar"; //$NON-NLS-1$
- public String PROP_CLIENT_NAME = "com.ibm.etools.webtools.clientname"; //$NON-NLS-1$
- public String PROP_LINK_STYLE = "com.ibm.etools.webtools.linkstyle"; //$NON-NLS-1$
- public String PROP_MODIFY_LINK_PROMPT = "com.ibm.etools.webtools.modifyprompt"; //$NON-NLS-1$
- public String PROP_AUTO_MODIFY_LINK = "com.ibm.etools.webtools.automodify"; //$NON-NLS-1$
- public String JDT_IDENTIFIER = "org.eclipse.jdt.ui"; //$NON-NLS-1$
- public String RUNTIME_IDENTIFIER = "WebNatureRuntime"; //$NON-NLS-1$
- public String DOC_RELATIVE = "DOC_RELATIVE"; //$NON-NLS-1$
- public String DOC_ROOT_RELATIVE = "DOC_ROOT_RELATIVE"; //$NON-NLS-1$
- public String ICON_PATH = "icons"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java
deleted file mode 100644
index f17c1b7ed..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 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.internal.web.operations;
-
-
-
-/**
- * Code generation class compiled from template file MasterCSS.tpl
- */
-public class MasterCSS implements WebToolingTemplate {
- private static final String TEXT_1 = "BODY\r\n{\r\n BACKGROUND-COLOR: #FFE4B5;\r\n COLOR: black;\r\n FONT-FAMILY: 'Times New Roman'\r\n}\r\nH1\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: x-large;\r\n FONT-WEIGHT: bolder;\r\n TEXT-TRANSFORM: capitalize\r\n}\r\nH2\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: large;\r\n FONT-WEIGHT: bolder;\r\n TEXT-TRANSFORM: capitalize\r\n}\r\nH3\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: large;\r\n FONT-WEIGHT: lighter;\r\n TEXT-TRANSFORM: capitalize\r\n}";//$NON-NLS-1$
- private static final String TEXT_2 = "\r\n";//$NON-NLS-1$
-
- /**
- * Code generation method
- *
- * @return String
- */
- public String generate(TemplateData data) {
- StringBuffer sb = new StringBuffer();
- sb.append(TEXT_1);
- sb.append(TEXT_2);
- return sb.toString();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java
deleted file mode 100644
index a4826e5b2..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java
+++ /dev/null
@@ -1,994 +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.internal.web.operations;
-
-
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import com.ibm.icu.util.StringTokenizer;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-
-
-/**
- * This class stores the relationship between two files. In particular, this is an inLink and the
- * files which reference it.
- */
-public class RelationData {
- public class Link implements Cloneable {
-
- private String url;
- private int occurrences = 0;
-
- public Link(String newUrl, int occ) {
- url = newUrl;
- occurrences = occ;
- }
-
- /**
- * Returns an exact copy of this object.
- *
- * @return Created clone object
- */
- public Object clone() {
- return new Link(url, occurrences);
- }
-
- /**
- * Returns the url of the file that references this inLink
- *
- * @return String
- */
- public String getURL() {
- return url;
- }
-
- /**
- * Returns the number of times this file references the inLink
- *
- * @return int
- */
- public int getOccurrences() {
- return occurrences;
- }
-
- private int addOccurrence(int add) {
- occurrences = occurrences + add;
- return occurrences;
- }
-
- public String toString() {
- return url;
- }
- }
-
- // our relationship table. Key is a string which is the path of the inLink,
- // value is a vector of files that reference the inLink.
- protected Hashtable inLinksTable = null;
- protected Hashtable anchorsTable = null;
- private static final int INIT_HASH_TABLE_SIZE = 100;
- private static final int INIT_ANCHORS_HASH_TABLE_SIZE = 10;
- private boolean fileOk = false;
- private static final String LINK_STATE_FILE_NAME = "link_table_states.txt";//$NON-NLS-1$
- private static final String LINK_SERVERCONTEXTROOT_FILE_NAME = "link_scr_states.txt";//$NON-NLS-1$
- public static final String LINK_MISSING_FILE = "-";//$NON-NLS-1$
- public static final String LINK_INDEX_SEPARATOR = "+";//$NON-NLS-1$
- public static final String ANCHOR_INDEX_SEPARATOR = "#";//$NON-NLS-1$
- public static final String LINK_OCCURENCE_SEPARATOR = "/";//$NON-NLS-1$
- public static final String ANCHOR_SEPARATOR = "#### ANCHORS ####";//$NON-NLS-1$
-
- /**
- * RelationData constructor comment.
- */
- public RelationData() {
- super();
- inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE);
- anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE);
- }
-
- public Link addInLink(String file_path, String parent_path, int occurence) {
- Vector in_links = (Vector) inLinksTable.get(file_path);
- if (in_links == null) {
- return null;
- }
- for (int i = 0; i < in_links.size(); i++) {
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
-
- //
- // Increment the occurence and return
- //
-
- if (url.compareTo(parent_path) == 0) {
- inlnk.addOccurrence(occurence);
- return inlnk;
- }
- }
-
- //
- // The link does not exist, need to add an entry in the table for it
- //
-
- Link inlnk = new Link(parent_path, occurence);
- in_links.addElement(inlnk);
- return inlnk;
- }
-
- public void changeInLink(String filePath, boolean missing) {
-
- if (missing) {
- Vector inlinks = (Vector) inLinksTable.remove(filePath);
- inLinksTable.put(LINK_MISSING_FILE + filePath, inlinks);
- } else {
- Vector inlinks = (Vector) inLinksTable.remove(LINK_MISSING_FILE + filePath);
- inLinksTable.put(filePath, inlinks);
- }
- }
-
-
- /*
- * returns which projects depend on this file i.e. any projects that are in this file's list of
- * in_links
- */
- public Collection getDependentProjects(String file_path) {
- Hashtable outProjects = new Hashtable();
- Vector in_links = (Vector) inLinksTable.get(file_path);
-
- if (in_links != null) {
- for (int i = 0; i < in_links.size(); i++) {
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
- // should be in the form of: /ProjName/....
- if (url.length() > 0) {
- // key could be the filename or the missing filename ("-" + filename)
- // take this into account and offset the index accordingly
- int index = 0;
- int offset = 1;
- if (url.charAt(0) == '-') {
- index = url.indexOf(IPath.SEPARATOR, 2);
- offset = 2;
- } else {
- index = url.indexOf(IPath.SEPARATOR, 1);
- offset = 1;
- }
- if (index != -1) {
- String projName = url.substring(offset, index);
- outProjects.put(projName, projName);
- }
- }
- }
- }
- return outProjects.values();
- }
-
- /*
- * returns which cross-project files depend on this file i.e. any projects that are in this
- * file's list of in_links
- */
- public Collection getDependentProjectFiles(String projName) {
- Hashtable outProjects = new Hashtable();
-
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String path = (String) aenum.nextElement();
- // should be in the form of: /ProjName/....
- if (path.length() > 0) {
- // if path is a missing filename ("-" + filename) then it means that it had
- // to come from this project (that is, the external nonexistent file could not have
- // linked to this project). So, we will not add this path. Also, since it is marked
- // broken, it probably won't exist to do anything with it anyway.
- if (path.charAt(0) != '-') {
- int index = path.indexOf(IPath.SEPARATOR, 1);
- if (index != -1) {
- String currentProjName = path.substring(1, index);
- if (!currentProjName.equals(projName)) {
- outProjects.put(path, path);
- }
- }
- }
- }
- }
- return outProjects.values();
- }
-
-
-
- public void createInLinkEntry(String file_path, String parent_path, int occurence) {
-
- Vector in_links = new Vector();
- Link inlnk = new Link(parent_path, occurence);
- in_links.addElement(inlnk);
- inLinksTable.put(file_path, in_links);
- }
-
-
-
- public void dump() {
- if (false) {
- if (inLinksTable != null) {
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- StringBuffer St = new StringBuffer();
- String key = (String) aenum.nextElement();
- St.append("\nKey=" + key + "\n");//$NON-NLS-1$//$NON-NLS-2$
- Vector in_links = (Vector) inLinksTable.get(key);
- int nb_of_links = in_links.size();
-
- // Replace the string by index
- // Add a '+'separator only for more than one links to save space
- //
-
-
- for (int i = 0; i < nb_of_links; i++) {
- Link lnk = (Link) in_links.elementAt(i);
- St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
- }
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logInfo(St.toString());
- }
- }
- }
- }
-
- public void dump(boolean dump) {
- if (dump) {
- if (inLinksTable != null) {
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- StringBuffer St = new StringBuffer();
- String key = (String) aenum.nextElement();
- St.append("\nKey=" + key + "\n");//$NON-NLS-1$//$NON-NLS-2$
- Vector in_links = (Vector) inLinksTable.get(key);
- int nb_of_links = in_links.size();
-
- // Replace the string by index
- // Add a '+'separator only for more than one links to save space
- //
-
-
- for (int i = 0; i < nb_of_links; i++) {
- Link lnk = (Link) in_links.elementAt(i);
- St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
- }
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(St.toString());
- }
- }
- }
- }
-
- /**
- * used for LinksBuilder debugging
- */
- public void dump2() {
- if (inLinksTable != null) {
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- StringBuffer St = new StringBuffer();
- String key = (String) aenum.nextElement();
-
- Vector in_links = (Vector) inLinksTable.get(key);
- int nb_of_links = in_links.size();
- St.append("\nKey=" + key + " -- num:" + nb_of_links + "\n");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- // Replace the string by index
- // Add a '+'separator only for more than one links to save space
- //
-
-
- for (int i = 0; i < nb_of_links; i++) {
- Link lnk = (Link) in_links.elementAt(i);
- St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
- }
- System.out.println(St.toString());
- }
- }
- System.out.println("************************************************\n\n\n\n************************************\n"); //$NON-NLS-1$
- }
-
-
- public Vector getInLinks(String filePath) {
- return (Vector) inLinksTable.get(filePath);
- }
-
- public void getInLinks(String filePath, Vector vectInLinks) {
-
- if (inLinksTable != null) {
- dump();
- Vector in_links = (Vector) inLinksTable.get(filePath);
- if (in_links != null) {
- for (int i = 0; i < in_links.size(); i++) {
- Link inlnk = (Link) ((Link) in_links.elementAt(i)).clone();
- vectInLinks.addElement(inlnk);
- }
- }
- }
- }
-
- public Hashtable getAnchorsTable() {
- return anchorsTable;
- }
-
- /**
- * Returns the file used to store ServerContextRoot for the project.
- */
- public static File getPreviousSCRFile(IProject project) {
- return new Path(J2EEPlugin.getDefault().getStateLocation().toString() + File.separator + project.getName() + File.separator + LINK_SERVERCONTEXTROOT_FILE_NAME).toFile();
- }
-
- /**
- * Returns the file used to store the state of the link relations for the project.
- *
- * @return java.io.File The state file
- * @param project
- * org.eclipse.core.resources.IProject The project to get the state file for.
- */
- private File getStateFile(IProject project) {
- return new Path(J2EEPlugin.getDefault().getStateLocation().toString() + File.separator + project.getName() + File.separator + LINK_STATE_FILE_NAME).toFile();
- }
-
- public boolean hasInLinkEntry(String path) {
- return inLinksTable.containsKey(path);
- }
-
- /**
- * Run through all missing-file (-) RD entries to see if any of them closely match the path to
- * this class. Return all of the matches.
- */
- public Vector getPossibleMissingEndingMatches(IPath classPath) {
- Vector v = new Vector();
-
- String match = classPath.lastSegment();
- match = match.substring(0, match.length() - 6); // length minus ".class"
-
- String classPathStr = classPath.toString();
- String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6);
-
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String path = (String) aenum.nextElement();
- // check if path ends with the class name that has been added/removed
- if (path.startsWith(LINK_MISSING_FILE) && path.endsWith(match)) {
- // OK: simple match found; now let's match with finer granularity.
- // Take path and put it into a form where we can check if it is a
- // close match to the class that has changed:
- // /Proj/Web Content/com.acme.Foo --> com/acme/Foo
- String linkPath;
- int index = path.lastIndexOf(IPath.SEPARATOR);
- if (index != -1 && index < path.length() - 1) {
- linkPath = path.substring(index + 1);
- } else {
- linkPath = path;
- }
- String closeMatch = linkPath.replace('.', IPath.SEPARATOR);
-
- if (matchingClassPath.endsWith(closeMatch)) {
- Vector in_links = (Vector) inLinksTable.get(path);
- String nonMissingPath = path.substring(1, path.length());
- changeInLink(nonMissingPath, false);
- if (in_links != null) {
- for (int i = 0; i < in_links.size(); i++) {
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
- v.add(url);
- }
- }
- }
- }
- }
- return v;
- }
-
-
- /**
- * Run through all existing RD entries to see if any of them closely match the path to this
- * class. Return all of the matches.
- */
- public Vector getPossibleExistingEndingMatches(IPath classPath) {
- Vector v = new Vector();
-
- String match = classPath.lastSegment();
- match = match.substring(0, match.length() - 6); // length minus ".class"
-
- String classPathStr = classPath.toString();
- String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6);
-
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String path = (String) aenum.nextElement();
- // check if path ends with the class name that has been added/removed
- if (path.endsWith(match) && !path.startsWith(LINK_MISSING_FILE)) {
- // OK: simple match found; now let's match with finer granularity.
- // Take path and put it into a form where we can check if it is a
- // close match to the class that has changed:
- // /Proj/Web Content/com.acme.Foo --> com/acme/Foo
- String linkPath;
- int index = path.lastIndexOf(IPath.SEPARATOR);
- if (index != -1 && index < path.length() - 1) {
- linkPath = path.substring(index + 1);
- } else {
- linkPath = path;
- }
- String closeMatch = linkPath.replace('.', IPath.SEPARATOR);
-
- if (matchingClassPath.endsWith(closeMatch)) {
- Vector in_links = (Vector) inLinksTable.get(path);
- changeInLink(path, true);
- if (in_links != null) {
- for (int i = 0; i < in_links.size(); i++) {
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
- v.add(url);
- }
- }
- }
- }
- }
- return v;
- }
-
- /**
- * Run through all existing RD entries to see if any of them closely match the path to this
- * class. Remove the inlinks for all the matches.
- */
- public void removeInLinksPossibleExistingEndingMatches(IPath classPath) {
- String match = classPath.lastSegment();
- match = match.substring(0, match.length() - 6); // length minus ".class"
-
- String classPathStr = classPath.toString();
- String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6);
-
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String path = (String) aenum.nextElement();
- if (path.endsWith(match) && !path.startsWith(LINK_MISSING_FILE)) {
- // OK: simple match found; now let's match with finer granularity.
- // Take path and put it into a form where we can check if it is a
- // close match to the class that has changed:
- // /Proj/Web Content/com.acme.Foo --> com/acme/Foo
- String linkPath;
- int index = path.lastIndexOf(IPath.SEPARATOR);
- if (index != -1 && index < path.length() - 1) {
- linkPath = path.substring(index + 1);
- } else {
- linkPath = path;
- }
- String closeMatch = linkPath.replace('.', IPath.SEPARATOR);
-
- if (matchingClassPath.endsWith(closeMatch)) {
- removeInLinks(path);
- }
- }
- }
- }
-
- /**
- * Initialize links tables
- */
- public void initialize() {
- inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE);
- anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE);
-
- }
-
- /**
- * Initialize links tables
- */
- public void initializeAnchors() {
- anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE);
- }
-
- /**
- * Initialize links tables
- */
- public void initializeInLinks() {
- inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE);
- }
-
- /**
- * Return true if the file to restore data from existed and was successfully read.
- *
- * @return boolean
- */
- public boolean isFileOk() {
- return fileOk;
- }
-
- public boolean isInitialized() {
- return (inLinksTable != null);
- }
-
- public void newInLinkEntry(String path) {
- if (!inLinksTable.containsKey(path))
- inLinksTable.put(path, new Vector());
- }
-
- public void removeInLinks(String file_path) {
-
- //
- // Iterate through the fLinksTable to remove all in-links references
- // for file_path
- //
-
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String key = (String) aenum.nextElement();
- Vector in_links = (Vector) inLinksTable.get(key);
-
- for (int i = 0; i < in_links.size(); i++) {
-
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
-
- if (url.compareTo(file_path) == 0) {
- in_links.removeElementAt(i);
- break;
- }
-
- //
- // Remove the entry in the fLinksTable if the in-link
- // of the file is not in the workbench and an orphan link
- // otherwise update the in-links fLinksTable
- //
- }
-
- if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE)) {
- inLinksTable.remove(key);
- }
- }
- }
-
- /**
- * Iterate through the fLinksTable to return all out-links references for file_path
- *
- * @param file_path
- * @return
- */
- public List getOutLinks(String file_path) {
- ArrayList list = new ArrayList();
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String key = (String) aenum.nextElement();
- Vector in_links = (Vector) inLinksTable.get(key);
-
- for (int i = 0; i < in_links.size(); i++) {
-
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
-
- if (url.compareTo(file_path) == 0) {
- list.add(key);
- break;
- }
- }
- }
-
- return list;
- }
-
-
- /**
- * return whether other resources link to this file or not
- */
- public boolean referencedByOtherLinks(String file_path) {
-
- //
- // Iterate through the fLinksTable to remove all in-links references
- // for file_path
- //
- boolean referenced = false;
- for (Enumeration aenum = inLinksTable.keys(); !referenced && aenum.hasMoreElements();) {
- String key = (String) aenum.nextElement();
- Vector in_links = (Vector) inLinksTable.get(key);
-
- for (int i = 0; i < in_links.size(); i++) {
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
-
- if (url.compareTo(file_path) == 0) {
- referenced = true;
- break;
- }
- }
- }
- return referenced;
- }
-
-
- /*
- * performs as removeInLinks( String ) ... But for performance reasons, this also additionally
- * returns a list of all the projects that this file is dependent upon. This is useful to get
- * this information, and then go to all of those projects' relation data and tell them to
- * removeInLinks for this file.
- */
- public Collection removeInLinksForProjects(String file_path) {
-
- //
- // Iterate through the fLinksTable to remove all in-links references
- // for file_path
- //
- Hashtable projects = new Hashtable();
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String key = (String) aenum.nextElement();
- Vector in_links = (Vector) inLinksTable.get(key);
-
- for (int i = 0; i < in_links.size(); i++) {
-
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
-
- if (url.compareTo(file_path) == 0) {
- // should be in the form of: /ProjName/....
- if (key.length() > 0) {
- // key could be the filename or the missing filename ("-" + filename)
- // take this into account and offset the index accordingly
- int index = 0;
- int offset = 1;
- if (key.charAt(0) == '-') {
- index = key.indexOf(IPath.SEPARATOR, 2);
- offset = 2;
- } else {
- index = key.indexOf(IPath.SEPARATOR, 1);
- offset = 1;
- }
- if (index != -1) {
- String projName = key.substring(offset, index);
- projects.put(projName, projName);
- }
- }
- in_links.removeElementAt(i);
- break;
- }
-
- //
- // Remove the entry in the fLinksTable if the in-link
- // of the file is not in the workbench and an orphan link
- // otherwise update the in-links fLinksTable
- //
- }
-
- if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE))
- inLinksTable.remove(key);
- }
-
- return projects.values();
- }
-
-
-
- /**
- * performs as removeInLinks( String ) ... But for performance reasons, it additionally returns
- * which projects depend on this file. i.e. any projects that are in this file's list of
- * in_links
- */
- public Collection removeInLinksAndGetDependentProjects(String file_path) {
- //
- // Iterate through the fLinksTable to remove all in-links references
- // for file_path
- //
- Hashtable projects = new Hashtable();
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String key = (String) aenum.nextElement();
- Vector in_links = (Vector) inLinksTable.get(key);
-
- if (key.equals(RelationData.LINK_MISSING_FILE + file_path)) {
- int index = -1;
- for (int i = 0; i < in_links.size(); i++) {
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
-
- if (url.compareTo(file_path) == 0) {
- index = i;
- }
- if (url.length() > 1) {
- int projindex = url.indexOf(IPath.SEPARATOR, 1);
- if (projindex != -1) {
- String projName = url.substring(1, projindex);
- projects.put(projName, projName);
- }
- }
- }
- if (index != -1) {
- in_links.removeElementAt(index);
- }
-
- } else {
- for (int i = 0; i < in_links.size(); i++) {
-
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
-
- if (url.compareTo(file_path) == 0) {
-
- in_links.removeElementAt(i);
- break;
- }
-
- //
- // Remove the entry in the fLinksTable if the in-link
- // of the file is not in the workbench and an orphan link
- // otherwise update the in-links fLinksTable
- //
- }
- }
-
- if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE)) {
- inLinksTable.remove(key);
- }
- }
- return projects.values();
- }
-
-
- /**
- * remove all references to a specific inLink. When removeOrphan is true the inLink entry is
- * removed as well, when there are no more refereces to it
- */
- public void removeInLinks(String inLinkEntry, String inLinkReference, boolean removeOrphan) {
-
- String key = inLinkEntry;
- Vector in_links = (Vector) inLinksTable.get(key);
-
- for (int i = 0; i < in_links.size(); i++) {
-
- Link inlnk = (Link) in_links.elementAt(i);
- String url = inlnk.getURL();
-
- if (url.compareTo(inLinkReference) == 0) {
- in_links.removeElementAt(i);
- break;
- }
- }
-
- // If there are no more references to the inLinkEntry
- // and the caller wants this orphan deleted then
- // remove the key from the table
- if (in_links.isEmpty() && removeOrphan)
- inLinksTable.remove(key);
-
- }
-
- /**
- * Restores this builder's saved state and returns whether it was successful in doing so.
- */
- public boolean restore(IProject project) {
- if (project != null) {
- // get the state
- File stateFile = getStateFile(project);
- if (stateFile.exists()) {
- inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE);
-
- // read inLinksTable from stateFile
- Vector keys = new Vector();
- Vector indices = new Vector();
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new FileReader(stateFile));
-
- String line = null;
- // while( ((line = reader.readLine()) != null) && !line.startsWith(
- // ANCHOR_SEPARATOR ) )
- while ((line = reader.readLine()) != null) {
- String buffer = line;
-
-
- // to take into account the possibility of links spanning multiple lines,
- // keep reading until we find a line that starts with an idicator
- // that the link is finished (a line beginning w/ LINK_INDEX_SEPARATOR)
- line = reader.readLine();
- while (line != null && !line.startsWith(LINK_INDEX_SEPARATOR)) {
- buffer = buffer + line;
- line = reader.readLine();
- }
- // add link string (/MyProj/file.html)
- if (buffer != null) {
- keys.addElement(buffer);
- }
- // add references line (+2/3...)
- if (line != null) {
- indices.addElement(line);
- } else {
- System.out.println(ProjectSupportResourceHandler.Syntax_Error_in_the_links_UI_); //$NON-NLS-1$ = "Syntax Error in the links state file"
- return false;
- }
- }
-
- // Use this to load anchor information
- // // Now let's add all of the extra anchor information
- // if ( line != null && line.startsWith( ANCHOR_SEPARATOR ) ) {
- // while( (line = reader.readLine()) != null )
- // {
- // String buffer = line;
- //
- // // to take into account the possibility of links spanning multiple lines,
- // // keep reading until we find a line that starts with an idicator
- // // that the link is finished (a line beginning w/ LINK_INDEX_SEPARATOR)
- // line = reader.readLine();
- // while ( line != null && !line.startsWith( ANCHOR_INDEX_SEPARATOR ) ) {
- // buffer = buffer + line;
- // line = reader.readLine();
- // }
- //
- // // add file and all of its anchors
- // if ( buffer != null && line != null)
- // {
- // anchorsTable.put( buffer, line );
- // }
- // else
- // {
- // System.out.println(ResourceHandler.getString("Syntax_Error_in_the_links_UI_"));
- // //$NON-NLS-1$ = "Syntax Error in the links state file"
- // return false;
- // }
- // }
- //
- // }
- } catch (FileNotFoundException fe) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(fe);
- } catch (IOException ie) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ie);
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException ie2) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ie2);
- }
- }
- }
-
-
- //
- // Populate the hash inLinksTable with keys (file paths) and values (in links files
- // paths)
- //
- fileOk = true;
- for (int i = 0; i < keys.size(); i++) {
- try {
- String key = (String) keys.elementAt(i);
- String compacted_indices = (String) indices.elementAt(i);
-
- //
- // Parse the in-links indexes
- //
-
- int size = keys.size();
- Vector in_links = new Vector();
- if (compacted_indices != LINK_INDEX_SEPARATOR) {
-
- // Extract indexes and occurences
-
- StringTokenizer st_idx_occ = new StringTokenizer(new String(compacted_indices), LINK_INDEX_SEPARATOR);
- while (st_idx_occ.hasMoreTokens()) {
- String idx_occ = new String(st_idx_occ.nextToken());
- int pos_occ = idx_occ.indexOf(LINK_OCCURENCE_SEPARATOR);
- int index;
- int occurence = 1;
- if (pos_occ == -1) {
- index = Integer.valueOf(idx_occ).intValue();
- } else {
- index = Integer.valueOf(idx_occ.substring(0, pos_occ)).intValue();
- occurence = Integer.valueOf(idx_occ.substring(pos_occ + 1)).intValue();
- }
- if (index >= 0 && index < size) {
- Link inlnk = new Link((String) keys.elementAt(index), occurence);
- in_links.addElement(inlnk);
- }
- }
- }
- inLinksTable.put(key, in_links);
- } catch (Exception e) {
- fileOk = false;
- }
- }
-
- return fileOk;
- }
- return false;
-
- }
-
- return false;
- }
-
- /**
- * Saves this builder's state to disk so that it can be restarted in the same state later.
- */
- public void save(IProject project) {
-
- File stateFile = getStateFile(project);
- if (inLinksTable == null) {
- stateFile.delete();
- } else {
-
- // Prepare the index vector
-
- Vector index_vector = new Vector(inLinksTable.size());
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- index_vector.addElement(aenum.nextElement());
- }
-
- // write inLinksTable to stateFile
-
- try {
- File parentFolder = stateFile.getParentFile();
- if (!parentFolder.exists()) {
- parentFolder.mkdirs();
- }
- PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(stateFile)));
- for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
- String key = (String) aenum.nextElement();
- out.print(key);
- out.println();
- out.print(LINK_INDEX_SEPARATOR);
- Vector in_links = (Vector) inLinksTable.get(key);
- int nb_of_links = in_links.size();
-
- // Replace the string by index
- // Add a '+'separator only for more than one links to save space
- // Add '/<occurence>' only if occurence > 1 to save space
- //
-
- Link lnk = null;
- int nb_lnks = 0;
- if (nb_of_links > 0) {
- lnk = (Link) in_links.elementAt(0);
- out.print(index_vector.indexOf(lnk.getURL()));
- nb_lnks = lnk.getOccurrences();
- if (nb_lnks > 1) {
- out.print(LINK_OCCURENCE_SEPARATOR);
- out.print(nb_lnks);
- }
- for (int i = 1; i < nb_of_links; i++) {
- out.print(LINK_INDEX_SEPARATOR);
- lnk = (Link) in_links.elementAt(i);
- out.print(index_vector.indexOf(lnk.getURL()));
- nb_lnks = lnk.getOccurrences();
- if (nb_lnks > 1) {
- out.print(LINK_OCCURENCE_SEPARATOR);
- out.print(nb_lnks);
- }
- }
- }
- out.println();
- }
- /*
- * use this to save out anchor information //
- * ############################################ if ( !anchorsTable.isEmpty() ) {
- * out.println( ANCHOR_SEPARATOR ); } for (Enumeration enum = anchorsTable.keys();
- * enum.hasMoreElements();) { String key = (String) enum.nextElement();
- * out.print(key); out.println(); //out.print(ANCHOR_INDEX_SEPARATOR); out.println(
- * anchorsTable.get(key) ); }
- */
-
- out.flush();
- out.close();
- } catch (IOException e) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ProjectSupportResourceHandler.Error_while_saving_links_s_EXC_); //$NON-NLS-1$ = "Error while saving links state file"
- }
- }
- }
-
- /**
- * Insert the method's description here. Creation date: (3/21/2001 1:45:58 PM)
- *
- * @param newFileOk
- * boolean
- */
- void setFileOk(boolean newFileOk) {
- fileOk = newFileOk;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java
deleted file mode 100644
index 5003dc621..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 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 Sep 12, 2003
- */
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.servertarget.IServerTargetConstants;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-
-/**
- * A class with some useful methods that support server targetting for Web projects.
- *
- * @author Pratik Shah
- */
-public class ServerTargetUtil {
-
- private static final String defaultId = "com.ibm.etools.websphere.serverTarget.base.v51"; //$NON-NLS-1$
- private static final String defaultExpressId = "com.ibm.etools.websphere.serverTarget.express.v51"; //$NON-NLS-1$
-
- /**
- * @param targets
- * A list of IServerTargets
- * @return The index of the target server with the
- * {@link #getDefaultServerTargetId() default Id}; or 0, if it could not be found.
- */
- public static int findDefaultServerTargetIndex(List targets) {
- int index = 0;
- for (int i = 0; i < targets.size(); i++) {
- IRuntime target = (IRuntime) targets.get(i);
- if (target.getId().equals(getDefaultServerTargetId())) {
- index = i;
- break;
- }
- }
- return index;
- }
-
- /**
- * @param target
- * The IServerTarget that has to be found in the given list; it can be
- * <code>null</code>
- * @param list
- * The List from which the IServerTarget has to be found
- *
- * @return The index of the given target in the given list; or 0, if the given target could not
- * be found in the given list. Two IServerTargets are considered to be equal if they
- * have the same ID.
- */
- public static int findIndexOf(IRuntime target, List list) {
- int index = 0;
- if (target != null) {
- for (int i = 0; i < list.size(); i++) {
- IRuntime element = (IRuntime) list.get(i);
- if (element.equals(target)) {
- index = i;
- break;
- }
- }
- }
- return index;
- }
-
- /**
- * @return the Id of the target server that should be selected by default
- */
- public static String getDefaultServerTargetId() {
- String id = defaultExpressId;
- if (J2EEPlugin.isEJBSupportAvailable()) {
- id = defaultId;
- }
- return id;
- }
-
- /**
- * @param isJ2EE13
- * <code>true</code> if the constant for J2EE version 1.3 is desired
- * @return IServerTargetConstants.J2EE_12 or IServerTargetConstants.J2EE_13
- */
- public static String getJ2EEVersion(boolean isJ2EE13) {
- return isJ2EE13 ? IServerTargetConstants.J2EE_13 : IServerTargetConstants.J2EE_12;
- }
-
- /**
- * A convenient method that takes in a list of IServerTargets and returns an array of labels of
- * the IServerTargets in the given list.
- *
- * @param serverTargets
- * The list of IServerTargets
- * @return An array lof labels of the IServerTargets in the given list
- */
- public static String[] getServerNames(List serverTargets) {
- String[] result = new String[serverTargets.size()];
- for (int i = 0; i < result.length; i++) {
- IRuntime runtime = (IRuntime) serverTargets.get(i);
- result[i] = runtime.getName() + " (" + runtime.getRuntimeType().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- return result;
- }
-
- /**
- * @param prjName
- * name of the project whose ServerTarget has to be retrieved; it can be
- * <code>null</code>
- *
- * @return the ServerTarget of the given project; <code>null</code> if the project does not
- * exist or its ServerTarget is not specified.
- */
- public static IRuntime getServerTarget(String prjName) {
- if (prjName != null && !prjName.trim().equals("")) { //$NON-NLS-1$
- IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(prjName);
- if (prj != null && prj.exists()) {
- return ServerCore.getProjectProperties(prj).getRuntimeTarget();
- }
- }
- return null;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java
deleted file mode 100644
index 092e80054..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 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.internal.web.operations;
-
-
-
-public class TemplateData {
- protected java.lang.String wtFileName = "";//$NON-NLS-1$
- protected java.lang.String wtCSSName = "";//$NON-NLS-1$
- protected java.lang.String wtContainerLocatoin = "";//$NON-NLS-1$
- protected java.lang.String taglibs;
-
- /**
- * TemplateData constructor comment.
- */
- public TemplateData() {
- super();
- }
-
- /**
- */
- public String getContainerLocatoin() {
- return wtContainerLocatoin;
- }
-
- /**
- * Insert the method's description here. Creation date: (6/4/2001 5:24:30 PM)
- *
- * @return java.lang.String
- */
- public java.lang.String getCSSName() {
- return wtCSSName;
- }
-
- /**
- * Insert the method's description here. Creation date: (6/4/2001 5:22:56 PM)
- *
- * @return java.lang.String
- */
- public String getFileName() {
- return wtFileName;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/15/2001 4:16:10 PM)
- *
- * @return java.lang.String
- */
- public java.lang.String getTaglibs() {
- return taglibs;
- }
-
- /**
- */
- public void setContainerLocatoin(String newFileName) {
- wtContainerLocatoin = newFileName;
- }
-
- /**
- * Insert the method's description here. Creation date: (6/4/2001 5:24:30 PM)
- *
- * @param newCSSName
- * java.lang.String
- */
- public void setCSSName(java.lang.String newCSSName) {
- wtCSSName = newCSSName;
- }
-
- /**
- * Insert the method's description here. Creation date: (6/4/2001 5:22:56 PM)
- *
- * @param newWtFileName
- * java.lang.String
- */
- public void setFileName(String newFileName) {
- wtFileName = newFileName;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/15/2001 4:16:10 PM)
- *
- * @param newTaglibs
- * java.lang.String
- */
- public void setTaglibs(java.lang.String newTaglibs) {
- taglibs = newTaglibs;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
deleted file mode 100644
index 13fb0001a..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
+++ /dev/null
@@ -1,581 +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.internal.web.operations;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import com.ibm.icu.util.StringTokenizer;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-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.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-
-public class WebPropertiesUtil {
- // private static final char[] BAD_CHARS = {'/', '\\', ':'};
- private static final char[] BAD_CHARS = {':'};
- public static final String DEFAULT_JAVA_SOURCE_NAME = "Java Source"; //$NON-NLS-1$
- //TODO Port to flexible structure
- /**
- * Update the Web Content folder to a new value if it is different. This applies to both Static
- * and J2EE Web Projects. In the case of a J2EE Project, the library classpath entries will be
- * modifies to reflect the new location.
- *
- * @param project
- * The Web Project to update
- * @param webContentName
- * The new name given to the Web Project's Web Content folder
- * @param progressMonitor
- * Indicates progress of the update operation
- * @return True if the web content rename was actually renamed, false if unneeded.
- * @throws CoreException
- * The exception that occured during renaming of the the project's web content
- * folder
- */
- public static boolean updateWebContentNameAndProperties(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException {
- boolean success = false;
- if (project.exists() && project.isOpen()) {
-
- /*
- * IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(project); if
- * (webContentName == null) { if (webNature.isStatic()) { webContentName =
- * J2EEWebNatureRuntimeUtilities.getDefaultStaticWebContentName(); } else {
- * webContentName = J2EEWebNatureRuntimeUtilities.getDefaultJ2EEWebContentName(); } }
- */
-
- IPath newPath = new Path(webContentName);
- if (getModuleServerRoot(project).getProjectRelativePath().equals(newPath))
- return false;
- if (project.exists(newPath)) {
- IStatus status = new Status(IStatus.ERROR, "org.eclipse.jst.j2ee", IStatus.OK, ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Could_not_rename_____2, new Object[]{webContentName}), null); //$NON-NLS-1$ //$NON-NLS-2$
- throw new CoreException(status);
- }
-
- moveWebContentFolder(project, webContentName, progressMonitor);
- updateWebContentNamePropertiesOnly(project, webContentName, progressMonitor);
- success = true;
- }
- return success;
- }
-
- /**
- * Update the classpath entries and Server Root Name for this web project only.
- *
- * @param project
- * @param webContentName
- * @return
- */
- public static void updateWebContentNamePropertiesOnly(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException {
- IPath newPath = new Path(webContentName);
- if (getModuleServerRoot(project).equals(newPath))
- return;
-
- if (!getModuleServerRoot(project).equals(webContentName)) {
-
- // if (webModuleArtifact.isJ2EE) {
- // Update the library references
- IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
-
- IClasspathEntry[] classpath = javaProject.getRawClasspath();
- IClasspathEntry[] newClasspath = new IClasspathEntry[classpath.length];
-
- for (int i = 0; i < classpath.length; i++) {
- if (classpath[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
- IClasspathEntry library = classpath[i];
- IPath libpath = library.getPath();
- IPath modServerRootPath = getModuleServerRoot(project).getFullPath();
- if (modServerRootPath.isPrefixOf(libpath)) {
- IPath prunedPath = libpath.removeFirstSegments(modServerRootPath.segmentCount());
- IPath relWebContentPath = new Path(webContentName + "/" + prunedPath.toString()); //$NON-NLS-1$
- IResource absWebContentPath = project.getFile(relWebContentPath);
-
- IPath srcAttachmentPath = library.getSourceAttachmentPath();
- if (null != srcAttachmentPath) {
- prunedPath = srcAttachmentPath.removeFirstSegments(modServerRootPath.segmentCount());
- }
- IResource absWebContentSrcAttachmentPath = project.getFile(relWebContentPath);
-
- newClasspath[i] = JavaCore.newLibraryEntry(absWebContentPath.getFullPath(), absWebContentSrcAttachmentPath.getFullPath(), library.getSourceAttachmentRootPath(), library.isExported());
-
- } else {
- newClasspath[i] = classpath[i];
- }
-
- } else {
- newClasspath[i] = classpath[i];
- }
- // }
-
- // Set the java output folder
- IFolder outputFolder = project.getFolder(getModuleServerRoot(project).getFullPath());
- javaProject.setRawClasspath(newClasspath, outputFolder.getFullPath(), new SubProgressMonitor(progressMonitor, 1));
- }
- // update websettings
- // TODO add to WebArtifactEdit
- // webNature.setModuleServerRootName(webContentName);
- }
- }
-
- /**
- * Moves the web content folder to the name indicated only if that path doesn't already exist in
- * the project.
- *
- * @param project
- * The web project to be updated.
- * @param webContentName
- * The new web content name
- * @param progressMonitor
- * Indicates progress
- * @throws CoreException
- * The exception that occured during move operation
- */
- public static void moveWebContentFolder(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException {
- IPath newPath = new Path(webContentName);
- if (!project.exists(newPath)) {
- if (newPath.segmentCount() > 1) {
- for (int i = newPath.segmentCount() - 1; i > 0; i--) {
- IPath tempPath = newPath.removeLastSegments(i);
- IFolder tempFolder = project.getFolder(tempPath);
- if (!tempFolder.exists()) {
- tempFolder.create(true, true, null);
- }
- }
- }
- newPath = project.getFullPath().append(newPath);
- IContainer webContentRoot = getModuleServerRoot(project);
- IPath oldPath = webContentRoot.getProjectRelativePath();
- webContentRoot.move(newPath, IResource.FORCE | IResource.KEEP_HISTORY, new SubProgressMonitor(progressMonitor, 1));
- for (int i = 0; i < oldPath.segmentCount(); i++) {
- IPath tempPath = oldPath.removeLastSegments(i);
- IFolder tempFolder = project.getFolder(tempPath);
- if (tempFolder.exists() && tempFolder.members().length == 0) {
- tempFolder.delete(true, true, null);
- }
- }
- }
- }
-
- /**
- * Synchonizies the class path and the lib directories to catch any changes from the last use
- * Creation date: (4/17/01 11:48:12 AM)
- */
- protected static void synch(IProject project, IProgressMonitor monitor) {
-
- try {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- monitor.beginTask(ProjectSupportResourceHandler.Sychronize_Class_Path_UI_, 4); //$NON-NLS-1$
- //$NON-NLS-1$ = "Sychronize Class Path"
-
- IContainer lib_folder = getWebLibFolder(project);
- // Nothing to do if the lib folder does not exist.
- if (lib_folder == null || !lib_folder.isAccessible())
- return;
- IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
- IPath lib_path = lib_folder.getProjectRelativePath();
- IPath lib_full_path = lib_folder.getFullPath();
-
- IClasspathEntry[] cp = javaProject.getRawClasspath();
-
- boolean needsToBeModified = false;
- // Create a map of the lib projects in the current project
- Hashtable lib_jars = new Hashtable();
- IResource[] children = lib_folder.members();
- monitor.subTask(ProjectSupportResourceHandler.Catalog_Lib_Directory__UI_); //$NON-NLS-1$
- //$NON-NLS-1$ = "Catalog Lib Directory:"
- for (int j = 0; j < children.length; j++) {
- IResource child = children[j];
- // monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory__UI_") +
- // child); //$NON-NLS-1$ = "Catalog Lib Directory:"
- // Make sure it is a zip or a jar file
- if (child.getType() == IResource.FILE && (child.getFullPath().toString().toLowerCase().endsWith(".jar") //$NON-NLS-1$
- || child.getFullPath().toString().toLowerCase().endsWith(".zip"))) { //$NON-NLS-1$
- lib_jars.put(child.getFullPath(), child);
- }
-
- }
-
- monitor.worked(1);
- monitor.subTask(ProjectSupportResourceHandler.Update_ClassPath__UI_); //$NON-NLS-1$
- //$NON-NLS-1$ = "Update ClassPath:"
- // Loop through all the classpath dirs looking for ones that may have
- // been deleted
- Vector newClassPathVector = new Vector();
- for (int j = 0; j < cp.length; j++) {
-
- // If it is a lib_path
- if (cp[j].getPath().toString().startsWith(lib_path.toString()) || cp[j].getPath().toString().startsWith(lib_full_path.toString())) {
- // It was already in the class path
- if (lib_jars.get(cp[j].getPath()) != null) {
- newClassPathVector.add(cp[j]);
- // Remove it from the hash table of paths to add back
- // monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory__UI_")
- // + cp[j].getPath()); //$NON-NLS-1$ = "Catalog Lib Directory:"
- lib_jars.remove(cp[j].getPath());
-
- } else {
- // You have removed something form the class path you
- // will need to re-build
- // monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory_Remo_UI_")
- // + cp[j].getPath()); //$NON-NLS-1$ = "Catalog Lib Directory:Remove "
- needsToBeModified = true;
- }
- } else {
- monitor.subTask(ProjectSupportResourceHandler.Catalog_Lib_Directory__UI_ + cp[j].getPath()); //$NON-NLS-1$
- //$NON-NLS-1$ = "Catalog Lib Directory:"
- newClassPathVector.add(cp[j]);
- }
- }
- monitor.worked(1);
- monitor.subTask(ProjectSupportResourceHandler.Update_ClassPath__UI_); //$NON-NLS-1$
- //$NON-NLS-1$ = "Update ClassPath:"
-
- // Add any entries not already found
- Enumeration aenum = lib_jars.keys();
- while (aenum.hasMoreElements()) {
- IPath path = (IPath) aenum.nextElement();
- newClassPathVector.add(JavaCore.newLibraryEntry(path, null, null));
- // You have added something form the class path you
- // will need to re-build
- // monitor.setTaskName(ResourceHandler.getString("23concat_UI_", (new Object[] {
- // path }))); //$NON-NLS-1$ = "Catalog Lib Directory:Add {0}"
- needsToBeModified = true;
- }
-
- monitor.worked(1);
- monitor.subTask(ProjectSupportResourceHandler.Set_ClassPath__UI_); //$NON-NLS-1$
- //$NON-NLS-1$ = "Set ClassPath:"
-
- // Tansfer the vector to an array
- IClasspathEntry[] newClassPathArray = new IClasspathEntry[newClassPathVector.size()];
-
- for (int j = 0; j < newClassPathArray.length; j++) {
- newClassPathArray[j] = (IClasspathEntry) newClassPathVector.get(j);
- }
-
- // Only change the class path if there has been a modification
- if (needsToBeModified) {
-
- try {
- javaProject.setRawClasspath(newClassPathArray, monitor);
- } catch (Exception e) {
- Logger.getLogger().log(e);
- }
- }
-
- } catch (ClassCastException ex) {
- Logger.getLogger().log(ex);
- } catch (CoreException ex) {
- Logger.getLogger().log(ex);
- } finally {
- monitor.done();
- }
- }
-
- public static void updateContextRoot(IProject project, String contextRoot) {
- if (project.exists() && project.isOpen()) {
- WebArtifactEdit webEdit = null;
- try {
- // TODO migrate to flex projects
- // webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead(project);
- if (webEdit != null)
- webEdit.setServerContextRoot(contextRoot);
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
-
- }
- }
-
-
- /**
- * @param project
- * org.eclipse.core.resources.IProject
- */
- /**
- * Returns a error message that states whether a context root is valid or not returns null if
- * context root is fine
- *
- * @return java.lang.String
- * @param contextRoot
- * java.lang.String
- */
- public static String validateContextRoot(String contextRoot) {
-
- if (contextRoot == null)
- return null;
-
- String errorMessage = null;
-
- String name = contextRoot;
- if (name.equals("") || name == null) { //$NON-NLS-1$
- // this was added because the error message shouldnt be shown initially. It should be
- // shown only if context root field is edited to
- errorMessage = ProjectSupportResourceHandler.Context_Root_cannot_be_empty_2; //$NON-NLS-1$
- return errorMessage;
- }
-
- /*******************************************************************************************
- * // JZ - fix to defect 204264, "/" is valid in context root if (name.indexOf("//") != -1) {
- * //$NON-NLS-1$ errorMessage = "// are invalid characters in a resource name"; return
- * errorMessage; }
- ******************************************************************************************/
-
- if (name.trim().equals(name)) {
- StringTokenizer stok = new StringTokenizer(name, "."); //$NON-NLS-1$
- outer : while (stok.hasMoreTokens()) {
- String token = stok.nextToken();
- for (int i = 0; i < token.length(); i++) {
- if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-') && !(token.charAt(i) == '/') && Character.isLetterOrDigit(token.charAt(i)) == false) {
- if (Character.isWhitespace(token.charAt(i))) {
- // Removed because context roots can contain white space
- // errorMessage =
- // ResourceHandler.getString("_Context_root_cannot_conta_UI_");//$NON-NLS-1$
- // = " Context root cannot contain whitespaces."
- } else {
- errorMessage = ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.The_character_is_invalid_in_a_context_root, new Object[]{(new Character(token.charAt(i))).toString()}); //$NON-NLS-1$
- break outer;
- }
- }
- }
- }
- } // en/ end of if(name.trim
- else
- errorMessage = ProjectSupportResourceHandler.Names_cannot_begin_or_end_with_whitespace_5; //$NON-NLS-1$
-
- return errorMessage;
- }
-
-
- /**
- * Return true if the string contains any of the characters in the array.
- */
- private static boolean contains(String str, char[] chars) {
- for (int i = 0; i < chars.length; i++) {
- if (str.indexOf(chars[i]) != -1)
- return true;
- }
- return false;
- }
-
-
- public static String validateFolderName(String folderName) {
- if (folderName.length() == 0)
- return ProjectSupportResourceHandler.Folder_name_cannot_be_empty_2; //$NON-NLS-1$
-
- if (contains(folderName, BAD_CHARS))
- return ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Folder_name_is_not_valid, new Object[]{folderName}); //$NON-NLS-1$
-
- return null;
- }
-
-
- public static String validateWebContentName(String webContentName, IProject project, String javaSourceName) {
-
- String msg = validateFolderName(webContentName);
- if (msg != null)
- return msg;
-
- if (javaSourceName != null && webContentName.equals(javaSourceName))
- return ProjectSupportResourceHandler.Folder_names_cannot_be_equal_4; //$NON-NLS-1$
-
- // If given a java project, check to make sure current package fragment
- // root folders do not overlap with new web content name
- if (project != null) {
- IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
- if (javaProject != null) {
- try {
- IPackageFragmentRoot roots[] = javaProject.getPackageFragmentRoots();
- for (int i = 0; i < roots.length; i++) {
- IPackageFragmentRoot root = roots[i];
- if (!root.isArchive()) {
- IResource resource = root.getCorrespondingResource();
- if (resource.getType() == IResource.FOLDER) {
- IPath path = resource.getFullPath();
- String rootFolder = path.segment(1);
- if (webContentName.equals(rootFolder)) {
- if (root.getKind() == IPackageFragmentRoot.K_SOURCE)
- return ProjectSupportResourceHandler.Folder_name_cannot_be_the_same_as_Java_source_folder_5; //$NON-NLS-1$
-
- return ProjectSupportResourceHandler.Folder_name_cannot_be_the_same_as_Java_class_folder_6; //$NON-NLS-1$
- }
- }
- }
- }
- } catch (JavaModelException e) {
- return null;
- }
- }
- }
-
- return null;
- }
-
-
- /**
- * Update given web nature to the current version if necessary.
- *
- * @param webNature
- * The web Nature that should be examined.
- * @return True if successful, false if unnecessary.
- * @throws CoreException
- * The exception that occured during the version change operation.
- */
- /*
- * static public boolean updateNatureToCurrentVersion(J2EEWebNatureRuntime webNature) throws
- * CoreException {
- *
- * boolean success = false;
- *
- * if (webNature.getVersion() != WEB.CURRENT_VERSION) {
- * webNature.setVersion(J2EESettings.CURRENT_VERSION); success = true; }
- * ((J2EEModuleWorkbenchURIConverterImpl)
- * webNature.getResourceSet().getURIConverter()).recomputeContainersIfNecessary();
- *
- * return success; }
- */
-
- /**
- * Move the old source folder to the new default folder.
- *
- * @param project
- * The Web Project we are working with.
- * @param oldSourceFolder
- * The old "Java Source" folder that will be moved.
- * @param javaSourceName
- * The new name of the "Java Source" folder, or null for default.
- * @return The location of the new folder, or null if no move was necessary.
- * @throws CoreException
- * The exception that occured during the move operation.
- */
- static public IContainer updateJavaSourceName(IProject project, IContainer oldSourceFolder, String javaSourceName, IProgressMonitor progressMonitor) throws CoreException {
- IContainer newSourceFolder = null;
- if (oldSourceFolder != null) {
- IPath newPath;
- if (javaSourceName == null)
- newPath = new Path(DEFAULT_JAVA_SOURCE_NAME);
- else
- newPath = new Path(javaSourceName);
-
- // Make sure new path is different form old path
- if (!project.getFolder(newPath).getFullPath().equals(oldSourceFolder.getFullPath())) {
- oldSourceFolder.move(newPath, IResource.FORCE | IResource.KEEP_HISTORY, new SubProgressMonitor(progressMonitor, 1));
- JemProjectUtilities.removeFromJavaClassPath(project, oldSourceFolder);
- newSourceFolder = project.getFolder(newPath);
- JemProjectUtilities.appendJavaClassPath(project, JavaCore.newSourceEntry(project.getFolder(newPath).getFullPath()));
- }
- }
- return newSourceFolder;
- }
-
-
- /**
- * Get the source folder that should be used for migration.
- *
- * @param project
- * The Web Project to examine.
- * @return The source folder to use in migration, or null if it should be skipped.
- */
- static public IContainer getJavaSourceFolder(IProject project) {
- List sourceRoots = JemProjectUtilities.getSourceContainers(project);
- IContainer oldSourceFolder = null;
-
- if (sourceRoots != null) {
- if (sourceRoots.size() == 1) {
- IContainer sourceFolder = (IContainer) sourceRoots.get(0);
- if (sourceFolder instanceof IFolder) {
- oldSourceFolder = sourceFolder;
- }
- }
- }
- return oldSourceFolder;
- }
-
- public static IFolder getModuleServerRoot(IProject project) {
- // TODO need to implement module server root properly
- return project.getFolder("WebContent");
- }
-
- public static IVirtualFolder getWebLibFolder(IVirtualComponent webComponent) {
- IPath path = new Path(J2EEConstants.WEB_INF + "/" + "lib");
- IVirtualFolder libFolder = webComponent.getRootFolder().getFolder(path);
- return libFolder;
- }
-
- //TODO delete jsholl
- /**
- * @deprecated use getWebLibFolder(IVirtualComponent webComponent)
- * @param project
- * @return
- */
- public static IContainer getWebLibFolder(IProject project) {
- return getWebLibFolder(ComponentCore.createComponent(project)).getUnderlyingFolder();
- }
-
- //
- // static public boolean isImportedClassesJARFileInLibDir(IResource resource) {
- // if (resource == null || !resource.exists())
- // return false;
- // return resource.getType() == resource.FILE &&
- // resource.getName().endsWith(IWebNatureConstants.IMPORTED_CLASSES_SUFFIX) && isZip(resource);
- // }
- //
- // static public boolean isLibDirJARFile(IResource resource) {
- // if (resource == null || !resource.exists())
- // return false;
- // return resource.getType() == resource.FILE && isZip(resource);
- // }
- //
- // static public boolean isZip(IResource resource) {
- // String path = resource.getLocation().toOSString();
- // ZipFile zip = null;
- //
- // try {
- // zip = new ZipFile(path);
- // } catch (IOException notAZip) {
- // return false;
- // } finally {
- // if (zip != null) {
- // try {
- // zip.close();
- // } catch (IOException ex) {}
- // }
- // }
- // return zip != null;
- // }
-
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java
deleted file mode 100644
index a6d99c058..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java
+++ /dev/null
@@ -1,99 +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.internal.web.operations;
-
-
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.xml.sax.SAXException;
-
-
-/**
- * The WebToolingException class is the generic class for exceptions generated by the web tooling.
- */
-public class WebToolingException extends Exception {
- public static final String SAX_ERROR_MESSAGE = ProjectSupportResourceHandler.Operation_failed_due_to_SA_ERROR_; //$NON-NLS-1$ = "Operation failed due to SAX error: "
- public static final String IO_ERROR_MESSAGE = ProjectSupportResourceHandler.Operation_failed_due_to_IO_ERROR_; //$NON-NLS-1$ = "Operation failed due to IO error: "
- public static final String CORE_ERROR_MESSAGE = ProjectSupportResourceHandler.Operation_failed_due_to_Co_ERROR_; //$NON-NLS-1$ = "Operation failed due to Core error: "
- public static final String JAVA_MODEL_ERROR_MESSAGE = ProjectSupportResourceHandler.Operation_failed_due_to_Ja_ERROR_; //$NON-NLS-1$ = "Operation failed due to Java Model error: "
-
- /**
- * Create a new WebToolingException with no message.
- */
- public WebToolingException() {
- super();
- }
-
- /**
- * Create a new instance of the receiver for a supplied IO Exception
- *
- * @param message
- * java.lang.String
- */
- public WebToolingException(IOException exception) {
- this(IO_ERROR_MESSAGE, exception);
- }
-
- /**
- * Create a new WebToolingException with error message of s.
- *
- * @param s
- * java.lang.String
- */
- public WebToolingException(String s) {
- super(s);
- }
-
- /**
- * Create a new instance of the receiver with the supplied preamble and the message of the
- * example appended to the end.
- *
- * @param message
- * java.lang.String
- */
- public WebToolingException(String preamble, Throwable exception) {
- this(preamble + exception.getMessage());
- }
-
- /**
- * Create a new instance of the receiver for a supplied CoreException
- *
- * @param exception
- * CoreException
- */
- public WebToolingException(CoreException exception) {
- this(CORE_ERROR_MESSAGE, exception);
- }
-
- /**
- * Create a new instance of the receiver for a supplied JavaModelException.
- *
- * @param exception
- * JavaModelException
- */
- public WebToolingException(JavaModelException exception) {
- this(JAVA_MODEL_ERROR_MESSAGE, exception);
- }
-
- /**
- * Create a new instance of the receiver for a supplied SAX Exception
- *
- * @param exception
- * SAXException
- */
- public WebToolingException(SAXException exception) {
- this(SAX_ERROR_MESSAGE, exception);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java
deleted file mode 100644
index 7c9f60725..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 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.internal.web.operations;
-
-public interface WebToolingTemplate {
- /**
- * Insert the method's description here. Creation date: (12/6/2000 7:35:38 PM)
- *
- * @param data
- * TemplateData
- */
- public String generate(TemplateData data);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java
deleted file mode 100644
index be022f87c..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java
+++ /dev/null
@@ -1,42 +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.internal.web.util;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.jst.j2ee.webapplication.Servlet;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class WebArtifactEditUtilities {
-
- public static IVirtualComponent getWebComponent(Servlet servlet) {
- IProject project = ProjectUtilities.getProject(servlet);
- IVirtualComponent component = ComponentCore.createComponent(project);
- WebArtifactEdit edit = null;
- try {
- if (J2EEProjectUtilities.isDynamicWebProject(project)) {
- edit = WebArtifactEdit.getWebArtifactEditForRead(component);
- WebApp webapp = edit.getWebApp();
- if (webapp.getServletNamed(servlet.getServletName()) != null)
- return component;
- }
- } finally {
- if (edit != null)
- edit.dispose();
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java
deleted file mode 100644
index d954a9ce8..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java
+++ /dev/null
@@ -1,51 +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.internal.web.util;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-
-
-/**
- * <p>
- * Adapts {@see org.eclipse.wst.common.modulecore.ArtifactEditModel}s to
- * {@see org.eclipse.jst.j2ee.internal.web.util.WebArtifactEdit}&nbsp; facades.
- * </p>
- */
-public class WebEditAdapterFactory implements IAdapterFactory {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType == WebArtifactEdit.ADAPTER_TYPE || adapterType == ArtifactEdit.ADAPTER_TYPE) {
- ArtifactEditModel editModel = (ArtifactEditModel) adaptableObject;
- if (J2EEProjectUtilities.isDynamicWebProject(editModel.getProject()))
- return new WebArtifactEdit((ArtifactEditModel) adaptableObject);
- }
- return null;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- return new Class[]{ArtifactEdit.class, WebArtifactEdit.class};
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/WebArtifactEdit.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/WebArtifactEdit.java
deleted file mode 100644
index ad3605197..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/WebArtifactEdit.java
+++ /dev/null
@@ -1,651 +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.web.componentcore.util;
-
-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.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
-import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.componentcore.EnterpriseBinaryComponentHelper;
-import org.eclipse.jst.j2ee.internal.componentcore.WebBinaryComponentHelper;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentLoadStrategyImpl;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.j2ee.webapplication.WebAppResource;
-import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
-import org.eclipse.jst.j2ee.webapplication.WelcomeFile;
-import org.eclipse.jst.j2ee.webapplication.WelcomeFileList;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.UnresolveableURIException;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-import org.eclipse.wst.common.componentcore.internal.BinaryComponentHelper;
-import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
-import org.eclipse.wst.common.componentcore.internal.util.IArtifactEditFactory;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-
-
-
-/**
- * <p>
- * WebArtifactEdit obtains a Web Deployment Descriptor metamodel specifec data from a
- * {@see org.eclipse.jst.j2ee.webapplication.WebAppResource}&nbsp; which stores the metamodel. The
- * {@see org.eclipse.jst.j2ee.webapplication.WebAppResource}&nbsp;is retrieved from the
- * {@see org.eclipse.wst.common.modulecore.ArtifactEditModel}&nbsp;using a constant {@see
- * J2EEConstants#WEBAPP_DD_URI_OBJ}. The defined methods extract data or manipulate the contents of
- * the underlying resource.
- * </p>
- *
- */
-public class WebArtifactEdit extends EnterpriseArtifactEdit implements IArtifactEditFactory {
-
- /**
- * <p>
- * Identifier used to link WebArtifactEdit to a WebEditAdapterFactory {@see
- * WebEditAdapterFactory} stored in an AdapterManger (@see AdapterManager)
- * </p>
- */
- public static final Class ADAPTER_TYPE = WebArtifactEdit.class;
- public static final String WEB_CONTENT = "WebContent"; //$NON-NLS-1$
- public static final String WEB_INF = "WEB-INF"; //$NON-NLS-1$
- public static final String META_INF = "META-INF"; //$NON-NLS-1$
-
- public static IPath WEBLIB = new Path("/WEB-INF/lib"); //$NON-NLS-1$
-
- /**
- *
- */
- public WebArtifactEdit() {
- super();
- }
-
- public WebArtifactEdit(IVirtualComponent aModule) {
- super(aModule);
- }
-
- protected BinaryComponentHelper initBinaryComponentHelper(IVirtualComponent binaryModule) {
- return new WebBinaryComponentHelper(binaryModule);
- }
-
- /**
- * @param aHandle
- * @param toAccessAsReadOnly
- * @throws IllegalArgumentException
- */
- public WebArtifactEdit(IProject aProject, boolean toAccessAsReadOnly) throws IllegalArgumentException {
- super(aProject, toAccessAsReadOnly);
- }
-
- /**
- * @param aHandle
- * @param toAccessAsReadOnly
- * @throws IllegalArgumentException
- */
- public WebArtifactEdit(IProject aProject, boolean toAccessAsReadOnly, boolean forCreate) throws IllegalArgumentException {
- super(aProject, toAccessAsReadOnly, forCreate, J2EEProjectUtilities.DYNAMIC_WEB);
- }
-
- /**
- * @param aHandle
- * @param toAccessAsReadOnly
- * @throws IllegalArgumentException
- */
- protected WebArtifactEdit(IProject aProject, boolean toAccessAsReadOnly, boolean forCreate, String editModelID) throws IllegalArgumentException {
- super(aProject, toAccessAsReadOnly, forCreate, editModelID);
- }
-
- /**
- * <p>
- * Returns an instance facade to manage the underlying edit model for the given
- * {@see WorkbenchComponent}. Instances of ArtifactEdit that are returned through this method
- * must be {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Use to acquire an ArtifactEdit facade for a specific {@see WorkbenchComponent}&nbsp;that
- * will not be used for editing. Invocations of any save*() API on an instance returned from
- * this method will throw exceptions.
- * </p>
- * <p>
- * <b>The following method may return null. </b>
- * </p>
- *
- * @param aModule
- * A valid {@see WorkbenchComponent}&nbsp;with a handle that resolves to an
- * accessible project in the workspace
- * @return An instance of ArtifactEdit that may only be used to read the underlying content
- * model
- */
- public static WebArtifactEdit getWebArtifactEditForRead(IProject aProject) {
- WebArtifactEdit artifactEdit = null;
- try {
- if (isValidWebModule(ComponentCore.createComponent(aProject)))
- artifactEdit = new WebArtifactEdit(aProject, true, false);
- } catch (Exception e) {
- artifactEdit = null;
- }
- return artifactEdit;
- }
-
- /**
- * <p>
- * Returns an instance facade to manage the underlying edit model for the given
- * {@see WorkbenchComponent}. Instances of ArtifactEdit that are returned through this method
- * must be {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Use to acquire an ArtifactEdit facade for a specific {@see WorkbenchComponent}&nbsp;that
- * will be used for editing.
- * </p>
- * <p>
- * <b>The following method may return null. </b>
- * </p>
- *
- * @param aModule
- * A valid {@see WorkbenchComponent}&nbsp;with a handle that resolves to an
- * accessible project in the workspace
- * @return An instance of ArtifactEdit that may be used to modify and persist changes to the
- * underlying content model
- */
- public static WebArtifactEdit getWebArtifactEditForWrite(IProject aProject) {
- WebArtifactEdit artifactEdit = null;
- try {
- if (isValidWebModule(ComponentCore.createComponent(aProject)))
- artifactEdit = new WebArtifactEdit(aProject, false, false);
- } catch (Exception e) {
- artifactEdit = null;
- }
- return artifactEdit;
- }
-
- /**
- * <p>
- * Returns an instance facade to manage the underlying edit model for the given
- * {@see WorkbenchComponent}. Instances of WebArtifactEdit that are returned through this
- * method must be {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Use to acquire an WebArtifactEdit facade for a specific {@see WorkbenchComponent}&nbsp;that
- * will not be used for editing. Invocations of any save*() API on an instance returned from
- * this method will throw exceptions.
- * </p>
- * <p>
- * <b>This method may return null. </b>
- * </p>
- *
- * <p>
- * Note: This method is for internal use only. Clients should not call this method.
- * </p>
- *
- * @param aModule
- * A valid {@see WorkbenchComponent}&nbsp;with a handle that resolves to an
- * accessible project in the workspace
- * @return An instance of WebArtifactEdit that may only be used to read the underlying content
- * model
- * @throws UnresolveableURIException
- * could not resolve uri.
- */
- public static WebArtifactEdit getWebArtifactEditForRead(IVirtualComponent aModule) {
- if (aModule == null)
- return null;
- if (aModule.isBinary()) {
- return new WebArtifactEdit(aModule);
- }
-
- return getWebArtifactEditForRead(aModule.getProject());
- }
-
-
- /**
- * <p>
- * Returns an instance facade to manage the underlying edit model for the given
- * {@see WorkbenchComponent}. Instances of WebArtifactEdit that are returned through this
- * method must be {@see #dispose()}ed of when no longer in use.
- * </p>
- * <p>
- * Use to acquire an WebArtifactEdit facade for a specific {@see WorkbenchComponent}&nbsp;that
- * will be used for editing.
- * </p>
- * <p>
- * <b>This method may return null. </b>
- * </p>
- *
- * <p>
- * Note: This method is for internal use only. Clients should not call this method.
- * </p>
- *
- * @param aModule
- * A valid {@see WorkbenchComponent}&nbsp;with a handle that resolves to an
- * accessible project in the workspace
- * @return An instance of WebArtifactEdit that may be used to modify and persist changes to the
- * underlying content model
- */
- public static WebArtifactEdit getWebArtifactEditForWrite(IVirtualComponent aModule) {
- if (aModule == null || aModule.isBinary())
- return null;
- return getWebArtifactEditForWrite(aModule.getProject());
- }
-
- /**
- * @param module
- * A {@see WorkbenchComponent}
- * @return True if the supplied module
- * {@see ArtifactEdit#isValidEditableModule(WorkbenchComponent)}and the moduleTypeId is
- * a JST module
- */
- public static boolean isValidWebModule(IVirtualComponent aModule) throws UnresolveableURIException {
- if (!isValidEditableModule(aModule))
- return false;
- return J2EEProjectUtilities.isDynamicWebProject(aModule.getProject());
- }
-
- /**
- * <p>
- * Creates an instance facade for the given {@see ArtifactEditModel}.
- * </p>
- *
- * @param anArtifactEditModel
- */
- public WebArtifactEdit(ArtifactEditModel model) {
- super(model);
-
- }
-
- /**
- * <p>
- * Creates an instance facade for the given {@see ArtifactEditModel}
- * </p>
- *
- * <p>
- * Note: This method is for internal use only. Clients should not call this method.
- * </p>
- *
- * @param aNature
- * A non-null {@see ModuleCoreNature}for an accessible project
- * @param aModule
- * A non-null {@see WorkbenchComponent}pointing to a module from the given
- * {@see ModuleCoreNature}
- */
- protected WebArtifactEdit(ModuleCoreNature aNature, IVirtualComponent aModule, boolean toAccessAsReadOnly) {
- super(aNature, aModule, toAccessAsReadOnly);
- }
-
-
-
- /**
- * <p>
- * Retrieves J2EE version information from WebAppResource.
- * </p>
- *
- * @return an integer representation of a J2EE Spec version
- *
- */
- public int getJ2EEVersion() {
- return ((WebAppResource) getDeploymentDescriptorResource()).getJ2EEVersionID();
- }
-
- /**
- * <p>
- * Obtains the WebApp (@see WebApp) root object from the WebAppResource. If the root object does
- * not exist, then one is created (@link addWebAppIfNecessary(getWebApplicationXmiResource())).
- * The root object contains all other resource defined objects.
- * </p>
- *
- * @return EObject
- *
- */
- public EObject getDeploymentDescriptorRoot() {
- List contents = getDeploymentDescriptorResource().getContents();
- if (contents.size() > 0)
- return (EObject) contents.get(0);
- if (isBinary()) {
- return null;
- }
- addWebAppIfNecessary((WebAppResource) getDeploymentDescriptorResource());
- return (EObject) contents.get(0);
- }
-
- /**
- * <p>
- * Retrieves the underlying resource from the ArtifactEditModel using defined URI.
- * </p>
- *
- * @return Resource
- *
- */
- public Resource getDeploymentDescriptorResource() {
- if (isBinary()) {
- return getBinaryComponentHelper().getResource(J2EEConstants.WEBAPP_DD_URI_OBJ);
- }
- return getArtifactEditModel().getResource(J2EEConstants.WEBAPP_DD_URI_OBJ);
- }
-
- /**
- * <p>
- * Retrieves Servlet version information derived from the {@see WebAppResource}.
- * </p>
- *
- * @return an integer representation of a module version
- *
- */
- public int getServletVersion() {
- return ((WebAppResource) getDeploymentDescriptorResource()).getModuleVersionID();
- }
-
- /**
- * This method returns the integer representation for the JSP specification level associated
- * with the J2EE version for this workbench module. This method will not return null and returns
- * 20 as default.
- *
- * @see WebArtifactEdit#getServletVersion()
- *
- * @return an integer representation of the JSP level
- */
- public int getJSPVersion() {
- int servletVersion = getServletVersion();
- if (servletVersion == J2EEVersionConstants.WEB_2_2_ID)
- return J2EEVersionConstants.JSP_1_1_ID;
- else if (servletVersion == J2EEVersionConstants.WEB_2_3_ID)
- return J2EEVersionConstants.JSP_1_2_ID;
- else
- return J2EEVersionConstants.JSP_2_0_ID;
- }
-
- /**
- * <p>
- * Creates a deployment descriptor root object (WebApp) and populates with data. Adds the root
- * object to the deployment descriptor resource.
- * </p>
- *
- * <p>
- *
- * @param aModule
- * A non-null pointing to a {@see XMLResource}
- * @param version
- * Version to be set on resource....if null default is taken
- *
- * Note: This method is typically used for JUNIT - move?
- * </p>
- */
- protected void addWebAppIfNecessary(XMLResource aResource) {
- if (isBinary()) {
- throwAttemptedBinaryEditModelAccess();
- }
- if (aResource != null) {
- if (aResource.getContents() == null || aResource.getContents().isEmpty()) {
- WebApp webAppNew = WebapplicationFactory.eINSTANCE.createWebApp();
- aResource.getContents().add(webAppNew);
- aResource.setModified(true);
- }
- WebApp webApp = (WebApp) aResource.getContents().get(0);
- URI moduleURI = getArtifactEditModel().getModuleURI();
- try {
- webApp.setDisplayName(StructureEdit.getDeployedName(moduleURI));
- } catch (UnresolveableURIException e) {
- // Ignore
- }
- aResource.setID(webApp, J2EEConstants.WEBAPP_ID);
-
- WelcomeFileList wList = WebapplicationFactory.eINSTANCE.createWelcomeFileList();
- List files = wList.getFile();
- WelcomeFile file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("index.html"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("index.htm"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("index.jsp"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("default.html"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("default.htm"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("default.jsp"); //$NON-NLS-1$
- files.add(file);
-
- webApp.setFileList(wList);
-
- try {
- aResource.saveIfNecessary();
- } catch (java.net.ConnectException ex) {
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
-
- /**
- * This method returns the full path to the deployment descriptor resource for the associated
- * workbench module. This method may return null.
- *
- * @see WebArtifactEdit#getDeploymentDescriptorResource()
- *
- * @return the full IPath for the deployment descriptor resource
- */
- public IPath getDeploymentDescriptorPath() {
- IFile file = WorkbenchResourceHelper.getFile(getDeploymentDescriptorResource());
- if (file != null)
- return file.getFullPath();
- return null;
- }
-
- /**
- * This method will retrieve the web app resource, create it if necessary, add get the root
- * object, the web app out of that web app resource. It will create the web app instance if need
- * be, and add it to the web resource. Then, it returns the web app object as the model root.
- * This method will not return null.
- *
- * @see EnterpriseArtifactEdit#createModelRoot()
- *
- * @return the eObject instance of the model root
- */
- public EObject createModelRoot() {
- if (isBinary()) {
- throwAttemptedBinaryEditModelAccess();
- }
- return createModelRoot(getJ2EEVersion());
- }
-
- /**
- * This method will retrieve the web app resource, create it if necessary, add get the root
- * object, set version the web app out of that web app resource. It will create the web app
- * instance if need be, and add it to the web resource. Then, it returns the web app object as
- * the model root. This method will not return null.
- *
- * @see EnterpriseArtifactEdit#createModelRoot()
- *
- * @return the eObject instance of the model root
- */
- public EObject createModelRoot(int version) {
- if (isBinary()) {
- throwAttemptedBinaryEditModelAccess();
- }
- WebAppResource res = (WebAppResource) getDeploymentDescriptorResource();
- res.setModuleVersionID(version);
- addWebAppIfNecessary(res);
- return res.getRootObject();
- }
-
- /**
- * This method will return the list of dependent modules which are utility jars in the web lib
- * folder of the deployed path of the module. It will not return null.
- *
- * @return array of the web library dependent modules
- */
- public IVirtualReference[] getLibModules() {
- List result = new ArrayList();
- IVirtualComponent comp = ComponentCore.createComponent(getProject());
- IVirtualReference[] refComponents = comp.getReferences();
- // Check the deployed path to make sure it has a lib parent folder and matchs the web.xml
- // base path
- for (int i = 0; i < refComponents.length; i++) {
- if (refComponents[i].getRuntimePath().equals(WEBLIB))
- result.add(refComponents[i]);
- }
-
- return (IVirtualReference[]) result.toArray(new IVirtualReference[result.size()]);
- }
-
- /**
- * This method will add the dependent modules from the passed in array to the dependentmodules
- * list of the associated workbench module. It will ensure a null is not passed and it will
- * ensure the dependent modules are not already in the list.
- *
- * <p>
- * Note: This method is for internal use only. Clients should not call this method.
- * </p>
- *
- * @param libModules
- * array of dependent modules to add as web libraries
- */
- public void addLibModules(ReferencedComponent[] libModules) {
- // TODO - Need to implement
- // if (libModules==null)
- // return;
- // for (int i=0; i<libModules.length; i++) {
- // if (!module.getReferencedComponents().contains(libModules[i]))
- // module.getReferencedComponents().add(libModules[i]);
- // }
- }
-
- /**
- * This method will retrieve the context root for this web project's .component file. It is
- * meant to handle a standalone web case.
- *
- * @return contextRoot String
- */
- public String getServerContextRoot() {
- return J2EEProjectUtilities.getServerContextRoot(getProject());
- }
-
- /**
- * This method will retrieve the context root for this web project in the associated parameter's
- * application.xml. If the earProject is null, then the contextRoot from the .component of the
- * web project is returned.
- *
- * @param earProject
- * @return contextRoot String
- */
- public String getServerContextRoot(IProject earProject) {
- if (earProject == null || !J2EEProjectUtilities.isEARProject(earProject))
- return getServerContextRoot();
- EARArtifactEdit earEdit = null;
- String contextRoot = null;
- try {
- earEdit = EARArtifactEdit.getEARArtifactEditForRead(earProject);
- if (earEdit != null)
- contextRoot = earEdit.getWebContextRoot(getProject());
- } finally {
- if (earEdit != null)
- earEdit.dispose();
- }
- return contextRoot;
- }
-
- /**
- * This method will update the context root for this web project on the EAR which is passed in.
- * If no EAR is passed the .component file for the web project will be updated.
- *
- * @param earProject
- * @param aContextRoot
- */
- public void setServerContextRoot(IProject earProject, String aContextRoot) {
- if (earProject == null || !J2EEProjectUtilities.isEARProject(earProject))
- setServerContextRoot(aContextRoot);
- EARArtifactEdit earEdit = null;
- try {
- earEdit = EARArtifactEdit.getEARArtifactEditForWrite(earProject);
- if (earEdit != null)
- earEdit.setWebContextRoot(getProject(), aContextRoot);
- } finally {
- if (earEdit != null) {
- earEdit.saveIfNecessary(new NullProgressMonitor());
- earEdit.dispose();
- }
- }
- }
-
- /**
- * This method sets the context root property on the web project's .component file for the
- * standalone case.
- *
- * @param contextRoot
- * string
- */
- public void setServerContextRoot(String contextRoot) {
- J2EEProjectUtilities.setServerContextRoot(getProject(), contextRoot);
- }
-
-
- /**
- * @return WebApp
- */
- public WebApp getWebApp() {
-
- return (WebApp) getDeploymentDescriptorRoot();
- }
-
-
- public ArtifactEdit createArtifactEditForRead(IVirtualComponent aComponent) {
- return getWebArtifactEditForRead(aComponent);
- }
-
-
- public ArtifactEdit createArtifactEditForWrite(IVirtualComponent aComponent) {
- return getWebArtifactEditForWrite(aComponent);
- }
-
- public Archive asArchive(boolean includeSource) throws OpenFailureException {
- if (isBinary()) {
- return ((EnterpriseBinaryComponentHelper) getBinaryComponentHelper()).accessArchive();
- } else {
- WebComponentLoadStrategyImpl loader = new WebComponentLoadStrategyImpl(getComponent());
- loader.setExportSource(includeSource);
- String uri = ModuleURIUtil.getHandleString(getComponent());
- return CommonarchiveFactory.eINSTANCE.openWARFile(loader, uri);
- }
- }
-
- public static void createDeploymentDescriptor(IProject project, int version) {
- WebArtifactEdit webEdit = new WebArtifactEdit(project, false, true);
- try {
- webEdit.createModelRoot(version);
- webEdit.save(null);
- } finally {
- webEdit.dispose();
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/package.xml b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/package.xml
deleted file mode 100644
index 6a17c4ece..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/package.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
- <head>
- <meta
- name="root"
- content="../../../../../../../" />
- <title>WebArtifactEdit api overview</title>
- </head>
-
- <body>
- <abstract>
- This package includes the WebArtifactEdit api. This api is used to work with the emf model
- of a flexible web module. It contains api to read and serialize out the emf model for web applications.
- </abstract>
-
- <a href="#top">top</a>
- </body>
-</html>
- \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentCreationDataModelProperties.java
deleted file mode 100644
index 732eb1837..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentCreationDataModelProperties.java
+++ /dev/null
@@ -1,54 +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.web.datamodel.properties;
-/**
- * <p>
- * IWebComponentCreationDataModelProperties provides properties to the
- * WebComponentCreationDataModelProvider as well as all extending interfaces extending
- * IWebComponentCreationDataModelProperties
- * @see org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentCreationDataModelProvider
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- * @see org.eclipse.wst.common.frameworks.datamodel.DataModelFactory
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties
- * @see org.eclipse.jst.j2ee.datamodel.properties.IJavaComponentCreationDataModelProperties
- * @see org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties
- * @plannedfor 1.0
- */
-import org.eclipse.jst.j2ee.datamodel.properties.IAddWebComponentToEnterpriseApplicationDataModelProperties;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentCreationDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
-import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-
-/**
- * This has been slated for removal post WTP 1.5. Do not use this class/interface
- *
- * @deprecated
- *
- * @see IWebFacetInstallDataModelProperties
- */
-public interface IWebComponentCreationDataModelProperties extends IJ2EEComponentCreationDataModelProperties, DoNotUseMeThisWillBeDeletedPost15 {
-
- /**
- * Required, type String, the user defined name of the context root for the web component
- */
- public static final String CONTEXT_ROOT = IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT;
-
- /**
- * Optional, type String, the user defined name of web contents folder
- */
- public static final String WEBCONTENT_FOLDER = "IWebComponentCreationDataModelProperties.WEBCONTENT_FOLDER";
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentExportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentExportDataModelProperties.java
deleted file mode 100644
index 129150da3..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentExportDataModelProperties.java
+++ /dev/null
@@ -1,37 +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.web.datamodel.properties;
-
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
-/**
- * <p>
- * IWebComponentExportDataModelProperties provides properties to the IDataModel associated with the
- * WebComponentExportDataModelProvider.
- * NOTE: The associated Provider and Operations will be created during M5
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- * @see org.eclipse.wst.common.frameworks.datamodel.DataModelFactory
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties
- *
- * @plannedfor 1.0
- */
-public interface IWebComponentExportDataModelProperties extends IJ2EEComponentExportDataModelProperties {
- /**
- * Required, type Boolean flag which indicates whether or not to export compiled JSP files
- * (compiled files exist in /WEB-INF/classes as .class and .java[for debug])
- */
- public static final String EXCLUDE_COMPILE_JSP = "WebExportDataModel.EXCLUDE_COMPILE_JSP"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentImportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentImportDataModelProperties.java
deleted file mode 100644
index 1d51fc1a3..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentImportDataModelProperties.java
+++ /dev/null
@@ -1,58 +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.web.datamodel.properties;
-
-import java.util.List;
-
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEModuleImportDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * <p>
- * IWebComponentImportDataModelProperties provides properties to the IDataModel associated with the
- * WebComponentImportDataModelProvider. NOTE: The associated Provider and Operations will be created
- * during M5
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
- * @see org.eclipse.wst.common.frameworks.datamodel.DataModelFactory
- * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties
- *
- * @plannedfor 1.0
- */
-public interface IWebComponentImportDataModelProperties extends IJ2EEModuleImportDataModelProperties {
-
- /**
- * <p>
- * This optional {@link List} property is used to specify which nested web libraries should be
- * expanded into projects during import. The contents of this {@link List} property should be
- * {@link Archive}s.
- * </p>
- */
- public static final String WEB_LIB_ARCHIVES_SELECTED = "WARImportDataModel.WEB_LIB_ARCHIVES_SELECTED"; //$NON-NLS-1$
-
- /**
- * <p>
- * This {@link List} property should not be set by clients. This list contains the
- * {@link IDataModel}s for creating the new components to be created for each of the selected
- * archives. This list will contain one entry for each web lib archive regardless of whether it
- * is selected for import by the {@link #WEB_LIB_ARCHIVES_SELECTED} property.
- * </p>
- */
- public static final String WEB_LIB_MODELS = "WARImportDataModel.WEB_LIB_MODELS"; //$NON-NLS-1$
-
- public static final String CONTEXT_ROOT = "IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/package.xml b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/package.xml
deleted file mode 100644
index bc7e674b8..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/package.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
- <head>
- <meta
- name="root"
- content="../../../../../../../" />
- <title>web module data model api overview</title>
- </head>
-
- <body>
- <abstract>
- This package includes the api to create, import and export web modules. The interfaces in this package
- define the properties that can be set on the web modules data models that are use to run the data model operations and drive the wizard data, validation.
- </abstract>
-
- <a href="#top">top</a>
- </body>
-</html>
- \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java
deleted file mode 100644
index f779cb839..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java
+++ /dev/null
@@ -1,24 +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.web.project.facet;
-
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-
-
-
-public interface IWebFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties {
-
-
- public static final String CONTEXT_ROOT = "IWebFacetInstallDataModelProperties.CONTEXT_ROOT"; //$NON-NLS-1$
-
- public static final String SOURCE_FOLDER = "IWebFacetInstallDataModelProperties.SOURCE_FOLDER"; //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java
deleted file mode 100644
index 9e33506e6..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,111 +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.web.project.facet;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
-import org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-
-import com.ibm.icu.util.StringTokenizer;
-
-public class WebFacetInstallDataModelProvider extends J2EEModuleFacetInstallDataModelProvider implements IWebFacetInstallDataModelProperties {
-
- public Set getPropertyNames() {
- Set names = super.getPropertyNames();
- names.add(CONTEXT_ROOT);
- names.add(SOURCE_FOLDER);
- return names;
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(CONFIG_FOLDER)) {
- return ProductManager.getProperty(IProductConstants.WEB_CONTENT_FOLDER);
- } else if (propertyName.equals(SOURCE_FOLDER)) {
- return "src"; //$NON-NLS-1$
- } else if (propertyName.equals(CONTEXT_ROOT)) {
- return getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
- } else if (propertyName.equals(FACET_ID)) {
- return J2EEProjectUtilities.DYNAMIC_WEB;
- } else if (propertyName.equals(MODULE_URI)) {
- String projectName = model.getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
- return projectName + IJ2EEModuleConstants.WAR_EXT;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- if (ADD_TO_EAR.equals(propertyName)) {
- model.notifyPropertyChange(CONTEXT_ROOT, IDataModel.ENABLE_CHG);
- } else if (FACET_PROJECT_NAME.equals(propertyName)) {
- model.notifyPropertyChange(CONTEXT_ROOT, IDataModel.VALID_VALUES_CHG);
- } else if (propertyName.equals(CONFIG_FOLDER)) {
- return true;
- } else if (propertyName.equals(SOURCE_FOLDER)) {
- IDataModel masterModel = (IDataModel) model.getProperty(MASTER_PROJECT_DM);
- if (masterModel != null) {
- FacetDataModelMap map = (FacetDataModelMap) masterModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel javaModel = map.getFacetDataModel(IModuleConstants.JST_JAVA);
- if (javaModel != null)
- javaModel.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, propertyValue);
- }
- }
- return super.propertySet(propertyName, propertyValue);
- }
-
- public boolean isPropertyEnabled(String propertyName) {
- return super.isPropertyEnabled(propertyName);
- }
-
- protected int convertFacetVersionToJ2EEVersion(IProjectFacetVersion version) {
- return J2EEVersionUtil.convertWebVersionStringToJ2EEVersionID(version.getVersionString());
- }
-
- public IStatus validate(String name) {
- if (name.equals(CONTEXT_ROOT)) {
- return validateContextRoot(getStringProperty(CONTEXT_ROOT));
- }
- return super.validate(name);
- }
-
- protected IStatus validateContextRoot(String contextRoot) {
- if (contextRoot == null) {
- return J2EEPlugin.newErrorStatus(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Context_Root_cannot_be_empty_2, new Object[]{contextRoot}), null);
- } else if (contextRoot.trim().equals(contextRoot)) {
- StringTokenizer stok = new StringTokenizer(contextRoot, "."); //$NON-NLS-1$
- while (stok.hasMoreTokens()) {
- String token = stok.nextToken();
- for (int i = 0; i < token.length(); i++) {
- if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-') && !(token.charAt(i) == '/') && Character.isLetterOrDigit(token.charAt(i)) == false) {
- Object[] invalidChar = new Object[]{(new Character(token.charAt(i))).toString()};
- String errorStatus = ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.The_character_is_invalid_in_a_context_root, invalidChar); //$NON-NLS-1$
- return J2EEPlugin.newErrorStatus(errorStatus, null);
- }
- }
- }
- } else
- return J2EEPlugin.newErrorStatus(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Names_cannot_begin_or_end_with_whitespace_5, new Object[]{contextRoot}), null); //$NON-NLS-1$
- return OK_STATUS;
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java
deleted file mode 100644
index 60473cfc5..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java
+++ /dev/null
@@ -1,198 +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.web.project.facet;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.web.classpath.WebAppLibrariesContainer;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.J2EEFacetInstallDelegate;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-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.IVirtualFile;
-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;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-
-public final class WebFacetInstallDelegate 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;
-
- final IJavaProject jproj = JavaCore.create(project);
-
- // Add WTP natures.
-
- WtpUtils.addNatures(project);
-
- // Create the directory structure.
-
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- final IPath pjpath = project.getFullPath();
-
- final IPath contentdir = setContentPropertyIfNeeded(model, pjpath, project);
- mkdirs(ws.getRoot().getFolder(contentdir));
-
- final IPath webinf = contentdir.append("WEB-INF"); //$NON-NLS-1$
- IFolder webinfFolder = ws.getRoot().getFolder(webinf);
- mkdirs(webinfFolder);
-
- final IPath webinflib = webinf.append("lib"); //$NON-NLS-1$
- mkdirs(ws.getRoot().getFolder(webinflib));
-
- // Setup the flexible project structure.
-
- final IVirtualComponent c = ComponentCore.createComponent(project);
-
- c.create(0, null);
-
- String contextRoot = model.getStringProperty(IWebFacetInstallDataModelProperties.CONTEXT_ROOT);
- setContextRootPropertyIfNeeded(c, contextRoot);
- setJavaOutputPropertyIfNeeded(c);
-
- final IVirtualFolder webroot = c.getRootFolder();
- if (webroot.getProjectRelativePath().equals(new Path("/"))) //$NON-NLS-1$
- webroot.createLink(new Path("/" + model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)), 0, null); //$NON-NLS-1$
-
- // Create the deployment descriptor (web.xml) if one doesn't exist
- if (!webinfFolder.getFile("web.xml").exists()) { //$NON-NLS-1$
- String ver = fv.getVersionString();
- int nVer = J2EEVersionUtil.convertVersionStringToInt(ver);
- WebArtifactEdit.createDeploymentDescriptor(project, nVer);
- }
-
- // Set entries for src folders
- final IVirtualFolder jsrc = c.getRootFolder().getFolder("/WEB-INF/classes"); //$NON-NLS-1$
- final IClasspathEntry[] cp = jproj.getRawClasspath();
- for (int i = 0; i < cp.length; i++) {
- final IClasspathEntry cpe = cp[i];
- if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- if( cpe.getPath().removeFirstSegments(1).segmentCount() > 0 )
- jsrc.createLink(cpe.getPath().removeFirstSegments(1), 0, null);
- }
- }
-
- IVirtualFile vf = c.getRootFolder().getFile(new Path(J2EEConstants.MANIFEST_URI));
- IFile manifestmf = vf.getUnderlyingFile();
- if (manifestmf == null || !manifestmf.exists()) {
- try {
- createManifest(project, c.getRootFolder().getUnderlyingFolder(), monitor);
- } catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
- } catch (InterruptedException e) {
- Logger.getLogger().logError(e);
- }
- }
-
- // Setup the classpath.
-
- ClasspathHelper.removeClasspathEntries(project, fv);
-
- if (!ClasspathHelper.addClasspathEntries(project, fv)) {
- // TODO: Support the no runtime case.
- // ClasspathHelper.addClasspathEntries( project, fv, <something> );
- }
-
- // Add the web libraries container.
-
- final IPath webLibContainer = new Path(WebAppLibrariesContainer.CONTAINER_ID);
- addToClasspath(jproj, JavaCore.newContainerEntry(webLibContainer));
-
- try {
- ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
- } catch (ExecutionException e) {
- Logger.getLogger().logError(e);
- }
-
- if (monitor != null) {
- monitor.worked(1);
- }
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- }
-
- private void setJavaOutputPropertyIfNeeded(final IVirtualComponent c) {
- String existing = c.getMetaProperties().getProperty("java-output-path"); //$NON-NLS-1$
- if (existing == null)
- c.setMetaProperty("java-output-path", ProductManager.getProperty(IProductConstants.OUTPUT_FOLDER)); //$NON-NLS-1$
- }
-
- private void setContextRootPropertyIfNeeded(final IVirtualComponent c, String contextRoot) {
- String existing = c.getMetaProperties().getProperty("context-root"); //$NON-NLS-1$
- if (existing == null)
- c.setMetaProperty("context-root", contextRoot); //$NON-NLS-1$
- }
-
-// private IPath setSourcePropertyIfNeeded(final IDataModel model, final IPath pjpath, IProject project) {
-// IVirtualComponent c = ComponentCore.createComponent(project);
-// if (c.exists()) {
-// return J2EEProjectUtilities.getSourcePathOrFirst(project, null).makeAbsolute();
-// }
-// return pjpath.append(model.getStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER));
-// }
-
- private IPath setContentPropertyIfNeeded(final IDataModel model, final IPath pjpath, IProject project) {
- IVirtualComponent c = ComponentCore.createComponent(project);
- if (c.exists()) {
- if( !c.getRootFolder().getProjectRelativePath().isRoot() ){
- return c.getRootFolder().getUnderlyingResource().getFullPath();
- }
- }
- return pjpath.append(model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER));
- }
-
- private static void mkdirs(final IFolder folder)
-
- throws CoreException
-
- {
- if (!folder.exists()) {
- if (folder.getParent() instanceof IFolder) {
- mkdirs((IFolder) folder.getParent());
- }
-
- folder.create(true, true, null);
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetPostInstallDelegate.java
deleted file mode 100644
index 357a62355..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetPostInstallDelegate.java
+++ /dev/null
@@ -1,70 +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.web.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.J2EEFacetInstallDelegate;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-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 WebFacetPostInstallDelegate 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;
- final IVirtualComponent c = ComponentCore.createComponent(project);
-
- // Associate with an EAR, if necessary.
- if ( model.getBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR) ) {
- final String earProjectName = model.getStringProperty(
- IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME);
-
- if ( earProjectName != null && !earProjectName.equals("") ) { //$NON-NLS-1$
-
- String ver = fv.getVersionString();
-
- String j2eeVersionText = J2EEVersionUtil.convertVersionIntToString(J2EEVersionUtil.convertWebVersionStringToJ2EEVersionID(ver));
- final String moduleURI = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI);
-
- installAndAddModuletoEAR( j2eeVersionText,
- earProjectName,
- (IRuntime) model.getProperty(IJ2EEFacetInstallDataModelProperties.FACET_RUNTIME),
- project,
- moduleURI,
- monitor );
-
- }
- }
-
- if (monitor != null) {
- monitor.worked(1);
- }
- } finally {
- if (monitor != null) {
- monitor.done();
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetRuntimeChangedDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetRuntimeChangedDelegate.java
deleted file mode 100644
index 8c67966d5..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetRuntimeChangedDelegate.java
+++ /dev/null
@@ -1,67 +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.web.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
-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 WebFacetRuntimeChangedDelegate
-
- 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
- {
- ClasspathHelper.removeClasspathEntries( project, fv );
-
- if( ! ClasspathHelper.addClasspathEntries( project, fv ) )
- {
- // TODO: Support the no runtime case.
- // ClasspathHelper.addClasspathEntries( project, fv, <something> );
- }
-
- if( monitor != null )
- {
- monitor.worked( 1 );
- }
- }
- finally
- {
- if( monitor != null )
- {
- monitor.done();
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetUtils.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetUtils.java
deleted file mode 100644
index bdc91d3c5..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetUtils.java
+++ /dev/null
@@ -1,25 +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.web.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 WebFacetUtils {
-
- public static final IProjectFacet WEB_FACET = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEB_MODULE);
- public static final IProjectFacetVersion WEB_22 = WEB_FACET.getVersion("2.2"); //$NON-NLS-1$
- public static final IProjectFacetVersion WEB_23 = WEB_FACET.getVersion("2.3"); //$NON-NLS-1$
- public static final IProjectFacetVersion WEB_24 = WEB_FACET.getVersion("2.4"); //$NON-NLS-1$
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetVersionChangeDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetVersionChangeDelegate.java
deleted file mode 100644
index aa05f73bd..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetVersionChangeDelegate.java
+++ /dev/null
@@ -1,110 +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.web.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
-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;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class WebFacetVersionChangeDelegate
-
- 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
- {
- // Find the version that's currently installed.
-
- final IFacetedProject fproj
- = ProjectFacetsManager.create( project );
-
- final IProjectFacetVersion oldver
- = fproj.getInstalledVersion( fv.getProjectFacet() );
-
- // Reset the classpath.
-
- ClasspathHelper.removeClasspathEntries( project, oldver );
-
- if( ! ClasspathHelper.addClasspathEntries( project, fv ) )
- {
- // TODO: Support the no runtime case.
- // ClasspathHelper.addClasspathEntries( project, fv, <something> );
- }
-
- // Update the component version.
-
-
- 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();
- }
- }
- }
-
-}

Back to the top