Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web')
-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/WebComponentExportDataModelProvider.java86
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java80
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java190
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java134
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java127
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java106
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java75
-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.properties12
-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.java68
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicDataModelProvider.java39
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicOperation.java114
-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.java585
-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
26 files changed, 0 insertions, 3446 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/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 b85a73195..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.archive.JavaEEArchiveUtilities;
-import org.eclipse.jst.j2ee.internal.archive.operations.AppClientArchiveOpsResourceHandler;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation;
-import org.eclipse.jst.jee.archive.IArchive;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class WebComponentExportOperation extends J2EEArtifactExportOperation {
-
- public WebComponentExportOperation() {
- super();
- }
-
- public WebComponentExportOperation(IDataModel model) {
- super(model);
- }
-
- /**
- * @deprecated this will be removed post 3.1 with bug 268201
- */
- protected void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
- IProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, EXPORT_WORK);
- IArchive archiveFromComponent = null;
- try {
- archiveFromComponent = JavaEEArchiveUtilities.INSTANCE.openArchive(getComponent());
- JavaEEQuickPeek quickPeek = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archiveFromComponent);
- if (quickPeek.getJavaEEVersion() == J2EEConstants.JEE_5_0_ID) {
- saveArchive(archiveFromComponent, getDestinationPath().toOSString(), subMonitor);
- } else {
- CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory();
- WebComponentLoadStrategyImpl ls = new WebComponentLoadStrategyImpl(getComponent());
- ls.setExportSource(isExportSource());
- ls.setReadOnly(true);
- setModuleFile(caf.openWARFile(ls, getDestinationPath().toOSString()));
- getModuleFile().getOptions().setIsReadOnly(true);
- ls.setProgressMonitor(subMonitor);
- getModuleFile().saveAsNoReopen(getDestinationPath().toOSString());
- }
- } catch (SaveFailureException ex) {
- throw ex;
- } catch (Exception e) {
- throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e);
- } finally {
- if (archiveFromComponent != null)
- JavaEEArchiveUtilities.INSTANCE.closeArchive(archiveFromComponent);
-
- subMonitor.done();
- }
- }
-
- /**
- * @deprecated this will be removed post 3.1 with bug 268201
- */
- 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 abd26d3f7..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.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.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-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.project.facet.IJ2EEFacetConstants;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
-import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
-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.DataModelEvent;
-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 void handleUnknownType(JavaEEQuickPeek jqp) {
- jqp.setType(J2EEVersionConstants.WEB_TYPE);
- jqp.setVersion(J2EEVersionConstants.WEB_2_5_ID);
- jqp.setJavaEEVersion(J2EEVersionConstants.JEE_5_0_ID);
- }
-
-
- protected IStatus validateModuleType() {
- if (getArchiveWrapper().getJavaEEQuickPeek().getType() == J2EEConstants.WEB_TYPE)
- 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(ARCHIVE_WRAPPER)) {
-
- IDataModel moduleDM = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- if (getArchiveWrapper() != 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);
- updateJavaFacetVersion();
- model.notifyPropertyChange(PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
- }
-
- ArchiveWrapper archiveWrapper = (ArchiveWrapper) propertyValue;
- if (null != archiveWrapper) {
- List <ArchiveWrapper> libs = archiveWrapper.getWebLibs();
- List nestedModels = new ArrayList();
- for (int i = 0; i < libs.size(); i++) {
- IDataModel localModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
- localModel.setProperty(ARCHIVE_WRAPPER, libs.get(i));
- localModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME));
- IDataModel facetDataModel = localModel.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION);
- facetDataModel.setBooleanProperty(IJ2EEFacetProjectCreationDataModelProperties.ADD_TO_EAR, false);
- 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);
- }else if(propertyName.equals(WEB_LIB_ARCHIVES_SELECTED)) {
- validateLibModelRuntimes();
- }
- return true;
- }
-
- @Override
- public IStatus validate(String propertyName) {
- if(FACET_RUNTIME.equals(propertyName)){
- super.validate(propertyName);
- return validateLibModelRuntimes();
- }
- return super.validate(propertyName);
- }
-
- private IStatus validateLibModelRuntimes() {
- List libArchives = (List)getProperty(WEB_LIB_ARCHIVES_SELECTED);
- List libModels = (List)getProperty(WEB_LIB_MODELS);
- IStatus status = OK_STATUS;
- for (int i=0; i < libModels.size(); i++) {
- IDataModel libModel = (IDataModel)libModels.get(i);
- if (libArchives.contains(libModel.getProperty(ARCHIVE_WRAPPER))){
- status = libModel.validateProperty(FACET_RUNTIME);
- }
- if(!status.isOK()){
- return status;
- }
- }
- return status;
- }
-
- 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);
- }
-
- public void init() {
- super.init();
- IDataModel componentCreationDM = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
- FacetDataModelMap map = (FacetDataModelMap) componentCreationDM.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
- IDataModel webFacet = map.getFacetDataModel( IJ2EEFacetConstants.DYNAMIC_WEB );
- webFacet.setBooleanProperty(IJ2EEFacetInstallDataModelProperties.GENERATE_DD, false);
- }
-
- public void propertyChanged(DataModelEvent event) {
- super.propertyChanged(event);
- if (event.getPropertyName().equals(IFacetProjectCreationDataModelProperties.FACET_RUNTIME) && event.getDataModel() == model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION)) {
- Object propertyValue = event.getProperty();
- IDataModel nestedModel = null;
- List projectModels = (List) getProperty(WEB_LIB_MODELS);
- for (int i = 0; i < projectModels.size(); i++) {
- nestedModel = (IDataModel) projectModels.get(i);
- nestedModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, propertyValue);
- }
- }
- }
-}
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 bbd45abc0..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.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.SubProgressMonitor;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveSaveAdapter;
-import org.eclipse.jst.j2ee.internal.archive.WebComponentArchiveSaveAdapter;
-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 final int LINK_COMPONENTS_WORK = 10;
- protected final int LIB_FOLDER_WORK = 2;
-
- protected int computeTotalWork() {
- int baseWork = super.computeTotalWork() + LIB_FOLDER_WORK;
- List selectedLibs = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
- List libProjects = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_MODELS);
- IDataModel importModel = null;
- ArchiveWrapper libArchive = null;
- for (int i = 0; null != libProjects && i < libProjects.size(); i++) {
- importModel = (IDataModel) libProjects.get(i);
- libArchive = (ArchiveWrapper) importModel.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- if (selectedLibs.contains(libArchive)) {
- baseWork += LINK_COMPONENTS_WORK + PROJECT_CREATION_WORK + libArchive.getSize();
- }
- }
-
- return baseWork;
- }
-
- 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 SubProgressMonitor(monitor, LIB_FOLDER_WORK));
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- } else {
- monitor.worked(LIB_FOLDER_WORK);
- }
- 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 <ArchiveWrapper> selectedLibs = (List<ArchiveWrapper>) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
- List <Object> selectedLibsUnderlyingArchives = new ArrayList();
- for(ArchiveWrapper lib: selectedLibs){
- selectedLibsUnderlyingArchives.add(lib.getUnderLyingArchive());
- }
- List <IDataModel> libProjects = (List <IDataModel>) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_MODELS);
- IDataModel importModel = null;
- IVirtualComponent nestedComponent = null;
- ArchiveWrapper 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 = (ArchiveWrapper) importModel.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- if (selectedLibsUnderlyingArchives.contains(libArchive.getUnderLyingArchive())) {
- importModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, PROJECT_CREATION_WORK + libArchive.getSize()) , info);
- nestedComponent = (IVirtualComponent) importModel.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT);
- targetComponents.add(nestedComponent);
- String archiveURI = libArchive.getPath().lastSegment();
- 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(new SubProgressMonitor(monitor, LINK_COMPONENTS_WORK * targetComponents.size()), info);
- }
- }
-
- protected SaveStrategy createSaveStrategy(IVirtualComponent aVirtualComponent) {
- return new WebComponentSaveStrategyImpl(aVirtualComponent);
- }
-
- protected ComponentArchiveSaveAdapter getArchiveSaveAdapter(
- IVirtualComponent virtualComponent) {
- return new WebComponentArchiveSaveAdapter(virtualComponent);
- }
-}
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 1ac47ebb9..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
-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.project.WebUtilities;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-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 WebComponentLoadStrategyImpl(IVirtualComponent vComponent, boolean includeClasspathComponents) {
- super(vComponent, includeClasspathComponents);
- }
-
- public List getFiles() {
- super.getFiles();
- addLooseLibJARsToFiles();
- if (includeClasspathComponents) {
- addMappedClassFolders(IClasspathDependencyConstants.WEB_INF_CLASSES_PATH);
- }
- return filesHolder.getFiles();
- }
-
- public IVirtualReference[] getLibModules() {
- return WebUtilities.getLibModules(getComponent());
- }
-
- 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$
- }
-
- addClasspathComponentDependencies(looseComponent);
-
- 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);
- }
- }
- }
- }
- protected synchronized ArtifactEdit getArtifactEditForRead() {
- if(artifactEdit == null){
- artifactEdit = WebArtifactEdit.getWebArtifactEditForRead(vComponent);
- }
- return artifactEdit;
- }
-
- private void addClasspathComponentDependencies(final IVirtualComponent referencedComponent) {
- // retrieve all Java classpath component dependencies
- if (includeClasspathComponents && referencedComponent instanceof J2EEModuleVirtualComponent) {
- final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) referencedComponent).getJavaClasspathReferences();
- for (int j = 0; j < cpRefs.length; j++) {
- final IVirtualReference ref = cpRefs[j];
- final IPath runtimePath = ref.getRuntimePath();
-
- // only process ../ mappings
- if (ref.getReferencedComponent() instanceof VirtualArchiveComponent
- && runtimePath.equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
- final VirtualArchiveComponent comp = (VirtualArchiveComponent) ref.getReferencedComponent();
- File cpEntryFile = comp.getUnderlyingDiskFile();
- if (!cpEntryFile.exists()) {
- final IFile wbFile = comp.getUnderlyingWorkbenchFile();
- cpEntryFile = new File(wbFile.getLocation().toOSString());
- }
- addExternalFile("WEB-INF/lib/" + ref.getArchiveName(), cpEntryFile);
- }
- }
- }
- }
-
-}
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 3a72a18ac..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-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.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-
-public class WebComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
-
- public WebComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- /**
- * 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)) {
- IVirtualFolder rootFolder = vComponent.getRootFolder();
- IVirtualFile vFile = rootFolder.getFile((String) nonStandardSourceFiles.get(aFile));
- IFile iFile = vFile.getUnderlyingFile();
- return iFile.getProjectRelativePath();
- }
- 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(sourceFile)) {
- 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 af93dd9f3..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-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.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.project.facet.ProductManager;
-
-public class WebFacetProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider {
-
- public WebFacetProjectCreationDataModelProvider() {
- super();
- }
-
- public void init() {
- super.init();
-
- Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
- requiredFacets.add(JavaFacetUtils.JAVA_FACET);
- requiredFacets.add(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
- setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
-
- FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
- IDataModel javaFacet = map.getFacetDataModel( JavaFacetUtils.JAVA_FACET.getId() );
- IDataModel webFacet = map.getFacetDataModel( IJ2EEFacetConstants.DYNAMIC_WEB_FACET.getId() );
- String webRoot = webFacet.getStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER);
- String webSrc = webFacet.getStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER);
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, webSrc);
- // If using optimized single root structure, set the output folder to "<content folder>/WEB-INF/classes"
- if (ProductManager.shouldUseSingleRootStructure())
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, webRoot+"/"+J2EEConstants.WEB_INF_CLASSES); //$NON-NLS-1$
- 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, 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 cbdcc18fc..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-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 aaae1b770..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.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);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicDataModelProvider.java
deleted file mode 100644
index 6de2bbb09..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicDataModelProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.HashSet;
-import java.util.Set;
-
-import org.eclipse.jst.j2ee.web.datamodel.properties.IConvertStaticWebToDyamnicDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class ConvertStaticWebToDyamnicDataModelProvider extends AbstractDataModelProvider implements IConvertStaticWebToDyamnicDataModelProperties {
-
-
- public ConvertStaticWebToDyamnicDataModelProvider() {
- super();
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new ConvertStaticWebToDyamnicOperation(model);
- }
-
-
- public Set getPropertyNames() {
- Set propertyNames = new HashSet();
- propertyNames.add(PROJECT);
- propertyNames.add(CONVERT_TO_WEB_VERSION);
- return propertyNames;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicOperation.java
deleted file mode 100644
index 5b21b57c5..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicOperation.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.HashSet;
-import java.util.Set;
-
-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.core.runtime.NullProgressMonitor;
-import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
-import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IConvertStaticWebToDyamnicDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetInstallDataModelProvider;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-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;
-import org.eclipse.wst.project.facet.ProductManager;
-
-public class ConvertStaticWebToDyamnicOperation extends AbstractDataModelOperation {
-
- public ConvertStaticWebToDyamnicOperation() {
- super();
- }
-
- public ConvertStaticWebToDyamnicOperation(IDataModel dm) {
- super(dm);
- }
-
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- try {
- doConvert();
- } catch (Exception e) {
- WebPlugin.log(e);
- }
-
-
- return OK_STATUS;
- }
-
- protected void doConvert() throws Exception {
-
-
- String selectedVersion = model.getStringProperty(IConvertStaticWebToDyamnicDataModelProperties.CONVERT_TO_WEB_VERSION);
- IProject project = (IProject) model.getProperty(IConvertStaticWebToDyamnicDataModelProperties.PROJECT);
- IFacetedProject facetedProject = ProjectFacetsManager.create(project);
- Set fixedFacets = new HashSet();
- fixedFacets.addAll(facetedProject.getFixedProjectFacets());
- IProjectFacet webFacet = ProjectFacetsManager.getProjectFacet(IModuleConstants.WST_WEB_MODULE);
- fixedFacets.remove(webFacet);
- fixedFacets.add(WebFacetUtils.WEB_FACET);
- fixedFacets.add(JavaFacetUtils.JAVA_FACET);
- facetedProject.setFixedProjectFacets(fixedFacets);
- IProjectFacetVersion webFv = WebFacetUtils.WEB_FACET.getVersion(selectedVersion);
- IProjectFacetVersion javaFv = JavaFacetUtils.compilerLevelToFacet(JavaFacetUtils.getCompilerLevel(project));
- IFacetedProject.Action uninstall = new IFacetedProject.Action(IFacetedProject.Action.Type.UNINSTALL, facetedProject.getInstalledVersion(webFacet), null);
- IDataModel webModelCfg = DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
- webModelCfg.setBooleanProperty(IWebFacetInstallDataModelProperties.ADD_TO_EAR, false);
- // Get the default web root folder name (just in case the .component file doesn't exist for some reason)
- String webRoot = webModelCfg.getStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER);
-
- IVirtualComponent c = ComponentCore.createComponent(project);
- c.create(0, null);
- if (c.exists()) {
- // Get the web root folder from the .component file
- IVirtualFolder root = c.getRootFolder();
- webRoot = root.getUnderlyingFolder().getName();
- // Store the name into the properties for use during facet instal
- webModelCfg.setStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, webRoot);
- }
-
- IDataModel javaModelCfg = null;
- if (ProductManager.shouldUseSingleRootStructure()){
- javaModelCfg = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
- javaModelCfg.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME,
- webRoot+"/"+ J2EEConstants.WEB_INF_CLASSES); //$NON-NLS-1$
- }
-
- IFacetedProject.Action install = new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL,webFv,webModelCfg);
- IFacetedProject.Action javaInstall = new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL, javaFv, javaModelCfg);
- Set set = new HashSet();
- set.add(uninstall);
- set.add(install);
- set.add(javaInstall);
- facetedProject.modify(set, new NullProgressMonitor());
- }
-
-}
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 fec530c38..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, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.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 acf43e94b..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
+++ /dev/null
@@ -1,585 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-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;
-
-import com.ibm.icu.util.StringTokenizer;
-
-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
- IPath compRootPath = ComponentCore.createComponent(project).getRootFolder().getUnderlyingFolder().getProjectRelativePath();
- return project.getFolder(compRootPath);
- //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 a60bf8522..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, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.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};
- }
-}

Back to the top