Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal')
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/ContextRootUpdateOperation.java105
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategy.java17
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java88
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationDataModelProvider.java302
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationOperation.java154
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java82
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java51
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java94
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java147
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java70
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java212
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebContentNameUpdateOperation.java60
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppContainer.java109
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppContainerInitializer.java37
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java67
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IDynamicWebNature.java39
-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/J2EEWebNatureRuntime.java1076
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntimeUtilities.java183
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibDirBuilder.java366
-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/ProjectSupportResourceHandler.java66
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java993
-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/SynchronizeWLPoperation.java85
-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/WebContentResourceChangeListener.java99
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModel.java166
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModelFactory.java58
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebNatureRuntimeUtilities.java230
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectFeatureUpdateOperation.java57
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectInfo.java642
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectPropertiesUpdateOperation.java135
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java580
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java98
-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/WebArtifactEditOperation.java34
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditOperationDataModel.java26
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java37
-rw-r--r--plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java48
42 files changed, 0 insertions, 7018 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/ContextRootUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/ContextRootUpdateOperation.java
deleted file mode 100644
index 23a343130..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/ContextRootUpdateOperation.java
+++ /dev/null
@@ -1,105 +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.archive.operations;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.application.WebModule;
-import org.eclipse.jst.j2ee.internal.earcreation.EAREditModel;
-import org.eclipse.jst.j2ee.internal.earcreation.EARNatureRuntime;
-import org.eclipse.jst.j2ee.internal.web.operations.WebPropertiesUtil;
-import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
-
-/**
- * Insert the type's description here. Creation date: (10/31/2001 6:45:07 PM)
- *
- * @author: Administrator
- */
-public class ContextRootUpdateOperation implements IHeadlessRunnableWithProgress {
- public String fContextRoot;
- public org.eclipse.core.resources.IProject fProject;
-
- /**
- * ContextRootUpdateOperation constructor comment.
- */
- public ContextRootUpdateOperation(IProject project, String contextRoot) {
- super();
- fProject = project;
- fContextRoot = contextRoot;
- }
-
- /**
- * Runs this operation without forcing a UI dependency.
- *
- * @param monitor
- * the progress monitor to use to display progress and receive requests for
- * cancelation
- * @exception InvocationTargetException
- * if the run method must propagate a checked exception, it should wrap it inside
- * an <code>InvocationTargetException</code>; runtime exceptions are
- * automatically wrapped in an <code>InvocationTargetException</code> by the
- * calling context
- * @exception InterruptedException
- * if the operation detects a request to cancel, using
- * <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- *
- * @see IRunnableWithProgress
- */
- public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-
- // update context root in web project
- WebPropertiesUtil.updateContextRoot(fProject, fContextRoot);
-
- // update context root in ear project
- updateContextRootInEAR(fProject, fContextRoot);
- }
-
- protected void updateContextRootInEAR(org.eclipse.core.resources.IProject project, String contextRoot) {
-
-// J2EEWebNatureRuntime runtime = J2EEWebNatureRuntime.getRuntime(project);
-// if (runtime == null)
-// return;
-
-// EARNatureRuntime earNatureRuntime[] = runtime.getReferencingEARProjects();
- EARNatureRuntime earNatureRuntime[] = new EARNatureRuntime[0];
- EAREditModel editModel = null;
- for (int i = 0; i < earNatureRuntime.length; i++) {
- // hold the model and update the context root & release the model
- try {
- editModel = earNatureRuntime[i].getEarEditModelForWrite(this);
- if (editModel != null) {
- Module module = null;
- if ((module = earNatureRuntime[i].getModule(project)) != null) {
-
- // only if the module is a WebModule
- if (module instanceof WebModule) {
- //if(((WebModule)module).isSetContextRoot())
- ((WebModule) module).setContextRoot(contextRoot);
- }
- }
- editModel.saveIfNecessary(this);
- }
- } catch (Throwable e) {
- Logger.getLogger().logError(e);
- } finally {
- if (editModel != null)
- editModel.releaseAccess(this);
- editModel = null;
- }
-
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategy.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategy.java
deleted file mode 100644
index 069bbd114..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectSaveStrategy.java
+++ /dev/null
@@ -1,17 +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.archive.operations;
-
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-
-
-
-public interface WTProjectSaveStrategy extends SaveStrategy {
- //Default
-} \ No newline at end of file
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 9f4a42b77..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java
+++ /dev/null
@@ -1,88 +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.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();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationDataModelProvider.java
deleted file mode 100644
index bb4857e77..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationDataModelProvider.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.IStatus;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
-import org.eclipse.jst.j2ee.application.internal.operations.AddWebComponentToEARDataModelProvider;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationDataModelProvider;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.CommonarchiveFactoryImpl;
-import org.eclipse.jst.j2ee.datamodel.properties.IAddWebComponentToEnterpriseApplicationDataModelProperties;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class WebComponentCreationDataModelProvider extends J2EEComponentCreationDataModelProvider implements IWebComponentCreationDataModelProperties {
-
- public WebComponentCreationDataModelProvider() {
- super();
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new WebComponentCreationOperation(model);
- }
-
- public String[] getPropertyNames() {
- String[] props = new String[]{USE_ANNOTATIONS, CONTEXT_ROOT};
- return combineProperties(super.getPropertyNames(), props);
- }
- /**
- * @return Returns the default J2EE spec level based on the Global J2EE Preference
- */
- protected Integer getDefaultComponentVersion() {
- int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID();
- switch (highestJ2EEPref) {
- case (J2EEVersionConstants.J2EE_1_4_ID) :
- return new Integer(J2EEVersionConstants.WEB_2_4_ID);
- case (J2EEVersionConstants.J2EE_1_3_ID) :
- return new Integer(J2EEVersionConstants.WEB_2_3_ID);
- case (J2EEVersionConstants.J2EE_1_2_ID) :
- return new Integer(J2EEVersionConstants.WEB_2_2_ID);
- default :
- return new Integer(J2EEVersionConstants.WEB_2_4_ID);
- }
- }
-
- public AddComponentToEnterpriseApplicationDataModelProvider createAddComponentToEAR() {
- return new AddWebComponentToEARDataModelProvider();
- }
- public void init() {
- super.init();
- //setJ2EENatureID(IWebNatureConstants.J2EE_NATURE_ID);
- //setProperty(EDIT_MODEL_ID, IWebNatureConstants.EDIT_MODEL_ID);
- //getProjectDataModel().setProperty(ProjectCreationDataModel.PROJECT_NATURES, new String[]{IModuleConstants.MODULE_NATURE_ID});
- //getJavaProjectCreationDataModel().setProperty(JavaProjectCreationDataModel.SOURCE_FOLDERS, new String[]{getDefaultJavaSourceFolderName()});
-
- updateOutputLocation();
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean retVal = super.propertySet(propertyName, propertyValue);
-// if( propertyName.equals(COMPONENT_NAME)){
-// IDataModel addtoEAR = (IDataModel) model.getProperty(NESTED_ADD_COMPONENT_TO_EAR_DM);
-// addtoEAR.setProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, propertyValue);
-//
-// }else
- if (propertyName.equals(USE_ANNOTATIONS)) {
- model.notifyPropertyChange(COMPONENT_VERSION, DataModelEvent.ENABLE_CHG);
- }
-// else if (propertyName.equals(COMPONENT_VERSION)) {
-// if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3)
-// setProperty(USE_ANNOTATIONS, Boolean.FALSE);
-// model.notifyPropertyChange(USE_ANNOTATIONS, DataModelEvent.ENABLE_CHG);
-// }
- else if (propertyName.equals(CONTEXT_ROOT)) {
- getAddComponentToEARDataModel().setProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, propertyValue);
- } else if (propertyName.equals(COMPONENT_NAME)) {
- if (!isPropertySet(CONTEXT_ROOT)) {
- model.notifyPropertyChange(CONTEXT_ROOT, DataModelEvent.VALUE_CHG);
- //((AddWebModuleToEARDataModel) getAddComponentToEARDataModel()).defaultContextRoot=(String)propertyValue;
- getAddComponentToEARDataModel().setProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, propertyValue );
- getAddComponentToEARDataModel().notifyPropertyChange(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT, IDataModel.DEFAULT_CHG);
- }
- }
- return retVal;
- }
-
- private void updateOutputLocation() {
-// getJavaProjectCreationDataModel().setProperty(JavaProjectCreationDataModel.OUTPUT_LOCATION, getOutputLocation());
- }
-
-// private Object getOutputLocation() {
-// StringBuffer buf = new StringBuffer(getStringProperty(WEB_CONTENT));
-// buf.append(IPath.SEPARATOR);
-// buf.append(IWebNatureConstants.INFO_DIRECTORY);
-// buf.append(IPath.SEPARATOR);
-// buf.append(IWebNatureConstants.CLASSES_DIRECTORY);
-// return buf.toString();
-// }
-
-
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(ADD_TO_EAR)) {
- if( isEARSupported() )
- setProperty(ADD_TO_EAR, Boolean.TRUE);
- }
-// if (propertyName.equals(WEB_CONTENT)) {
-// String webContentFolderPref = J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName();
-// if (webContentFolderPref == null || webContentFolderPref.length() == 0)
-// webContentFolderPref = IWebNatureConstants.WEB_MODULE_DIRECTORY_;
-// return webContentFolderPref;
-// }
- if (propertyName.equals(CONTEXT_ROOT)) {
- return getProperty(COMPONENT_NAME);
- }
- //To do: after porting
-// if (propertyName.equals(SERVLET_VERSION)) {
-// int moduleVersion = getIntProperty(COMPONENT_VERSION);
-// int servletVersion = J2EEVersionConstants.SERVLET_2_2;
-// switch (moduleVersion) {
-// case J2EEVersionConstants.WEB_2_2_ID :
-// servletVersion = J2EEVersionConstants.SERVLET_2_2;
-// break;
-// case J2EEVersionConstants.WEB_2_3_ID :
-// case J2EEVersionConstants.WEB_2_4_ID :
-// servletVersion = J2EEVersionConstants.SERVLET_2_3;
-// break;
-// }
-// return new Integer(servletVersion);
-// }
-// if (propertyName.equals(JSP_VERSION)) {
-// int moduleVersion = getIntProperty(COMPONENT_VERSION);
-// int jspVersion = J2EEVersionConstants.JSP_1_2_ID;
-// switch (moduleVersion) {
-// case J2EEVersionConstants.WEB_2_2_ID :
-// jspVersion = J2EEVersionConstants.JSP_1_2_ID;
-// break;
-// case J2EEVersionConstants.WEB_2_3_ID :
-// case J2EEVersionConstants.WEB_2_4_ID :
-// jspVersion = J2EEVersionConstants.JSP_2_0_ID;
-// break;
-// }
-// return new Integer(jspVersion);
-// }
- if (propertyName.equals(DD_FOLDER)) {
- if(isProjMultiComponents)
- return IPath.SEPARATOR + this.getModuleName() + IPath.SEPARATOR + "WebContent"+IPath.SEPARATOR + J2EEConstants.WEB_INF;
- else
- return IPath.SEPARATOR + "WebContent"+IPath.SEPARATOR + J2EEConstants.WEB_INF;
- }
- if (propertyName.equals(JAVASOURCE_FOLDER)) {
- if(isProjMultiComponents)
- return IPath.SEPARATOR + this.getModuleName() + IPath.SEPARATOR + "JavaSource";
- else
- return IPath.SEPARATOR + "JavaSource";
- }
- if (propertyName.equals(MANIFEST_FOLDER)) {
- if(isProjMultiComponents)
- return IPath.SEPARATOR + this.getModuleName() + IPath.SEPARATOR + "WebContent"+IPath.SEPARATOR + J2EEConstants.META_INF;
- else
- return IPath.SEPARATOR + "WebContent"+IPath.SEPARATOR + J2EEConstants.META_INF;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (propertyName.equals(COMPONENT_VERSION)) {
- Integer propertyValue = (Integer) getProperty(propertyName);
- String description = null;
- switch (propertyValue.intValue()) {
- case J2EEVersionConstants.WEB_2_2_ID :
- description = J2EEVersionConstants.VERSION_2_2_TEXT;
- break;
- case J2EEVersionConstants.WEB_2_3_ID :
- description = J2EEVersionConstants.VERSION_2_3_TEXT;
- break;
- case J2EEVersionConstants.WEB_2_4_ID :
- default :
- description = J2EEVersionConstants.VERSION_2_4_TEXT;
- break;
- }
- return new DataModelPropertyDescriptor(propertyValue, description);
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
- protected DataModelPropertyDescriptor[] getValidComponentVersionDescriptors() {
- int highestJ2EEPref = J2EEPlugin.getDefault().getJ2EEPreferences().getHighestJ2EEVersionID();
- DataModelPropertyDescriptor[] descriptors = null;
- switch (highestJ2EEPref) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- descriptors = new DataModelPropertyDescriptor[1];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT);
- break;
- case J2EEVersionConstants.J2EE_1_3_ID :
- descriptors = new DataModelPropertyDescriptor[2];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT);
- descriptors[1] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_3_ID), J2EEVersionConstants.VERSION_2_3_TEXT);
- break;
- case J2EEVersionConstants.J2EE_1_4_ID :
- default :
- descriptors = new DataModelPropertyDescriptor[3];
- descriptors[0] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_2_ID), J2EEVersionConstants.VERSION_2_2_TEXT);
- descriptors[1] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_3_ID), J2EEVersionConstants.VERSION_2_3_TEXT);
- descriptors[2] = new DataModelPropertyDescriptor(new Integer(J2EEVersionConstants.WEB_2_4_ID), J2EEVersionConstants.VERSION_2_4_TEXT);
- break;
- }
- return descriptors;
- }
-
- protected int convertModuleVersionToJ2EEVersion(int moduleVersion) {
- switch (moduleVersion) {
- case J2EEVersionConstants.WEB_2_2_ID :
- return J2EEVersionConstants.J2EE_1_2_ID;
- case J2EEVersionConstants.WEB_2_3_ID :
- return J2EEVersionConstants.J2EE_1_3_ID;
- case J2EEVersionConstants.WEB_2_4_ID :
- return J2EEVersionConstants.J2EE_1_4_ID;
- }
- return -1;
- }
-
- protected Integer convertJ2EEVersionToModuleVersion(Integer j2eeVersion) {
- switch (j2eeVersion.intValue()) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- return new Integer(J2EEVersionConstants.WEB_2_2_ID);
- case J2EEVersionConstants.J2EE_1_3_ID :
- return new Integer(J2EEVersionConstants.WEB_2_3_ID);
- case J2EEVersionConstants.J2EE_1_4_ID :
- return new Integer(J2EEVersionConstants.WEB_2_4_ID);
- }
- return super.convertJ2EEVersionToModuleVersion(j2eeVersion);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.application.operations.J2EEModuleCreationDataModel#getModuleType()
- */
- protected EClass getComponentType() {
- return CommonarchiveFactoryImpl.getPackage().getWARFile();
- }
-
- protected String getComponentExtension() {
- return ".war"; //$NON-NLS-1$
- }
-
- public boolean isPropertyEnabled(String propertyName) {
- if (USE_ANNOTATIONS.equals(propertyName)) {
- if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3)
- return false;
- return true;
- }
- return super.isPropertyEnabled(propertyName);
- }
-
- public IStatus validate(String propertyName) {
- if (propertyName.equals(CONTEXT_ROOT)) {
- if (getBooleanProperty(ADD_TO_EAR)) {
- return getAddComponentToEARDataModel().validateProperty(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT);
- }
- return OK_STATUS;
- }
- return super.validate(propertyName);
- }
-
- public void propertyChanged(DataModelEvent event) {
- super.propertyChanged(event);
- if (event.getDataModel() == getAddComponentToEARDataModel() && event.getPropertyName().equals(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT) && event.getDataModel().isPropertySet(IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT)) {
- setProperty(CONTEXT_ROOT, event.getProperty());
- }
- //else if (event.getDataModel() == getServerTargetDataModel() && event.getPropertyName().equals(ServerTargetDataModel.RUNTIME_TARGET_ID) && event.getDataModel().isSet(ServerTargetDataModel.RUNTIME_TARGET_ID))
- //setProperty(ADD_TO_EAR, updateAddToEar());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.j2ee.application.operations.FlexibleJ2EECreationDataModel#getModuleID()
- */
- protected String getComponentID() {
- return IModuleConstants.JST_WEB_MODULE;
- }
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName){
- return super.getValidPropertyDescriptors(propertyName);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationOperation.java
deleted file mode 100644
index b35aada7d..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentCreationOperation.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentCreationOperation;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.web.classpath.WebAppContainer;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.ComponentcoreFactory;
-import org.eclipse.wst.common.componentcore.internal.Property;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class WebComponentCreationOperation extends J2EEComponentCreationOperation implements IWebComponentCreationDataModelProperties {
-
- public WebComponentCreationOperation(IDataModel model) {
- super(model);
- }
-
- protected void createAndLinkJ2EEComponentsForMultipleComponents() throws CoreException {
- createWebStructure("/" + getModuleName());
- }
-
- protected void createAndLinkJ2EEComponentsForSingleComponent() throws CoreException {
- createWebStructure("");
- }
-
- protected void createWebStructure(String prefix) throws CoreException {
- IVirtualComponent component = ComponentCore.createComponent(getProject(), getModuleDeployName());
- component.create(0, null);
- // create and link javaSource Source Folder
- IVirtualFolder javaSourceFolder = component.getRootFolder().getFolder(new Path("/" + J2EEConstants.WEB_INF + "/classes")); //$NON-NLS-1$
- javaSourceFolder.createLink(new Path(model.getStringProperty(JAVASOURCE_FOLDER)), 0, null);
- // create and link META-INF and WEB-INF folder
- IVirtualFolder webContent = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- webContent.createLink(new Path(prefix + "/WebContent"), 0, null);
-
- IVirtualFolder webInfFolder = webContent.getFolder(J2EEConstants.WEB_INF);
- webInfFolder.create(IResource.FORCE, null);
-
- IVirtualFolder metaInfFolder = webContent.getFolder(J2EEConstants.META_INF);
- metaInfFolder.create(IResource.FORCE, null);
-
- IVirtualFolder webLib = webInfFolder.getFolder("lib");
- webLib.create(IResource.FORCE, null);
- }
-
-
- protected void createDeploymentDescriptor(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
-
- WebArtifactEdit webEdit = null;
- try {
- ComponentHandle handle = ComponentHandle.create(getProject(), model.getStringProperty(COMPONENT_DEPLOY_NAME));
- webEdit = WebArtifactEdit.getWebArtifactEditForWrite(handle);
- Integer version = (Integer) model.getProperty(COMPONENT_VERSION);
- webEdit.createModelRoot(version.intValue());
- webEdit.save(monitor);
- } catch (Exception e) {
- Logger.getLogger().logError(e);
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- webEdit = null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.application.operations.J2EEComponentCreationOperation#getVersion()
- */
- protected String getVersion() {
- int version = model.getIntProperty(COMPONENT_VERSION);
- return J2EEVersionUtil.getServletTextVersion(version);
-
- }
-
- protected List getProperties() {
- List newProps = new ArrayList();
- Property prop = ComponentcoreFactory.eINSTANCE.createProperty();
- prop.setName(J2EEConstants.CONTEXTROOT);
- prop.setValue(model.getStringProperty(CONTEXT_ROOT));
- newProps.add(prop);
- return newProps;
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- super.execute(IModuleConstants.JST_WEB_MODULE, monitor);
- // Add "Web App Libraries" container to the project classpath.
-
- final IJavaProject jproject = JemProjectUtilities.getJavaProject(getProject());
- final List cp = new ArrayList();
- final IClasspathEntry[] old = jproject.getRawClasspath();
- for (int i = 0; i < old.length; i++) {
- cp.add(old[i]);
- }
- final String name = getModuleDeployName();
- cp.add(WebAppContainer.convert(name));
-
- final IClasspathEntry[] cparray = new IClasspathEntry[cp.size()];
- cp.toArray(cparray);
- jproject.setRawClasspath(cparray, null);
- } catch (CoreException e) {
- Logger.getLogger().log(e.getMessage());
- } catch (InvocationTargetException e) {
- Logger.getLogger().log(e.getMessage());
- } catch (InterruptedException e) {
- Logger.getLogger().log(e.getMessage());
- }
-
- return OK_STATUS;
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
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 e7b76247a..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentExportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentExportDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-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 String[] getPropertyNames() {
- String[] props = new String[]{EXCLUDE_COMPILE_JSP};
- return combineProperties(super.getPropertyNames(), props);
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (EXCLUDE_COMPILE_JSP.equals(propertyName)) {
- return Boolean.FALSE;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- protected String getComponentID() {
- return IModuleConstants.JST_WEB_MODULE;
- }
-
- 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 3746c8dfb..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.internal.archive.operations.AppClientArchiveOpsResourceHandler;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class WebComponentExportOperation extends J2EEArtifactExportOperation {
-
- public WebComponentExportOperation() {
- super();
- }
-
- public WebComponentExportOperation(IDataModel model) {
- super(model);
- }
-
- protected void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
- try {
- CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory();
- WebComponentLoadStrategyImpl ls = new WebComponentLoadStrategyImpl(getComponent());
- ls.setExportSource(isExportSource());
- setModuleFile(caf.openWARFile(ls, getDestinationPath().toOSString()));
- getModuleFile().saveAsNoReopen(getDestinationPath().toOSString());
- } catch (SaveFailureException ex) {
- throw ex;
- } catch (Exception e) {
- throw new SaveFailureException(AppClientArchiveOpsResourceHandler.getString("ARCHIVE_OPERATION_OpeningArchive"), e);//$NON-NLS-1$
- } }
-
- 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 a8377c7fd..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.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.archive.operations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEUtilityJarImportDataModelProvider;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
-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 String[] getPropertyNames() {
- return combineProperties(super.getPropertyNames(), new String[]{WEB_LIB_MODELS, WEB_LIB_ARCHIVES_SELECTED});
- }
-
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(WEB_LIB_MODELS) || propertyName.equals(WEB_LIB_ARCHIVES_SELECTED)) {
- return Collections.EMPTY_LIST;
- }
- return super.getDefaultProperty(propertyName);
- }
-
- protected int getType() {
- return XMLResource.WEB_APP_TYPE;
- }
-
- protected IStatus validateModuleType() {
- if (getArchiveFile() instanceof WARFile)
- return OK_STATUS;
-
- // TODO: STRING MOVE
- return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString("Temp String for none WARFile")); //$NON-NLS-1$);
- }
-
- public boolean propertySet(String propertyName, Object propertyValue) {
- super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(FILE)) {
- Archive archive = (Archive) propertyValue;
- if (null != archive) {
- WARFile war = (WARFile) archive;
- List libs = war.getLibArchives();
- List nestedModels = new ArrayList();
- for (int i = 0; i < libs.size(); i++) {
- IDataModel localModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
- localModel.setProperty(FILE, libs.get(i));
- nestedModels.add(localModel);
- }
- setProperty(WEB_LIB_MODELS, nestedModels);
- }
- }
- return true;
- }
-
- protected Archive openArchive(String uri) throws OpenFailureException {
- Archive archive = CommonarchiveFactory.eINSTANCE.openWARFile(getArchiveOptions(), uri);
- return archive;
- }
-
- protected IDataModel createJ2EEComponentCreationDataModel() {
- return DataModelFactory.createDataModel(new WebComponentCreationDataModelProvider());
- }
-
- public IDataModelOperation getDefaultOperation() {
- return new WebComponentImportOperation(model);
- }
-
-} \ No newline at end of file
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 e4934d605..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
+++ /dev/null
@@ -1,147 +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.archive.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-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.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactImportOperation;
-import org.eclipse.jst.j2ee.internal.web.operations.WebPropertiesUtil;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.web.internal.operation.ILibModule;
-import org.eclipse.wst.web.internal.operation.LibModule;
-
-public class WebComponentImportOperation extends J2EEArtifactImportOperation {
- /**
- * @param model
- */
- public WebComponentImportOperation(IDataModel model) {
- super(model);
- }
-
- protected void doExecute(IProgressMonitor monitor) throws ExecutionException {
- super.doExecute(monitor);
- IVirtualFolder libFolder = WebPropertiesUtil.getWebLibFolder(virtualComponent);
- if (!libFolder.exists()) {
- try {
- libFolder.create(IFolder.FORCE, new NullProgressMonitor());
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- try {
- addExtraClasspathEntries(monitor);
- } catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- private void addExtraClasspathEntries(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, CoreException, JavaModelException, ExecutionException {
- List extraEntries = null;
- IJavaProject javaProject = JavaCore.create(virtualComponent.getProject());
- extraEntries = new ArrayList();
- importWebLibraryProjects(monitor, extraEntries, javaProject);
- IVirtualFolder libFolder = WebPropertiesUtil.getWebLibFolder(virtualComponent);
- IVirtualResource[] libs = libFolder.members();
- IResource lib = null;
- for (int i = 0; i < libs.length; i++) {
- lib = libs[i].getUnderlyingResource();
- if (!javaProject.isOnClasspath(lib))
- extraEntries.add(JavaCore.newLibraryEntry(lib.getFullPath(), lib.getFullPath(), null));
- }
- addToClasspath(model, extraEntries);
- }
-
- private void importWebLibraryProjects(IProgressMonitor monitor, List extraEntries, IJavaProject javaProject) throws InvocationTargetException, InterruptedException, ExecutionException {
- List selectedLibs = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
- List libProjects = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_MODELS);
- IDataModel importModel = null;
- IVirtualComponent nestedComponent = null;
- ArrayList libModules = new ArrayList();
- String jarName = null;
- Archive libArchive = null;
- for (int i = 0; null != libProjects && i < libProjects.size(); i++) {
- importModel = (IDataModel) libProjects.get(i);
- libArchive = (Archive) importModel.getProperty(IWebComponentImportDataModelProperties.FILE);
- if (selectedLibs.contains(libArchive)) {
- jarName = libArchive.getName();
- nestedComponent = (IVirtualComponent) importModel.getProperty(IWebComponentImportDataModelProperties.COMPONENT);
- libModules.add(new LibModule(jarName, nestedComponent.getProject().getName()));
- importModel.getDefaultOperation().execute(monitor, info);
- if (extraEntries != null) {
- if (!javaProject.isOnClasspath(nestedComponent.getProject())) {
- extraEntries.add(JavaCore.newProjectEntry(nestedComponent.getProject().getFullPath()));
- }
- }
- ComponentCore.createReference(virtualComponent, nestedComponent, new Path("/WEB-INF/lib/")).create(0, monitor);
- }
- }
-
-
- LibModule[] libModulesArray = new LibModule[libModules.size()];
- for (int i = 0; i < libModules.size(); i++) {
- libModulesArray[i] = (LibModule) libModules.get(i);
- }
- setLibModules(javaProject.getProject(), libModulesArray);
- }
-
- protected void setLibModules(IProject project, ILibModule[] modules) {
- // TODO this will throw class cast exception, do we still use ILibModule?
- WebArtifactEdit webArtifactEdit = null;
- try {
- // TODO migrate to flex projects
- // webArtifactEdit =
- // (WebArtifactEdit)StructureEdit.getFirstArtifactEditForRead(project);
- if (webArtifactEdit != null)
- webArtifactEdit.addLibModules((ReferencedComponent[]) modules);
- } finally {
- if (webArtifactEdit != null)
- webArtifactEdit.dispose();
- }
- }
-
- protected SaveStrategy createSaveStrategy(IVirtualComponent virtualComponent) {
- return new WebComponentSaveStrategyImpl(virtualComponent);
- }
-} \ No newline at end of file
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 438365406..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jst.common.componentcore.util.ComponentUtilities;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl;
-import org.eclipse.jst.j2ee.internal.project.J2EEComponentUtilities;
-import org.eclipse.jst.j2ee.internal.web.operations.ProjectSupportResourceHandler;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-
-public class WebComponentLoadStrategyImpl extends ComponentLoadStrategyImpl {
-
- public WebComponentLoadStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public List getFiles() {
- filesList = (ArrayList) super.getFiles();
- addLooseLibJARsToFiles();
- return filesList;
- }
-
- public IVirtualReference[] getLibModules() {
- WebArtifactEdit webArtifactEdit = null;
- try {
- webArtifactEdit = (WebArtifactEdit) ComponentUtilities.getArtifactEditForRead(getComponent());
- if (webArtifactEdit != null)
- return webArtifactEdit.getLibModules();
- } finally {
- if (webArtifactEdit != null)
- webArtifactEdit.dispose();
- }
- return null;
-
- }
-
- public void addLooseLibJARsToFiles() {
- IVirtualReference[] libModules = getLibModules();
- for (int i = 0; i < libModules.length; i++) {
- IVirtualReference iLibModule = libModules[i];
- IVirtualComponent vComponent = iLibModule.getReferencedComponent();
- String uri = iLibModule.getRuntimePath().toString() + "/" + vComponent.getName() + ".jar";
- try {
- Archive utilJAR = J2EEComponentUtilities.asArchive(uri, vComponent, isExportSource());
- if (utilJAR == null)
- continue;
- filesList.add(utilJAR);
- } catch (OpenFailureException oe) {
- String message = ProjectSupportResourceHandler.getString("UNABLE_TO_LOAD_MODULE_ERROR_", new Object[]{uri, getComponent().getProject().getName(), oe.getConcatenatedMessages()}); //$NON-NLS-1$
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logTrace(message);
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
deleted file mode 100644
index 21e3b4a79..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.archive.operations;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jst.common.componentcore.util.ComponentUtilities;
-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.exception.SaveFailureException;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.FileIterator;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.archive.operations.J2EEComponentSaveStrategyImpl;
-import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-
-public class WebComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
-
- private HashMap filesToSave; // container a mapping from the File.getURI() to the target path
- private HashSet filesNotToSave;
-
- public WebComponentSaveStrategyImpl(IVirtualComponent vComponent) {
- super(vComponent);
- }
-
- public void save(File aFile, FileIterator iterator) throws SaveFailureException {
- if (aFile.isArchive() && operationHandlesNested((Archive) aFile)) {
- return;
- }
-
- if (aFile.isArchive() && shouldIterateOver((Archive) aFile)) {
- save((Archive) aFile);
- } else {
- InputStream in = null;
- if (!aFile.isDirectoryEntry()) {
- try {
- in = iterator.getInputStream(aFile);
- } catch (IOException ex) {
- throw new SaveFailureException(aFile.getURI(), ex);
- }
- }
- IPath path = (IPath) filesToSave.get(aFile.getURI());
- if (path != null) {
- try {
- saveToWorkbenchPath(path, in);
- } catch (Exception e) {
- throw new SaveFailureException(e.getMessage(), e);
- }
- }
- }
- }
-
- protected boolean operationHandlesNested(Archive archive) {
- if (null != dataModel) {
- List list = (List) dataModel.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
- return list.contains(archive);
- }
- return false;
- }
-
- protected void saveFiles() throws SaveFailureException {
- WARFile warFile = (WARFile) getArchive();
- // First go through the classes in the WEB-INF/classes directory and try
- // to find a source file for each one file there. If a source file is
- // found, copy
- // it to the source directory, if not, copy the .class file to the
- // imported_classes directory.
- List classesFiles = getClassesFiles();
- Iterator classesIterator = classesFiles.iterator();
- filesToSave = new HashMap();
- HashMap libModuleFiles = new HashMap();
- boolean hasSource = false;
- boolean hasClasses = false;
- while (classesIterator.hasNext()) {
- File classFile = (File) classesIterator.next();
- if (WTProjectStrategyUtils.isClassFile(classFile.getURI())) {
- hasClasses = true;
- File sourceFile = warFile.getSourceFile(classFile);
- IPath path = null;
- if (sourceFile != null) {
- hasSource = true;
- // TODO can this be optimized?
- IPath sourcePath = new Path(sourceFile.getURI());
- IPath relClassPath = new Path(WTProjectStrategyUtils.makeRelative(classFile.getURI(), ArchiveConstants.WEBAPP_CLASSES_URI));
- String relSourceURI = sourcePath.removeFirstSegments(sourcePath.segmentCount() - relClassPath.segmentCount()).toString();
- path = convertToSourcePath(relSourceURI);
- filesToSave.put(classFile.getURI(), null); // don't save the .class file
- filesToSave.put(sourceFile.getURI(), path);
- } else {
- path = convertToImportedClassesPath(classFile.getURI());
- filesToSave.put(classFile.getURI(), path);
- }
- }
- }
- // If there were no class files, then put any other resource in the
- // classes
- // directory to the source folder.
- if (!hasClasses)
- hasSource = true;
- // Next go through the classes directory again saving all of the files
- // that were
- // not previously saved. This handles the resource files.
- classesIterator = classesFiles.iterator();
- while (classesIterator.hasNext()) {
- File classFile = (File) classesIterator.next();
- if (!filesToSave.containsKey(classFile.getURI())) {
- File copyFile = warFile.getSourceFile(classFile);
- // If its a java file, put it into the source directory
- if (!hasSource && WTProjectStrategyUtils.isSourceFile(classFile.getURI()))
- hasSource = true;
- IPath path = null;
- if (!hasSource) {
- path = convertToImportedClassesPath(classFile.getURI());
- } else {
- IPath sourcePath = new Path(classFile.getURI());
- IPath relClassPath = new Path(WTProjectStrategyUtils.makeRelative(classFile.getURI(), ArchiveConstants.WEBAPP_CLASSES_URI));
- String relSourceURI = sourcePath.removeFirstSegments(sourcePath.segmentCount() - relClassPath.segmentCount()).toString();
- path = convertToSourcePath(relSourceURI);
- }
- filesToSave.put(classFile.getURI(), path);
- if (copyFile != null)
- filesToSave.put(copyFile.getURI(), null);
- }
- }
- // Finally, make a pass through all of the files now, saving them to the
- // appropriate place
- // if they have not yet been saved.
- List allFiles = getArchive().getFiles();
- for (Iterator iter = allFiles.iterator(); iter.hasNext();) {
- File file = (File) iter.next();
- if (!filesToSave.containsKey(file.getURI())) {
- if (!libModuleFiles.containsKey(file.getURI())) {
- IPath path = convertToContentPath(file.getURI());
- filesToSave.put(file.getURI(), path);
- }
- }
- }
- super.saveFiles();
- }
-
- protected List getClassesFiles() {
- return ((WARFile) getArchive()).getClasses();
- }
-
- private IPath importedClassesPath;
-
- protected IPath convertToImportedClassesPath(String uri) {
- if (importedClassesPath == null) {
- IPath javaPath = getJavaSourcePath();
- importedClassesPath = javaPath.removeLastSegments(1).append(LibCopyBuilder.IMPORTED_CLASSES_PATH);
- try {
- IPath workspacePath = vComponent.getProject().getFullPath().append(importedClassesPath);
- mkdirs(workspacePath, ResourcesPlugin.getWorkspace().getRoot());
- IVirtualFolder javaSourceFolder = vComponent.getRootFolder().getFolder(new Path("/" + J2EEConstants.WEB_INF + "/classes"));
- javaSourceFolder.createLink(workspacePath.removeFirstSegments(1), 0, null);
- } catch (CoreException e) {
- // TODO
- }
-
- }
- return importedClassesPath.append(WTProjectStrategyUtils.makeRelative(uri, ArchiveConstants.WEBAPP_CLASSES_URI));
- }
-
- private IPath javaSourcePath;
-
- private void loadJavaSource() {
- IPackageFragmentRoot [] containers = ComponentUtilities.getSourceContainers(vComponent);
- javaSourcePath = containers[0].getPath();
- }
-
- protected IPath getJavaSourcePath() {
- if (javaSourcePath == null) {
- loadJavaSource();
- }
- return javaSourcePath;
- }
-
- protected IPath convertToSourcePath(String uri) {
- return getJavaSourcePath().append(uri);
- }
-
- private IPath webContentPath;
-
- protected IPath convertToContentPath(String uri) {
- if (webContentPath == null) {
- webContentPath = vComponent.getRootFolder().getWorkspaceRelativePath();
- }
- return webContentPath.append(uri);
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebContentNameUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebContentNameUpdateOperation.java
deleted file mode 100644
index c3bebd849..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebContentNameUpdateOperation.java
+++ /dev/null
@@ -1,60 +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.archive.operations;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jst.j2ee.internal.web.operations.WebPropertiesUtil;
-import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
-
-
-public class WebContentNameUpdateOperation implements IHeadlessRunnableWithProgress {
-
- public String fWebContentName;
- public IProject fProject;
-
-
- public WebContentNameUpdateOperation(IProject project, String webContentName) {
- super();
- fProject = project;
- fWebContentName = webContentName;
- }
-
-
- /**
- * Runs this operation without forcing a UI dependency.
- *
- * @param monitor
- * the progress monitor to use to display progress and receive requests for
- * cancelation
- * @exception InvocationTargetException
- * if the run method must propagate a checked exception, it should wrap it inside
- * an <code>InvocationTargetException</code>; runtime exceptions are
- * automatically wrapped in an <code>InvocationTargetException</code> by the
- * calling context
- * @exception InterruptedException
- * if the operation detects a request to cancel, using
- * <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- *
- * @see IRunnableWithProgress
- */
- public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-
- try {
- WebPropertiesUtil.updateWebContentNameAndProperties(fProject, fWebContentName, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppContainer.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppContainer.java
deleted file mode 100644
index a75da8631..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppContainer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.internal.web.classpath;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IClasspathEntry;
-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.operations.WebMessages;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class WebAppContainer
-
- 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 WebAppContainer( final IPath path,
- final IJavaProject jproject )
- {
- super( path, jproject, jproject.getProject(), path.segment( 1 ),
- paths, types );
- }
-
- public String getDescription()
- {
- return resource( "WEB_CONT_DESCRIPTION", this.component );
- }
-
- 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 WebAppContainer( this.path, this.owner ) ).install();
- }
-
- public static IClasspathEntry convert( final String component )
- {
- final IPath path = ( new Path( CONTAINER_ID ) ).append( component );
- return JavaCore.newContainerEntry( path );
- }
-
- public static String convert( final IClasspathEntry cpe )
- {
- return cpe.getPath().segment( 1 );
- }
-
- public static boolean check( final IClasspathEntry cpe )
- {
- if( cpe.getEntryKind() == IClasspathEntry.CPE_CONTAINER )
- {
- final IPath p = cpe.getPath();
-
- if( p.segmentCount() >= 1 &&
- p.segment( 0 ).equals( WebAppContainer.CONTAINER_ID ) )
- {
- return true;
- }
- }
-
- return false;
- }
-
- private static String resource( final String key,
- final String arg )
- {
- return WebMessages.getResourceString( key, new String[] { arg } );
- }
-
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppContainerInitializer.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppContainerInitializer.java
deleted file mode 100644
index aafcc7654..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppContainerInitializer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.j2ee.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 WebAppContainerInitializer
-
- extends FlexibleProjectContainerInitializer
-
-{
- public void initialize( final IPath path,
- final IJavaProject jproj )
-
- throws CoreException
-
- {
- ( new WebAppContainer( 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 af7511043..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.internal.core.ClasspathEntry;
-
-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);
- }
-
- ClasspathEntry[] ret = new ClasspathEntry[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);
- }
-
- ClasspathEntry[] ret = new ClasspathEntry[list.size()];
- return (IClasspathEntry[]) list.toArray(ret);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IDynamicWebNature.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IDynamicWebNature.java
deleted file mode 100644
index b7b5adb73..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IDynamicWebNature.java
+++ /dev/null
@@ -1,39 +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.core.resources.IContainer;
-import org.eclipse.wst.web.internal.operation.IStaticWebNature;
-
-
-/**
- * Insert the type's description here. Creation date: (10/16/2001 1:40:37 PM)
- *
- * @author: Administrator
- */
-public interface IDynamicWebNature extends IStaticWebNature {
-
- /**
- * Insert the method's description here. Creation date: (10/31/2001 2:26:39 PM)
- *
- * @return org.eclipse.core.resources.IContainer
- */
- IContainer getCSSFolder();
-
-
- /**
- * Insert the method's description here. Creation date: (10/23/2001 2:44:09 PM)
- *
- * @return com.ibm.iwt.webproject.RelationData
- */
- RelationData getRelationData();
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java
deleted file mode 100644
index e8de100ce..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import org.eclipse.jdt.core.IClasspathEntry;
-
-public interface IWebProjectWizardInfo {
- /**
- * Adds entries to the class path for this project
- */
- public void addToClasspathEntries(IClasspathEntry[] entries);
-
- /**
- * Get the name of the specified project Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public String getProjectName();
-
- /**
- * Get the Enterprise Application Project
- */
- public String getEARProjectName();
-
- /**
- * Get the name of the web content folder. If not set then return the current default.
- */
- public String getWebContentName();
-
- /**
- * Set the name of the web content folder
- */
- public void setWebContentName(String name);
-
- /**
- * Get the name of the Java source folder If not set then return the current default.
- */
- public String getJavaSourceName();
-
- /**
- * Set the name of the Java source folder
- */
- public void setJavaSourceName(String name);
-
- /**
- * Return an Object for the assocated properties or null
- */
- public Object getProperty(String propertyName);
-
- /**
- * Set an Object for the assocated properties or null
- */
- public void setProperty(String propertyName, Object value);
-
-
-}
-
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java
deleted file mode 100644
index 9c5053087..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-
-
-/*
- * The IConfigurationConstants are the list of tags that are usuable for specifying a web
- * application parameters via XML
- *
- * @see WebApplicationSpecification for the full DTD
- */
-
-public interface IWebToolingConstants {
-
- public String TRUE = "true"; //$NON-NLS-1$
- public String FALSE = "false"; //$NON-NLS-1$
-
- public String HTTP_PATH_PREFIX = "http://"; //$NON-NLS-1$
- public String INDEX_FILE = "index.html"; //$NON-NLS-1$
- public String HTTP_PARAMETER_SEPARATOR = "?"; //$NON-NLS-1$
- public String CONTENT_LENGTH_HEADER_KEY = "Content-Length"; //$NON-NLS-1$
-
- public String SENTENCE_TERMINATOR = "."; //$NON-NLS-1$
-
- public String POST_COMMAND = "POST"; //$NON-NLS-1$
- public String GET_COMMAND = "GET"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java
deleted file mode 100644
index 1d9eaaaec..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-/**
- * The IWebToolingCoreConstants are the constants required by the ITP core
- */
-public interface IWebToolingCoreConstants {
- public String PLUG_IN_ID = "com.ibm.etools.webtools"; //$NON-NLS-1$
- public String PROP_SERVLET_JAR = "com.ibm.etools.webtools.servletjar"; //$NON-NLS-1$
- public String PROP_WEBAS_JAR = "com.ibm.etools.webtools.webasjar"; //$NON-NLS-1$
- public String PROP_CLIENT_NAME = "com.ibm.etools.webtools.clientname"; //$NON-NLS-1$
- public String PROP_LINK_STYLE = "com.ibm.etools.webtools.linkstyle"; //$NON-NLS-1$
- public String PROP_MODIFY_LINK_PROMPT = "com.ibm.etools.webtools.modifyprompt"; //$NON-NLS-1$
- public String PROP_AUTO_MODIFY_LINK = "com.ibm.etools.webtools.automodify"; //$NON-NLS-1$
- public String JDT_IDENTIFIER = "org.eclipse.jdt.ui"; //$NON-NLS-1$
- public String RUNTIME_IDENTIFIER = "WebNatureRuntime"; //$NON-NLS-1$
- public String DOC_RELATIVE = "DOC_RELATIVE"; //$NON-NLS-1$
- public String DOC_ROOT_RELATIVE = "DOC_ROOT_RELATIVE"; //$NON-NLS-1$
- public String ICON_PATH = "icons"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java
deleted file mode 100644
index 0da8bd107..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java
+++ /dev/null
@@ -1,1076 +0,0 @@
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jem.util.emf.workbench.EMFWorkbenchContextBase;
-import org.eclipse.jem.util.emf.workbench.ProjectResourceSet;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jem.util.emf.workbench.WorkbenchURIConverter;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.application.Module;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEEditModel;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.application.ApplicationPackage;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-import org.eclipse.jst.j2ee.internal.web.taglib.ITaglibRegistry;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.j2ee.webapplication.WebAppResource;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.internal.impl.ComponentCoreURIConverter;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-import org.eclipse.wst.web.internal.operation.ILibModule;
-
-/**
- * @deprecated -
- * Use
- * <p>
- * WebArtifactEdit
- * </p>
- */
-
-public class J2EEWebNatureRuntime extends J2EEModuleNature implements IDynamicWebNature, IWebNatureConstants {
- static protected String PROJECTTYPE_J2EE_VALUE = "J2EE"; //$NON-NLS-1$
- private static final String WEB_PROJECT_12_OVERLAY = "1_2_ovr"; //$NON-NLS-1$
- private static final String WEB_PROJECT_13_OVERLAY = "1_3_ovr"; //$NON-NLS-1$
- private static final String WEB_PROJECT_14_OVERLAY = "1_4_ovr"; //$NON-NLS-1$
- public static final String SERVLETLEVEL_2_2 = "Servlet 2.2"; //$NON-NLS-1$
- public static final String SERVLETLEVEL_2_3 = "Servlet 2.3"; //$NON-NLS-1$
- public static final String SERVLETLEVEL_2_4 = "Servlet 2.4"; //$NON-NLS-1$
- public static final String JSPLEVEL_1_1 = "JSP 1.1"; //$NON-NLS-1$
- public static final String JSPLEVEL_1_2 = "JSP 1.2"; //$NON-NLS-1$
- public static final String JSPLEVEL_2_0 = "JSP 2.0"; //$NON-NLS-1$
- public static final String DEFAULT_JSPLEVEL = JSPLEVEL_1_1;
- public static final String DEFAULT_SERVLETLEVEL = SERVLETLEVEL_2_2;
- // Version number may not change with every release,
- // only when changes necessitate a new version number
- public static int CURRENT_VERSION = 600;
- /*
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE NOTE:
- *
- * If you add any instance variables, make sure to update the resetWebSettings() method if
- * appropriate.
- *
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- */
- public static int instanceCount = 1;
- public int instanceStamp = 0;
- protected RelationData relationData;
- protected String contextRoot = null;
- protected String jspLevel = null;
- protected String servletLevel = null;
- protected ILibModule[] libModules = null;
- protected String[] featureIds = null;
- protected int fVersion = -1;
- private int fWebNatureType = -1;
- //protected WebSettings fWebSettings;
-
- /*
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE NOTE:
- *
- * If you add any instance variables, make sure to update the resetWebSettings() method if
- * appropriate.
- *
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- */
- /**
- * WebNatureRuntime constructor comment.
- */
- public J2EEWebNatureRuntime() {
- super();
- instanceStamp = instanceCount;
- instanceCount++;
- // class WebSettingsModifier implements IResourceChangeListener,
- // IResourceDeltaVisitor {
- //
- // public void resourceChanged(IResourceChangeEvent event) {
- // if (event.getSource() instanceof IWorkspace) {
- // IResourceDelta delta = event.getDelta();
- // switch (event.getType()) {
- // case IResourceChangeEvent.PRE_AUTO_BUILD :
- // if (delta != null) {
- // try {
- // delta.accept(this);
- // } catch (CoreException e) {
- // }
- // }
- // break;
- // }
- // }
- // }
- // public boolean visit(IResourceDelta delta) throws CoreException {
- // if (delta != null) {
- // // get target IResource
- // final IResource resource = delta.getResource();
- // if (resource != null) {
- // if (resource.getType() == IResource.FILE) {
- // // If the websettings file is being modified, reset
- // // all the cached values
- // // in the nature
- // IFile file = (IFile) resource;
- // if
- // ((file.getName().equals(IWebNatureConstants.WEBSETTINGS_FILE_NAME))
- // && (resource.getProject().getName().equals(getProject().getName())))
- // {
- // resetWebSettings();
- // }
- // }
- // }
- // return true;
- // }
- // return false;
- // }
- //
- // }
- // IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // workspace.addResourceChangeListener(new WebSettingsModifier(),
- // IResourceChangeEvent.PRE_AUTO_BUILD);
- }
-
- /*
- * Do nothing with a cvs ignore file for web projects,
- */
- public void addCVSIgnoreFile() {
- //Default nothing
- }
-
- public void addLibDirBuilder() throws CoreException {
- addToFrontOfBuildSpec(J2EEPlugin.LIBDIRCHANGE_BUILDER_ID);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEVersion()
- */
- public int getJ2EEVersion() {
- int j2eeVersion;
- switch (getModuleVersion()) {
- case J2EEVersionConstants.WEB_2_2_ID :
- j2eeVersion = J2EEVersionConstants.J2EE_1_2_ID;
- break;
- case J2EEVersionConstants.WEB_2_3_ID :
- j2eeVersion = J2EEVersionConstants.J2EE_1_3_ID;
- break;
- default :
- j2eeVersion = J2EEVersionConstants.J2EE_1_4_ID;
- }
- return j2eeVersion;
- }
-
- /**
- * Adds a builder to the build spec for the given project.
- */
- protected void addToFrontOfBuildSpec(String builderID) throws CoreException {
- IProjectDescription description = getProject().getDescription();
- ICommand[] commands = description.getBuildSpec();
- boolean found = false;
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(builderID)) {
- found = true;
- break;
- }
- }
- if (!found) {
- ICommand command = description.newCommand();
- command.setBuilderName(builderID);
- ICommand[] newCommands = new ICommand[commands.length + 1];
- System.arraycopy(commands, 0, newCommands, 1, commands.length);
- newCommands[0] = command;
- IProjectDescription desc = getProject().getDescription();
- desc.setBuildSpec(newCommands);
- getProject().setDescription(desc, null);
- }
- }
-
- public Archive asArchive() throws OpenFailureException {
- return null;
- }
-
- public Archive asArchive(boolean shouldExportSource) throws OpenFailureException {
- return null;
- }
-
- /**
- * Configures the project with this nature.
- *
- * @see IProjectNature#configure()
- */
- public void primConfigure() throws CoreException {
- //TODO - Move builders to the operations
- // add Validation Builder to Web Projects' builder list
- ProjectUtilities.addToBuildSpec(J2EEPlugin.VALIDATION_BUILDER_ID, getProject());
- // add LibCopy Builder to Web Projects' builder list
- // Note: since this is the last nature added, we are assuming it will
- // be after the Java builder. May need to be more explicit about this.
- ProjectUtilities.addToBuildSpec(J2EEPlugin.LIBCOPY_BUILDER_ID, getProject());
- addLibDirBuilder();
- super.primConfigure();
- }
-
- protected EditModel createCacheEditModel() {
- return getWebAppEditModelForRead(this);
- }
-
- /**
- * Create a default file for the user given the name (directory relative to the project) and the
- * default contents for the file.
- *
- * @param newFilePath -
- * IPath
- * @param newFileContents -
- * String
- */
- public void createFile(IPath newFilePath, String newFileContents) throws CoreException {
- IPath projectPath = project.getFullPath();
- IWorkspace workspace = J2EEPlugin.getWorkspace();
- createFolder(newFilePath.removeLastSegments(1).toString());
- IFile outputFile = workspace.getRoot().getFile(projectPath.append(newFilePath));
- outputFile.refreshLocal(IResource.DEPTH_INFINITE, null);
- InputStream inputStream = new ByteArrayInputStream(newFileContents.getBytes());
- if (!(outputFile.exists()))
- outputFile.create(inputStream, true, null);
- }
-
- /**
- * Create the folders for the project we have just created.
- *
- * @exception com.ibm.itp.core.api.resources.CoreException
- * The exception description.
- */
- protected void createFolders() throws CoreException {
- // Create the WEB_MODULE directory
- createFolder(getBasicWebModulePath());
- //build for metapath
- if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT) {
- createFolder(getMetaPath().toString());
- super.createFolders();
- }
- // Create the WEB_INF/lib directory
- if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT)
- createFolder(getLibraryPath());
- }
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature
- */
- public Module createNewModule() {
- return ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createWebModule();
- }
-
- /**
- * Create a new nature runtime from the project info
- */
- // public static J2EEWebNatureRuntime createRuntime(WebProjectInfo info)
- // throws CoreException {
- // IProject project = info.getProject();
- // if (!hasRuntime(project)) {
- // addNatureToProject(project, IWebNatureConstants.J2EE_NATURE_ID);
- // J2EEWebNatureRuntime runtime = getRuntime(project);
- // runtime.initializeFromInfo(info);
- // return runtime;
- // }
- // return getRuntime(project);
- // }
- /**
- * Removes this nature from the project.
- *
- * @see IProjectNature#deconfigure
- */
- public void deconfigure() throws CoreException {
- removeFromBuildSpec(J2EEPlugin.LIBDIRCHANGE_BUILDER_ID);
- super.deconfigure();
- }
-
- /*
- * Returns the context root that the server is configured with (also called the web app path).
- * This is the path that the war is placed on within the deployed server. This path must be
- * included as the first segment of a doc relative path specification within an html file.
- */
- public String getContextRoot() {
- if (contextRoot == null || contextRoot.equals("")) {
-// WebSettings settings = getWebSettings();
-// contextRoot = settings.getContextRoot();
-
- ArtifactEdit artifact = null;
- WebArtifactEdit webEdit = null;
-
- try{
- //TODO should this even be using artifact edits?
- //artifact = StructureEdit.getFirstArtifactEditForRead( project );
- webEdit = ( WebArtifactEdit )artifact;
- if(webEdit != null) {
- contextRoot = webEdit.getServerContextRoot();
- }
- }catch (Exception e) {
- e.printStackTrace();
- }finally{
- if( webEdit != null )
- webEdit.dispose();
- }
-
-
- if (contextRoot == null)
- contextRoot = getProject().getName();
- }
- return contextRoot;
- }
-
-// public WebSettings getWebSettings() {
-// if (fWebSettings == null) {
-// fWebSettings = new WebSettings(getProject());
-// }
-// return fWebSettings;
-// }
-
- public IContainer getCSSFolder() {
- return getProject().getFolder(getBasicWebModulePath().append(IWebNatureConstants.CSS_DIRECTORY));
- }
-
- /*
- * See description in IJ2EEWebNature interface Creation date: (10/31/2001 10:21:37 AM) @return
- * org.eclipse.jdt.core.IJavaProject
- */
- public IJavaProject getJ2EEJavaProject() {
- return JemProjectUtilities.getJavaProject(project);
- }
-
- protected IPath getLibraryPath() {
- return getWEBINFPath().append(IWebNatureConstants.LIBRARY_DIRECTORY);
- }
-
- public IContainer getLibraryFolder() {
- return getProject().getFolder(getLibraryPath());
- }
-
- protected String getMetaPathKey() {
- return J2EEConstants.WEB_INF;
- }
-
- /*
- * Returns the root that the server runs off of. In the case of a web project, this is the "Web
- * content" folder. For projects created under V4, this is the webApplication folder.
- */
- public IContainer getModuleServerRoot() {
- return getProject().getFolder(getModuleServerRootName());
- }
-
- /*
- * Returns the name of the module server root directory. For projects created in v4, this is
- * webApplication. For projects created in v5.0, this is Web Content. For projects created in
- * v5.0.1 and later, this is configurable per project by the user.
- */
- public String getModuleServerRootName() {
-// String name = getWebSettings().getWebContentName();
-// if (name == null) {
-// name = J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName();
-// if (name == null || name.length() == 0)
-// name = IWebNatureConstants.WEB_MODULE_DIRECTORY_;
-// }
-// return name;
- return ""; //To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
- }
-
- public void setModuleServerRootName(String name) throws CoreException {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// getWebSettings().setWebContentName(name);
-// getWebSettings().write();
-
- }
-
- /**
- * Return the root location for loading mof resources; defaults to the source folder, subclasses
- * may override
- */
- public IContainer getEMFRoot() {
- return getModuleServerRoot();
- }
-
- /**
- * Return the nature's ID.
- */
- public String getNatureID() {
- return IWebNatureConstants.J2EE_NATURE_ID;
- }
-
- /**
- * Return the ID of the plugin that this nature is contained within.
- */
- protected String getPluginID() {
- return IWebToolingCoreConstants.PLUG_IN_ID;
- }
-
- /**
- * return the inlinks for this project. This is done by asking the relationData to restore
- * itself.
- */
- public RelationData getRelationData() {
- if (relationData == null) {
- relationData = new RelationData();
- relationData.restore(getProject());
- }
- return relationData;
- }
-
- /**
- * Insert the method's description here. Creation date: (10/30/2001 11:12:41 PM)
- *
- * @return org.eclipse.core.resources.IContainer
- */
- public IContainer getRootPublishableFolder() {
- return getModuleServerRoot();
- }
-
- /**
- * Get a WebNatureRuntime that corresponds to the supplied project.
- *
- * @return com.ibm.itp.wt.IWebNature
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- */
- public static J2EEWebNatureRuntime getRuntime(IProject project) {
- try {
- J2EEWebNatureRuntime a = (J2EEWebNatureRuntime) project.getNature(IWebNatureConstants.J2EE_NATURE_ID);
- return a;
- } catch (CoreException e) {
- return null;
- }
- }
-
- public ITaglibRegistry getTaglibRegistry() {
- return WebPlugin.getDefault().getTaglibRegistryManager().getTaglibRegistry(getProject());
- }
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getEditModelKey()
- */
- public String getEditModelKey() {
- return EDIT_MODEL_ID;
- }
-
- /**
- * Returns a web xml model that consists of the MOF model and the DOM model. Important!!!
- * Calling this method increments the use count of this model. When you are done accessing the
- * model, call releaseAccess()!
- */
- public WebEditModel getWebAppEditModelForRead(Object accessorKey) {
- return (WebEditModel) getEditModelForRead(EDIT_MODEL_ID, accessorKey);
- }
-
- /**
- * Returns a web xml model that consists of the MOF model and the DOM model. Important!!!
- * Calling this method increments the use count of this model. When you are done accessing the
- * model, call releaseAccess()!
- */
- public WebEditModel getWebAppEditModelForWrite(Object accessorKey) {
- return (WebEditModel) getEditModelForWrite(EDIT_MODEL_ID, accessorKey);
- }
-
- /**
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getWEBINFPath() {
- return getBasicWebModulePath().append(IWebNatureConstants.INFO_DIRECTORY);
- }
-
- /**
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getDeploymentDescriptorPath() {
- return getWEBINFPath().append(IWebNatureConstants.DEPLOYMENT_DESCRIPTOR_FILE_NAME);
- }
-
- /**
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getWebBindingsPath() {
- if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT)
- return getProjectPath().append(getWEBINFPath()).append(IWebNatureConstants.BINDINGS_FILE_NAME);
-
- return null;
- }
-
- /**
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getWebExtensionsPath() {
- if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT)
- return getProjectPath().append(getWEBINFPath()).append(IWebNatureConstants.EXTENSIONS_FILE_NAME);
-
- return null;
- }
-
- public IPath getBasicWebModulePath() {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings webSettings = getWebSettings();
-// String name = webSettings.getWebContentName();
-// if (name == null) {
-// int version = getVersion();
-// // If created in V5 or beyond
-// if (version != -1 && version >= 500)
-// return IWebNatureConstants.WEB_MODULE_PATH_;
-//
-// return IWebNatureConstants.WEB_MODULE_PATH_V4;
-// }
-// return new Path(name);
- return new Path("");
- }
-
- public IPath getWebModulePath() {
- return getProjectPath().append(getBasicWebModulePath());
- }
-
- /**
- * Insert the method's description here. Creation date: (10/30/2001 5:25:06 PM)
- *
- * @return boolean
- */
- public int getWebNatureType() {
- if (fWebNatureType == -1) {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings settings = getWebSettings();
-// String strType = settings.getProjectType();
- String strType = PROJECTTYPE_J2EE_VALUE;
- if (strType != null) {
- if (strType.equalsIgnoreCase(PROJECTTYPE_J2EE_VALUE))
- fWebNatureType = IWebNatureConstants.J2EE_WEB_PROJECT;
- }
- if (fWebNatureType == -1) {
- // Invalid value, don't make any unnecessary noice and
- // just fix it quietly. find out if web-inf directory
- // exists and take an educated guess
- IContainer webmoduleFolder = getRootPublishableFolder();
- IFolder webinfFolder = ((IFolder) webmoduleFolder).getFolder(IWebNatureConstants.INFO_DIRECTORY);
- if (webinfFolder.exists())
- fWebNatureType = IWebNatureConstants.J2EE_WEB_PROJECT;
- }
- }
- return fWebNatureType;
- }
-
- /*
- * Return the current version number.
- */
- public static int getCurrentVersion() {
- return CURRENT_VERSION;
- }
-
- /*
- * Return the version number stored in the web settings file. The version number is used to
- * determine when the web project was created (i.e., under what product version). The current
- * version number does not necessarily change with each product version -- it's only changed
- * when it becomes necessary to distinguish a new version from a prior version.
- */
- public int getVersion() {
- if (fVersion == -1) {
- try {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// String versionString = getWebSettings().getVersion();
- String versionString = "22";
- if (versionString != null)
- fVersion = Integer.parseInt(versionString);
- } catch (NumberFormatException e) {
- //Do nothing
- }
- }
- return fVersion;
- }
-
- /*
- * Set the version number stored in the web settings file. The version number is used to
- * determine when the web project was created (i.e., under what product version). The current
- * version number does not necessarily change with each product version -- it's only changed
- * when it becomes necessary to distinguish a new version from a prior version.
- */
- public void setVersion(String newVersion) throws CoreException {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// getWebSettings().setVersion(newVersion);
-// getWebSettings().write();
- fVersion = -1;
- }
-
- public IPath getWebSettingsPath() {
- return getProjectPath().append(IWebNatureConstants.WEBSETTINGS_FILE_NAME);
- }
-
- /**
- * Return the MOF Resource (model) representing the Web.xml file.
- */
- protected XMLResource getWebXmiResource() {
- Resource res = getResource(URI.createURI(J2EEConstants.WEBAPP_DD_URI));
- return (XMLResource) res;
- }
-
- /**
- * Insert the method's description here. Creation date: (5/10/2001 3:41:00 PM)
- *
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getWebXMLPath() {
- if (getWebNatureType() == IWebNatureConstants.J2EE_WEB_PROJECT)
- return getProjectPath().append(getWEBINFPath()).append(IWebNatureConstants.DEPLOYMENT_DESCRIPTOR_FILE_NAME);
-
- return null;
- }
-
- /**
- * Return whether or not the project has a runtime created on it.
- *
- * @return boolean
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- */
- public static boolean hasRuntime(IProject project) {
- try {
- return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID);
- } catch (CoreException e) {
- return false;
- }
- }
-
- /**
- * Insert the method's description here. Creation date: (10/31/2001 5:32:12 PM)
- *
- * @param info
- * com.ibm.iwt.webproject.WebProjectInfo
- * @exception org.eclipse.core.runtime.CoreException
- * The exception description.
- */
- public void initializeFromInfo(WebProjectInfo info) throws org.eclipse.core.runtime.CoreException {
- int natureType = info.getWebProjectType();
- fWebNatureType = natureType;
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings webSettings = getWebSettings();
-// webSettings.setProjectType(convertNatureTypeToString(natureType));
-// webSettings.setWebContentName(info.getWebContentName());
-// webSettings.write();
- super.initializeFromInfo(info);
- }
-
- /**
- * Insert the method's description here. Creation date: (11/1/2001 2:25:22 PM)
- *
- * @param builderID
- * java.lang.String
- * @exception org.eclipse.core.runtime.CoreException
- * The exception description.
- */
- protected void removeFromBuildSpec(String builderID) throws org.eclipse.core.runtime.CoreException {
- IProjectDescription description = getProject().getDescription();
- ICommand[] commands = description.getBuildSpec();
- boolean found = false;
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(builderID)) {
- found = true;
- break;
- }
- }
- if (!found) {
- ICommand command = description.newCommand();
- command.setBuilderName(builderID);
- ICommand[] newCommands = new ICommand[commands.length + 1];
- System.arraycopy(commands, 0, newCommands, 1, commands.length);
- newCommands[0] = command;
- IProjectDescription desc = getProject().getDescription();
- desc.setBuildSpec(newCommands);
- getProject().setDescription(desc, null);
- }
- }
-
- public void removeFeatureId(String featureId) throws CoreException {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings webSettings = getWebSettings();
-// webSettings.removeFeatureId(featureId);
-// webSettings.write();
- }
-
- // /*
- // * JEC - made public so the cache can be cleared from the webview's
- // * resource changed listener. Not ideal.
- // */
- // public void resetWebSettings() {
- // fWebSettings = null;
- // contextRoot = null;
- // jspLevel = null;
- // libModules = null;
- // featureIds = null;
- // fVersion = -1;
- // fWebNatureType = -1;
- // }
- public void setContextRoot(String newContextRoot) throws CoreException {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// getWebSettings().setContextRoot(newContextRoot);
-// getWebSettings().write();
- contextRoot = newContextRoot;
- }
-
- public void primaryContributeToContext(EMFWorkbenchContextBase aNewEMFContext) {
- if (emfContext == aNewEMFContext)
- return;
- ModuleCoreNature moduleCoreNature = ModuleCoreNature.getModuleCoreNature(getProject());
- if(moduleCoreNature == null)
- setupNonFlexibleProject(aNewEMFContext);
- else
- setupFlexibleProject(aNewEMFContext);
- }
-
- /**
- * @param aNewEMFContext
- */
- private void setupFlexibleProject(EMFWorkbenchContextBase aNewEMFContext) {
- emfContext = aNewEMFContext;
- getEmfContext().setDefaultToMOF5Compatibility(true);
- //Overriding superclass to use our own URI converter, which knows about binary projects
- ProjectResourceSet projectResourceSet = aNewEMFContext.getResourceSet();
- projectResourceSet.setURIConverter(createURIConverter(getProject(), projectResourceSet));
- /* Flexible projects have their own ResourceFactories and their URI Converters */
-// set.setResourceFactoryRegistry(new J2EEResourceFactoryRegistry());
-// WorkbenchURIConverter conv = initializeWorbenchURIConverter(set);
-// set.setURIConverter(conv);
- initializeCacheEditModel();
- addAdapterFactories(projectResourceSet);
- projectResourceSet.getSynchronizer().addExtender(this); //added so we can be informed of closes to the
- // project.
- //new J2EEResourceDependencyRegister(set); //This must be done after the URIConverter is
- // created.
- }
-
- /**
- * @param project
- * @return
- */
- private URIConverter createURIConverter(IProject aProject, ProjectResourceSet aResourceSet ) {
- return new ComponentCoreURIConverter(aProject, aResourceSet.getSynchronizer());
- }
-
- /**
- * @param aNewEMFContext
- */
- private void setupNonFlexibleProject(EMFWorkbenchContextBase aNewEMFContext) {
- super.primaryContributeToContext(aNewEMFContext);
- WorkbenchURIConverter converter = (WorkbenchURIConverter) aNewEMFContext.getResourceSet().getURIConverter();
- converter.addInputContainer(getProject());
- }
-
- protected String convertNatureTypeToString(int type) {
- return PROJECTTYPE_J2EE_VALUE;
- }
-
- /**
- * Set the web nature's type to either Static (IWebNatureConstants.STATIC_WEB_NATURE) or J2EE
- * (IWebNatureConstants.J2EE_WEB_NATURE)
- *
- * @param newIsStaticWebProject
- * boolean
- */
- public void setWebNatureType(int natureType) throws CoreException {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// getWebSettings().setProjectType(convertNatureTypeToString(natureType));
-// getWebSettings().write();
- fWebNatureType = natureType;
- }
-
- /*
- * @deprecated - Use getModuleVersion() with J2EEVersionConstants
- * @see IJ2EEWebNature#isJSP1_2()
- */
- public boolean isJSP1_2() {
- return getJSPLevel().equals(JSPLEVEL_1_2);
- }
-
- /*
- * @deprecated - Use getModuleVersion() with J2EEVersionConstants
- * @see IJ2EEWebNature#isServlet2_3()
- */
- public boolean isServlet2_3() {
- return SERVLETLEVEL_2_3.equals(getServletLevel());
- }
-
- /*
- * @deprecated - Use getModuleVersion() with J2EEVersionConstants
- * @see IJ2EEWebNature#setIsJSP1_2(boolean)
- */
- /*
- * public void setIsJSP1_2(boolean isJSP1_2) throws CoreException { if (isJSP1_2)
- * setJSPLevel(JSPLEVEL_1_2); else setJSPLevel(JSPLEVEL_1_1); }
- */
- /*
- * @deprecated - Use getModuleVersion() with J2EEVersionConstants
- * @see IJ2EEWebNature#setIsServlet2_3(boolean)
- */
- /*
- * public void setIsServlet2_3(boolean isServlet2_3) throws CoreException { if (isServlet2_3)
- * setServletLevel(SERVLETLEVEL_2_3); else setServletLevel(SERVLETLEVEL_2_2); }
- */
- /*
- * @see IJ2EEWebNature#getJSPLevel()
- */
- public String getJSPLevel() {
- if (jspLevel == null) {
- switch (getModuleVersion()) {
- case J2EEVersionConstants.WEB_2_2_ID :
- jspLevel = JSPLEVEL_1_1;
- break;
- case J2EEVersionConstants.WEB_2_3_ID :
- jspLevel = JSPLEVEL_1_2;
- break;
- case J2EEVersionConstants.WEB_2_4_ID :
- jspLevel = JSPLEVEL_2_0;
- break;
- default :
- jspLevel = DEFAULT_JSPLEVEL;
- }
- }
- return jspLevel;
- }
-
- /**
- * Return the root object, the web-app, from the web.xml DD.
- *
- * used for Read-Only Purpose
- */
- public WebApp getWebApp() {
- return ((WebEditModel) getCacheEditModel()).getWebApp();
- }
-
- /*
- * @see IJ2EEWebNature#getServletLevel()
- */
- public String getServletLevel() {
- WebEditModel editModel = (WebEditModel) getCacheEditModel();
- String retVal = SERVLETLEVEL_2_2;
- if (editModel != null) {
- WebAppResource resource = editModel.getWebXmiResource();
- WebApp app = resource.getWebApp();
- switch (app.getVersionID()) {
- case J2EEVersionConstants.WEB_2_4_ID :
- retVal = SERVLETLEVEL_2_4;
- break;
- case J2EEVersionConstants.WEB_2_3_ID :
- retVal = SERVLETLEVEL_2_3;
- break;
- case J2EEVersionConstants.WEB_2_2_ID :
- default :
- retVal = SERVLETLEVEL_2_2;
- break;
- }
- }
- return retVal;
- }
-
- /*
- * @see IJ2EEWebNature#setJSPLevel(String)
- */
- public void setJSPLevel(String level) throws CoreException {
- if (jspLevel != null && jspLevel.equals(level))
- return;
- String tJspLevel = null;
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings webSettings = getWebSettings();
- if (JSPLEVEL_1_1.equals(level)) {
-// webSettings.setJSPLevel(JSPLEVEL_1_1);
- tJspLevel = JSPLEVEL_1_1;
- } else if (JSPLEVEL_1_2.equals(level)) {
-// webSettings.setJSPLevel(JSPLEVEL_1_2);
- tJspLevel = JSPLEVEL_1_2;
- } else if (JSPLEVEL_2_0.equals(level)) {
-// webSettings.setJSPLevel(JSPLEVEL_2_0);
- tJspLevel = JSPLEVEL_2_0;
- }
-// webSettings.write();
-
- jspLevel = tJspLevel;
- }
-
- //TODO depricate this method and create a new one that uses ints.
- /*
- * @see IJ2EEWebNature#setServletLevel(String)
- */
- public void setServletLevel(String servletLevel) {
- WebEditModel editModel = null;
- try {
- editModel = getWebAppEditModelForWrite(this);
- if (editModel != null) {
- XMLResource resource = editModel.getWebXmiResource();
- if (SERVLETLEVEL_2_3.equals(servletLevel)) {
- servletLevel = SERVLETLEVEL_2_3;
- resource.setDoctypeValues(J2EEConstants.WEBAPP_PUBLICID_2_3, J2EEConstants.WEBAPP_SYSTEMID_2_3);
- } else if (SERVLETLEVEL_2_2.equals(servletLevel)) {
- servletLevel = SERVLETLEVEL_2_2;
- resource.setDoctypeValues(J2EEConstants.WEBAPP_SYSTEMID_2_2, J2EEConstants.WEBAPP_PUBLICID_2_2);
- } else if (SERVLETLEVEL_2_4.equals(servletLevel)) {
- servletLevel = SERVLETLEVEL_2_4;
- resource.setDoctypeValues(null, null);
- } else
- throw new RuntimeException(ProjectSupportResourceHandler.getString("Invalid_Servlet_Level_set_on_WebNature_3_EXC_")); //$NON-NLS-1$
- editModel.saveIfNecessary(this);
- }
- } finally {
- if (editModel != null) {
- editModel.releaseAccess(this);
- }
- }
- }
-
- /*
- * @see IJ2EEWebNature#getLibModules()
- */
- public ILibModule[] getLibModules() {
- if (libModules == null) {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings settings = getWebSettings();
-// libModules = settings.getLibModules();
- if (libModules == null)
- libModules = new ILibModule[0];
- }
- return libModules;
- }
-
- /*
- * @see IJ2EEWebNature#setLibModules(ILibModule[])
- */
- public void setLibModules(ILibModule[] libModules) throws CoreException {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings webSettings = getWebSettings();
-// webSettings.setLibModules(libModules);
-// webSettings.write();
- this.libModules = libModules;
- }
-
- public String[] getFeatureIds() {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings settings = getWebSettings();
-// featureIds = settings.getFeatureIds();
- if (featureIds == null)
- featureIds = new String[0];
- return featureIds;
- }
-
- public void setFeatureIds(String[] featureIds) throws CoreException {
-// To do : Needs rework for flexibile project ModuleCore.getFirstArtifactEditForRead
-// WebSettings webSettings = getWebSettings();
-// webSettings.setFeatureIds(featureIds);
-// webSettings.write();
- }
-
- /**
- * @deprecated - Use getJ2EEVersion() with J2EEVersionConstants
- * @see IJ2EENature#isJ2EE1_3()
- */
- public boolean isJ2EE1_3() {
- // Removed for Defect 218792 - Performance
- // return isServlet2_3() || isJSP1_2();
- return getJ2EEVersion() == J2EEVersionConstants.J2EE_1_3_ID;
- }
-
- /**
- * @see IBaseWebNature#isJ2EE()
- */
- public boolean isJ2EE() {
- return true;
- }
-
- /**
- * @see IBaseWebNature#isStatic()
- */
- public boolean isStatic() {
- return false;
- }
-
- public String getOverlayIconName() {
- switch (getJ2EEVersion()) {
- case J2EEVersionConstants.J2EE_1_2_ID :
- return WEB_PROJECT_12_OVERLAY;
- case J2EEVersionConstants.J2EE_1_3_ID :
- return WEB_PROJECT_13_OVERLAY;
- case J2EEVersionConstants.J2EE_1_4_ID :
- default :
- return WEB_PROJECT_14_OVERLAY;
- }
- }
-
- public int getDeploymentDescriptorType() {
- return XMLResource.WEB_APP_TYPE;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getDeploymentDescriptorRoot()
- */
- public EObject getDeploymentDescriptorRoot() {
- return getWebApp();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getVersionFromModuleFile()
- */
- protected int getVersionFromModuleFile() {
- WebApp ddRoot = getWebApp();
- if (ddRoot != null) {
- return ddRoot.getVersionID();
- }
- return J2EEVersionConstants.WEB_2_4_ID;
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEEditModelForRead(java.lang.Object)
- * deprecated
- * Use
- * <p>
- * WebArtifactEdit.getWebArtifactEditForRead(WorkbenchComponent)
- * </p>
- */
- public J2EEEditModel getJ2EEEditModelForRead(Object accessorKey) {
- return getWebAppEditModelForRead(accessorKey);
- }
-
- /**
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EENature#getJ2EEEditModelForWrite(java.lang.Object)
- * @deprecated
- * Use
- * <p>
- * WebArtifactEdit.getWebArtifactEditForWrite(WorkbenchComponent)
- * </p>
- */
- public J2EEEditModel getJ2EEEditModelForWrite(Object accessorKey) {
- return getWebAppEditModelForWrite(accessorKey);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntimeUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntimeUtilities.java
deleted file mode 100644
index 13ea988ea..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntimeUtilities.java
+++ /dev/null
@@ -1,183 +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.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-import org.eclipse.wst.web.internal.operation.IBaseWebNature;
-
-
-public class J2EEWebNatureRuntimeUtilities {
- /**
- * WebNatureRuntimeHelper constructor comment.
- */
- public J2EEWebNatureRuntimeUtilities() {
- super();
- }
-
- /**
- * Adds a nauture to a project
- */
- protected static void addNatureToProject(IProject proj, String natureId) throws CoreException {
- ProjectUtilities.addNatureToProject(proj, natureId);
- }
-
- /**
- * Create a new nature runtime from the project info
- */
- public static IBaseWebNature createRuntime(WebProjectInfo info) throws CoreException {
- IProject project = info.getProject();
-
- // refresh WebProjectInfo for existing runtime
- if (hasRuntime(project)) {
- // this is for when the web nature is being changed, such
- // as from converting from static to j2ee
- IBaseWebNature runtime = getRuntime(project);
- if (J2EEWebNatureRuntime.hasRuntime(project))
- ((J2EEWebNatureRuntime) runtime).initializeFromInfo(info);
-
- return runtime;
- }
- if (info.getWebProjectType() == IWebNatureConstants.J2EE_WEB_PROJECT)
- addNatureToProject(project, IWebNatureConstants.J2EE_NATURE_ID);
- IBaseWebNature runtime = getRuntime(project);
- if (info.getWebProjectType() == IWebNatureConstants.J2EE_WEB_PROJECT)
- ((J2EEWebNatureRuntime) runtime).initializeFromInfo(info);
- return runtime;
-
- }
-
- /**
- * Creation date: (10/22/2001 2:17:25 PM)
- *
- * @return org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IBaseWebNature
- */
- public static IBaseWebNature getRuntime(IProject project) {
- if (project == null)
- return null;
- try {
- IBaseWebNature nature = null;
- if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID))
- nature = (IBaseWebNature) project.getNature(IWebNatureConstants.J2EE_NATURE_ID);
- return nature;
- } catch (CoreException e) {
- return null;
- }
- }
-
-
- /**
- * Return the J2EE Web Nature for the given project. If the the project does not have a J2EE Web
- * Nature, then return null.
- *
- * @param project
- * The project to get the nature from
- * @return IJ2EEWebNature The J2EE Web Nature
- */
- public static J2EEWebNatureRuntime getJ2EERuntime(IProject project) {
- IBaseWebNature nature = getRuntime(project);
- if (nature != null) {
- if (nature.isJ2EE())
- return (J2EEWebNatureRuntime) nature;
- }
- return null;
- }
-
- /**
- * Return whether or not the project has a runtime created on it.
- *
- * @return boolean
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- * @deprecated
- */
- public static boolean hasRuntime(IProject project) {
- try {
- return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID);
- } catch (CoreException e) {
- return false;
- }
- }
-
- /**
- * Return whether or not the project has a runtime created on it.
- *
- * @return boolean
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- */
- public static boolean hasJ2EERuntime(IProject project) {
- if (project == null || !project.exists()) {
- return false;
- }
- try {
- return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID);
- } catch (CoreException e) {
- return false;
- }
- }
-
- public static String getDefaultJ2EEWebContentName() {
- return J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName();
- }
-
- public static String getDefaultStaticWebContentName() {
- return J2EEPlugin.getDefault().getJ2EEPreferences().getStaticWebContentFolderName();
- }
-
- public static IPath getDefaultJ2EEWebContentPath() {
- return new Path(getDefaultJ2EEWebContentName());
- }
-
- public static String getContextRootFromWebProject(IProject project) {
-
- // get uri from web app display name, and get context root from web nature
- IBaseWebNature nature = J2EEWebNatureRuntimeUtilities.getRuntime(project);
- String contextRoot = ""; //$NON-NLS-1$
- contextRoot = nature.getContextRoot();
-
- // WebEditModel webEditModel = null;
- // try {
- // webEditModel = (nature.isStatic())
- // ? null
- // :
- // ((J2EEWebNatureRuntime)nature).getWebAppEditModelForRead(WebNatureRuntimeUtilities.this);
- // contextRoot = nature.getContextRoot();
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // finally {
- // if (webEditModel != null)
- // webEditModel.releaseAccess(WebNatureRuntimeUtilities.this);
- // }
- return contextRoot;
- }
-
- public static IPath getDefaultWEBINFPath() {
- return getDefaultJ2EEWebContentPath().append(IWebNatureConstants.INFO_DIRECTORY);
- }
-
- public static IPath getDefaultWebOutputFolderPath() {
- return getDefaultWEBINFPath().append(IWebNatureConstants.CLASSES_DIRECTORY);
- }
-
- public static IPath getWebOutputFolderPath(String webContentName) {
- return new Path(webContentName).append(IWebNatureConstants.INFO_DIRECTORY).append(IWebNatureConstants.CLASSES_DIRECTORY);
- }
-
- public static String getDefaultJavaSourceName() {
- return J2EEPlugin.getDefault().getJ2EEPreferences().getJavaSourceFolderName();
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibDirBuilder.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibDirBuilder.java
deleted file mode 100644
index 54d960356..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/LibDirBuilder.java
+++ /dev/null
@@ -1,366 +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 Mar 25, 2004
- *
- * To change the template for this generated file go to Window - Preferences - Java - Code
- * Generation - Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-
-public class LibDirBuilder extends IncrementalProjectBuilder implements IResourceDeltaVisitor {
-
- //$NON-NLS-1$
- public static boolean TRACING = false;
- protected IProgressMonitor pMonitor = null;
-
- /**
- * LibDirChangeListener constructor comment.
- */
- public LibDirBuilder() {
- //Default constructor
- }
-
- /**
- * Implemements a method in <code>IncrementalProjectBuilder</code>.
- *
- * @see IncrementalProjectBuilder
- */
- protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
- IResourceDelta delta = getDelta(getProject());
- boolean isFullBuild = (kind == IncrementalProjectBuilder.FULL_BUILD) || (delta == null);
- try {
- if (isFullBuild) {
- synch(getProject(), monitor);
- } else {
- pMonitor = monitor;
- delta.accept(this);
- }
- } catch (CoreException ex) {
- Logger.getLogger().log(ex);
- }
- return null;
- }
-
- /**
- * Adds a new entry to the java runtime class path Creation date: (4/12/2001 1:22:03 PM)
- *
- * @return boolean
- * @param libentry_path
- * java.lang.String
- */
- protected static boolean createLibEntry(IJavaProject javaProject, IPath library_path) {
- boolean added = false;
-
- try {
- WebProjectInfo projectInfo = new WebProjectInfo();
- projectInfo.setProjectName(javaProject.getProject().getName());
-
- IClasspathEntry[] cp = javaProject.getRawClasspath();
-
- //Try to make an entry for the java class path
- IClasspathEntry entry = JavaCore.newLibraryEntry(library_path, null, null);
-
- boolean addEntry = true;
-
- // Before the jar is added, search the existing classpath to make sure
- // it dose not already exist.
- for (int i = 0; i < cp.length; i++) {
- if (cp[i].equals(entry)) {
- addEntry = false;
-
- }
-
- }
-
- // Finally, add the jar if necessary
-
- if (addEntry) {
-
- IClasspathEntry[] newPath = new IClasspathEntry[cp.length + 1];
- int i = 0;
- for (i = 0; i < cp.length; i++) {
- if (i < cp.length) {
- newPath[i] = cp[i];
- }
-
- }
- newPath[i] = entry;
-
- javaProject.setRawClasspath(newPath, null);
-
- }
-
- added = true;
-
- } catch (JavaModelException ex) {
- Logger.getLogger().log(ex);
- }
- return added;
- }
-
- /**
- * Removes entry to the java runtime class path Creation date: (4/12/2001 1:22:03 PM)
- *
- * @return boolean
- * @param libentry_path
- * java.lang.String
- */
- protected static boolean removeLibEntry(IJavaProject javaProject, IPath library_path) {
- boolean added = false;
- try {
- WebProjectInfo projectInfo = new WebProjectInfo();
- projectInfo.setProjectName(javaProject.getProject().getName());
-
- IClasspathEntry[] cp = javaProject.getRawClasspath();
-
- //Make a class path entry to match with one you will remove
- IClasspathEntry entry = JavaCore.newLibraryEntry(library_path, null, null);
-
- int found = -1;
- // Before the jar is added, search the existing classpath to make sure
- // it dose not already exist.
- for (int i = 0; i < cp.length; i++) {
- if (cp[i].getPath().equals(entry.getPath())) {
- found = i;
- }
-
- }
-
- // Finally, remove the jar if necessary
-
- if (found != -1) {
- IClasspathEntry[] newPath = new IClasspathEntry[cp.length - 1];
- int i = 0;
- int pos = 0;
- for (i = 0; i <= newPath.length; i++) {
- if (i != found) {
- newPath[pos++] = cp[i];
- }
- }
-
- javaProject.setRawClasspath(newPath, null);
- }
-
- added = true;
-
- } catch (JavaModelException ex) {
- Logger.getLogger().log(ex);
- }
- return added;
- }
-
- /**
- * Informs this builder that it is being started by the build management infrastructure. By the
- * time this method is run, the builder's project is available and
- * <code>setInitializationData</code> has been called.
- *
- * @see BaseBuilder#startupOnInitialize()
- */
- protected void startupOnInitialize() {
- super.startupOnInitialize();
-
- if (TRACING)
- Logger.getLogger().log(getClass().getName() + ProjectSupportResourceHandler.getString("24concat_INFO_", //$NON-NLS-1$
- (new Object[]{getProject()})));
- //$NON-NLS-1$ = ".startupOnInitialize() for "
-
- }
-
- /**
- * 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.getString("Sychronize_Class_Path_UI_"), 4); //$NON-NLS-1$
- //$NON-NLS-1$ = "Sychronize Class Path"
-
- IContainer lib_folder = WebPropertiesUtil.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.getString("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.getString("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.getString("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.getString("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.getString("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 boolean visit(IResourceDelta subdelta) throws CoreException {
- //Pull out resource
- try {
- IResource resource = subdelta.getResource();
-
- if (resource.getType() == IResource.FILE) {
- String filePath = subdelta.getFullPath().toString();
- //only allow .jar or .zip
- if (filePath.toLowerCase().endsWith(".jar") //$NON-NLS-1$
- || filePath.toLowerCase().endsWith(".zip")) { //$NON-NLS-1$
- IProject project = resource.getProject();
- IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
- IPath lib_path = lib_path = project.getFullPath().append(WebPropertiesUtil.getWebLibFolder(project).getProjectRelativePath());
- int file_seg_count = subdelta.getFullPath().segmentCount();
- int lib_path_seg_count = lib_path.segmentCount();
-
- //File must be in the lib path and not a subdir
- if (filePath.startsWith(lib_path.toString()) && file_seg_count == lib_path_seg_count + 1) { //
- // Find out what happened
- //
- int kind = subdelta.getKind();
- switch (kind) {
-
- case IResourceDelta.ADDED :
- createLibEntry(javaProject, new Path(filePath));
- break;
- case IResourceDelta.REMOVED :
- removeLibEntry(javaProject, new Path(filePath));
- break;
- case IResourceDelta.ADDED_PHANTOM :
- break;
- case IResourceDelta.REMOVED_PHANTOM :
- break;
- case IResourceDelta.CHANGED :
- break;
- }
-
- }
- }
- } else if (resource.getType() == IResource.PROJECT) {
- synch(((IProject) resource), pMonitor);
- }
- } catch (ClassCastException ex) {
- //ignore it just means this is not a web project
- }
- return true;
- }
-} \ 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/ProjectSupportResourceHandler.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ProjectSupportResourceHandler.java
deleted file mode 100644
index 7bfab6af5..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ProjectSupportResourceHandler.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-/*
- * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2002 - All Rights Reserved. US
- * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
- * Schedule Contract with IBM Corp.
- */
-
-/*
- * Licensed Material - Property of IBM (C) Copyright IBM Corp. 2001 - All Rights Reserved. US
- * Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
- * Schedule Contract with IBM Corp.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class ProjectSupportResourceHandler {
-
- private static ResourceBundle fgResourceBundle;
-
- /**
- * Returns the resource bundle used by all classes in this Project
- */
- public static ResourceBundle getResourceBundle() {
- try {
- return ResourceBundle.getBundle("ProjectSupport");//$NON-NLS-1$
- } catch (MissingResourceException e) {
- // does nothing - this method will return null and
- // getString(String) will return the key
- // it was called with
- }
- return null;
- }
-
- public static String getString(String key) {
- if (fgResourceBundle == null) {
- fgResourceBundle = getResourceBundle();
- }
-
- if (fgResourceBundle != null) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
- }
- }
- return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
-
- }
-
- public static String getString(String key, Object[] args) {
-
- try {
- return MessageFormat.format(getString(key), args);
- } catch (IllegalArgumentException e) {
- return getString(key);
- }
-
- }
-
- public static String getString(String key, Object[] args, int x) {
-
- return getString(key);
- }
-} \ 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 5e36d97b2..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java
+++ /dev/null
@@ -1,993 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-
-
-import java.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 java.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;
-
-
-/**
- * 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.getString("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.getString("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;
- }
-} \ No newline at end of file
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/SynchronizeWLPoperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/SynchronizeWLPoperation.java
deleted file mode 100644
index e7fc305a6..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/SynchronizeWLPoperation.java
+++ /dev/null
@@ -1,85 +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 15, 2003
- */
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetHelper;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.web.internal.operation.ILibModule;
-
-/**
- * Given a Web Project, this operation will sychronize all its Web Library Projects (WLPs), i.e., it
- * will change the target server of all WLPs to that of the Web Project.
- *
- * @author Pratik Shah
- */
-public class SynchronizeWLPoperation implements IHeadlessRunnableWithProgress {
- private IProject prj;
-
- /**
- * Constructor
- *
- * @param webProject
- * A Web Project whose WLPs' target servers have to be changed
- */
- public SynchronizeWLPoperation(IProject webProject) {
- prj = webProject;
- }
-
- /**
- * Synchronizes all WLPs to have the same target server as the given Web project.
- *
- * @see org.eclipse.jst.j2ee.internal.internal.operations.IHeadlessRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- IRuntime target = ServerTargetUtil.getServerTarget(prj.getName());
- ILibModule[] wlps = getLibModules();
- monitor.beginTask(ProjectSupportResourceHandler.getString("Sync_WLP_Op"), wlps.length); //$NON-NLS-1$
- for (int i = 0; i < wlps.length; i++) {
- IProject module = wlps[i].getProject();
- if (target != null) {
- ServerTargetHelper.cleanUpNonServerTargetClasspath(module);
- try {
- ServerCore.getProjectProperties(module).setRuntimeTarget(target, monitor);
- } catch (CoreException ce) {
- // TODO - handle exception
- }
- }
- monitor.worked(1);
- }
- monitor.done();
- }
-
- protected ILibModule[] getLibModules() {
- //TODO this will throw class cast exception, do we use ILibModule anymore?
- WebArtifactEdit webEdit = null;
- try {
- //TODO migrate to flex project
- //webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead(prj);
- if (webEdit != null)
- return (ILibModule[]) webEdit.getLibModules();
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
- return new ILibModule[] {};
- }
-} \ 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/WebContentResourceChangeListener.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebContentResourceChangeListener.java
deleted file mode 100644
index be77ae717..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebContentResourceChangeListener.java
+++ /dev/null
@@ -1,99 +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.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-
-
-/*
- * This class listens for renames of a web project's web content folder. If the folder is renamed,
- * the .websettings files is updated as well as the Java output folder.
- */
-public class WebContentResourceChangeListener implements IResourceChangeListener {
-
- /**
- * @see IResourceChangeListener#resourceChanged
- */
- public void resourceChanged(final IResourceChangeEvent event) {
- processDelta(event.getDelta());
- }
-
-
- private void processDelta(IResourceDelta delta) {
- // Get the affected resource
- IResource resource = delta.getResource();
-
- switch (resource.getType()) {
- case IResource.ROOT :
- // Iterate over changed projects under the root
- IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED);
- for (int i = 0; i < affectedChildren.length; i++) {
- processDelta(affectedChildren[i]);
- }
- break;
-
- case IResource.PROJECT :
- // Only process web projects
- /* IBaseWebNature nature = ModuleCore.getModuleCoreNature(org.eclipse.emf.common.util.URI.createURI("ADD MODULE URI"));
- if (nature != null)
- processWebProject(delta, (IProject) resource, nature);*/
- return;
-
- default :
- return;
- }
- }
-
-
- /*
- * If renaming web content folder, then updated project properties.
- */
- private void processWebProject(IResourceDelta delta, IProject project) {
- IResourceDelta[] changedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED);
- if (changedChildren.length == 1)
- WebPropertiesUtil.synch(project, new NullProgressMonitor());
- IResourceDelta[] removedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED);
- if (removedChildren.length != 1 || !removedChildren[0].getResource().equals(getModuleServerRoot(project)))
- return;
- IResourceDelta[] addedChildren = delta.getAffectedChildren(IResourceDelta.ADDED);
- if (addedChildren.length != 1)
- return;
- IPath newPath = addedChildren[0].getProjectRelativePath();
- if (newPath.segmentCount() != 1)
- return;
- String newName = newPath.segment(0);
- try {
- WebPropertiesUtil.updateWebContentNamePropertiesOnly(project, newName, new NullProgressMonitor());
- } catch (CoreException e) {
- //Ignore
- }
- }
-
- protected IResource getModuleServerRoot(IProject project) {
- WebArtifactEdit webEdit = null;
- try {
- //TODO migrate to workbench components
- //webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead(project);
- return (IResource) webEdit.getDeploymentDescriptorResource();
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModel.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModel.java
deleted file mode 100644
index bebb8748c..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModel.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.common.XMLResource;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.j2ee.webapplication.WebAppResource;
-import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
-import org.eclipse.jst.j2ee.webapplication.WelcomeFile;
-import org.eclipse.jst.j2ee.webapplication.WelcomeFileList;
-import org.eclipse.jst.j2ee.webservice.wsclient.WebServicesResource;
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-
-/**
- * @deprecated
- * Use
- * <p>
- * WebArtifactEdit
- * </p>
- *
- */
-
-public class WebEditModel extends org.eclipse.jst.j2ee.internal.J2EEEditModel {
- /**
- * @param editModelID
- * @param context
- * @param readOnly
- */
- public WebEditModel(String editModelID, EMFWorkbenchContext context, boolean readOnly) {
- super(editModelID, context, readOnly);
- }
-
- /**
- * @param editModelID
- * @param context
- * @param readOnly
- * @param knownResourceURIs
- * @param shouldAccessUnkownURIsAsReadOnly
- */
- public WebEditModel(String editModelID, EMFWorkbenchContext context, boolean readOnly, boolean accessUnknownResourcesAsReadOnly) {
- super(editModelID, context, readOnly, accessUnknownResourcesAsReadOnly);
-
- }
-
- // TODO -- mdelder isn't sure about this and needs to talk to jsholl
-/* public J2EEWebNatureRuntime getWebNature() {
- return J2EEWebNatureRuntime.getRuntime(getProject());
- }*/
-
- /**
- * Return the root object, the web app, from the web.xml DD.
- */
- public WebApp getWebApp() {
- Resource dd = getWebXmiResource();
- if (dd != null) {
- EList extent = dd.getContents();
- if (extent.size() > 0) {
- Object webApp = getRoot(dd);
- if (webApp instanceof WebApp)
- return (WebApp) webApp;
- }
- }
- return null;
- }
-
-
- public WebAppResource getWebXmiResource() {
- return (WebAppResource) getResource(J2EEConstants.WEBAPP_DD_URI_OBJ);
- }
-
- public XMLResource getDeploymentDescriptorResource() {
- return getWebXmiResource();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel#getRootObject()
- */
- public Object getRootObject() {
- return getWebApp();
- }
-
- public Resource makeDeploymentDescriptorWithRoot() {
- org.eclipse.jst.j2ee.internal.common.XMLResource res = (org.eclipse.jst.j2ee.internal.common.XMLResource) createResource(J2EEConstants.WEBAPP_DD_URI_OBJ);
- //TODO need to verify moduleVersion()
- res.setModuleVersionID(getJ2EEVersion());
- addWebAppIfNecessary(res);
- return res;
- }
-
- protected int getJ2EEVersion() {
- WebArtifactEdit webEdit = null;
- try {
- //TODO should this even be using artifact edits?
- //webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead(project);
- if (webEdit != null)
- return webEdit.getJ2EEVersion();
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
- return 0;
- }
-
- /**
- * @param res
- */
- private void addWebAppIfNecessary(XMLResource res) {
- if (res != null && res.getContents().isEmpty()) {
- WebApp webApp = WebapplicationFactory.eINSTANCE.createWebApp();
- res.getContents().add(webApp);
- webApp.setDisplayName(getProject().getName());
- res.setID(webApp, J2EEConstants.WEBAPP_ID);
-
- WelcomeFileList wList = WebapplicationFactory.eINSTANCE.createWelcomeFileList();
- webApp.setFileList(wList);
- List files = wList.getFile();
- WelcomeFile file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("index.html"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("index.htm"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("index.jsp"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("default.html"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("default.htm"); //$NON-NLS-1$
- files.add(file);
- file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
- file.setWelcomeFile("default.jsp"); //$NON-NLS-1$
- files.add(file);
- }
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel#get13WebServicesClientResource()
- */
- public WebServicesResource get13WebServicesClientResource() {
- return (WebServicesResource) getResource(J2EEConstants.WEB_SERVICES_CLIENT_WEB_INF_DD_URI_OBJ);
- }
-
- public String getDevelopmentAcivityID() {
- return WEB_DEV_ACTIVITY_ID;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModelFactory.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModelFactory.java
deleted file mode 100644
index 1b3b5d6a8..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebEditModelFactory.java
+++ /dev/null
@@ -1,58 +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 Oct 27, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.util.Map;
-
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory;
-
-
-/**
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- * @deprecated
- * Use
- * <p>
- * WebArtifactEdit
- * </p>
- */
-public class WebEditModelFactory extends EditModelFactory {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#createEditModelForRead(java.lang.String,
- * org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext)
- */
- public EditModel createEditModelForRead(String editModelID, EMFWorkbenchContext context, Map params) {
- return new WebEditModel(editModelID, context, true, isLoadKnownResourcesAsReadOnly());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#createEditModelForWrite(java.lang.String,
- * org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext)
- */
- public EditModel createEditModelForWrite(String editModelID, EMFWorkbenchContext context, Map params) {
- return new WebEditModel(editModelID, context, false, isLoadKnownResourcesAsReadOnly());
- }
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebNatureRuntimeUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebNatureRuntimeUtilities.java
deleted file mode 100644
index 54fd28350..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebNatureRuntimeUtilities.java
+++ /dev/null
@@ -1,230 +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.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-import org.eclipse.wst.web.internal.operation.IBaseWebNature;
-import org.eclipse.wst.web.internal.operation.StaticWebNatureRuntime;
-
-
-public class WebNatureRuntimeUtilities {
- /**
- * WebNatureRuntimeHelper constructor comment.
- */
- public WebNatureRuntimeUtilities() {
- super();
- }
-
- /**
- * Adds a nauture to a project
- */
- protected static void addNatureToProject(IProject proj, String natureId) throws CoreException {
- ProjectUtilities.addNatureToProject(proj, natureId);
- }
-
- /**
- * Create a new nature runtime from the project info
- */
- public static IBaseWebNature createRuntime(WebProjectInfo info) throws CoreException {
- IProject project = info.getProject();
-
- // refresh WebProjectInfo for existing runtime
- if (hasRuntime(project)) {
- // this is for when the web nature is being changed, such
- // as from converting from static to j2ee
- IBaseWebNature runtime = getRuntime(project);
-
- if (J2EEWebNatureRuntime.hasRuntime(project))
- ((J2EEWebNatureRuntime) runtime).initializeFromInfo(info);
-
-
- return runtime;
- }
- if (info.getWebProjectType() == IWebNatureConstants.J2EE_WEB_PROJECT)
- addNatureToProject(project, IWebNatureConstants.J2EE_NATURE_ID);
- else
- addNatureToProject(project, IWebNatureConstants.STATIC_NATURE_ID);
-
- IBaseWebNature runtime = getRuntime(project);
- if (info.getWebProjectType() == IWebNatureConstants.J2EE_WEB_PROJECT)
- ((J2EEWebNatureRuntime) runtime).initializeFromInfo(info);
- //No longer supporting for static projects
-// else
-// ((StaticWebNatureRuntime) runtime).initializeFromInfo(info);
-
- return runtime;
-
- }
-
- /**
- * Creation date: (10/22/2001 2:17:25 PM)
- *
- * @return org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IBaseWebNature
- */
- public static IBaseWebNature getRuntime(IProject project) {
- if (project == null)
- return null;
- try {
- IBaseWebNature nature;
- if (project.hasNature(IWebNatureConstants.J2EE_NATURE_ID))
- nature = (IBaseWebNature) project.getNature(IWebNatureConstants.J2EE_NATURE_ID);
- else
- nature = (IBaseWebNature) project.getNature("org.eclipse.wst.web.StaticWebNature");
- return nature;
- } catch (CoreException e) {
- return null;
- }
- }
-
-
- /**
- * Return the J2EE Web Nature for the given project. If the the project does not have a J2EE Web
- * Nature, then return null.
- *
- * @param project
- * The project to get the nature from
- * @return IJ2EEWebNature The J2EE Web Nature
- */
- public static J2EEWebNatureRuntime getJ2EERuntime(IProject project) {
- IBaseWebNature nature = getRuntime(project);
- if (nature != null) {
- if (nature.isJ2EE())
- return (J2EEWebNatureRuntime) nature;
- }
- return null;
- }
-
- /**
- * Return the J2EE Web Nature for the given project. If the the project does not have a J2EE Web
- * Nature, then return null.
- *
- * @param project
- * The project to get the nature from
- * @return IJ2EEWebNature The J2EE Web Nature
- */
- public static StaticWebNatureRuntime getStaticRuntime(IProject project) {
- IBaseWebNature nature = getRuntime(project);
- if (nature != null) {
- if (nature.isStatic())
- return (StaticWebNatureRuntime) nature;
- }
- return null;
- }
-
- /**
- * Return whether or not the project has a runtime created on it.
- *
- * @return boolean
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- * @deprecated
- */
- public static boolean hasRuntime(IProject project) {
- try {
- return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID);
- } catch (CoreException e) {
- return false;
- }
- }
-
- /**
- * Return whether or not the project has a runtime created on it.
- *
- * @return boolean
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- */
- public static boolean hasStaticRuntime(IProject project) {
- if (project == null || !project.exists()) {
- return false;
- }
- try {
- return project.hasNature(IWebNatureConstants.STATIC_NATURE_ID);
- } catch (CoreException e) {
- return false;
- }
- }
-
- /**
- * Return whether or not the project has a runtime created on it.
- *
- * @return boolean
- * @param project
- * com.ibm.itp.core.api.resources.IProject
- */
- public static boolean hasJ2EERuntime(IProject project) {
- if (project == null || !project.exists()) {
- return false;
- }
- try {
- return project.hasNature(IWebNatureConstants.J2EE_NATURE_ID);
- } catch (CoreException e) {
- return false;
- }
- }
-
- public static String getDefaultJ2EEWebContentName() {
- return J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName();
- }
-
- public static String getDefaultStaticWebContentName() {
- return J2EEPlugin.getDefault().getJ2EEPreferences().getStaticWebContentFolderName();
- }
-
- public static IPath getDefaultJ2EEWebContentPath() {
- return new Path(getDefaultJ2EEWebContentName());
- }
-
- public static String getContextRootFromWebProject(IProject project) {
-
- // get uri from web app display name, and get context root from web nature
- IBaseWebNature nature = WebNatureRuntimeUtilities.getRuntime(project);
- String contextRoot = ""; //$NON-NLS-1$
- contextRoot = nature.getContextRoot();
-
- // WebEditModel webEditModel = null;
- // try {
- // webEditModel = (nature.isStatic())
- // ? null
- // :
- // ((J2EEWebNatureRuntime)nature).getWebAppEditModelForRead(WebNatureRuntimeUtilities.this);
- // contextRoot = nature.getContextRoot();
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // finally {
- // if (webEditModel != null)
- // webEditModel.releaseAccess(WebNatureRuntimeUtilities.this);
- // }
- return contextRoot;
- }
-
- public static IPath getDefaultWEBINFPath() {
- return getDefaultJ2EEWebContentPath().append(IWebNatureConstants.INFO_DIRECTORY);
- }
-
- public static IPath getDefaultWebOutputFolderPath() {
- return getDefaultWEBINFPath().append(IWebNatureConstants.CLASSES_DIRECTORY);
- }
-
- public static IPath getWebOutputFolderPath(String webContentName) {
- return new Path(webContentName).append(IWebNatureConstants.INFO_DIRECTORY).append(IWebNatureConstants.CLASSES_DIRECTORY);
- }
-
- public static String getDefaultJavaSourceName() {
- return J2EEPlugin.getDefault().getJ2EEPreferences().getJavaSourceFolderName();
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectFeatureUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectFeatureUpdateOperation.java
deleted file mode 100644
index 870fa5b9a..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectFeatureUpdateOperation.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
-
-
-/**
- * @version 1.0
- * @author
- */
-public class WebProjectFeatureUpdateOperation implements IHeadlessRunnableWithProgress {
-
- protected WebProjectInfo webProjectInfo;
- //protected J2EEWebNatureRuntime nature;
-
-
- public WebProjectFeatureUpdateOperation(WebProjectInfo projectInfo) {
- webProjectInfo = projectInfo;
- IProject project = webProjectInfo.getProject();
- //nature = (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(project);
- }
-
- /*
- * @see IHeadlessRunnableWithProgress#run(IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-
- String[] featureIDs = webProjectInfo.getFeatureIds();
-
- try {
-
- //TODO set featureID's on module
-
- /* if (featureIDs != null && featureIDs.length > 0)
- nature.setFeatureIds(featureIDs);*/
-
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
-
- }
-
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectInfo.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectInfo.java
deleted file mode 100644
index 15c6d26d8..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectInfo.java
+++ /dev/null
@@ -1,642 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-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.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-
-
-/**
- * The WebProjectInfo is used to set up the Java project info like the J2EE specification level,java
- * class path,project nature project location, associated EAR project location, for a new Web
- * project creation
- *
- * @deprecated
- * Use
- * <p>
- * WebArtifactEdit
- * </p>
- */
-
-public class WebProjectInfo extends org.eclipse.jst.j2ee.internal.project.J2EEJavaProjectInfo implements IWebProjectWizardInfo {
-
- private String fContextRoot = null;
-
- public boolean fJ2EEWebProject = true;
-
- public final static String J2EE_VERSION_1_2 = "J2EE_1_2"; //$NON-NLS-1$
- public final static String J2EE_VERSION_1_3 = "J2EE_1_3"; //$NON-NLS-1$
- public final static String J2EE_VERSION_1_4 = "J2EE_1_4"; //$NON-NLS-1$
-
-
- public static final String PROPERTY_EAR_PROJECT_NAME = "EAR name"; //$NON-NLS-1$
- public static final String PROPERTY_J2EE_VERSION = "J2EE level"; //$NON-NLS-1$
- public static final String PROPERTY_PROJECT_NAME = "Project name"; //$NON-NLS-1$
- public static final String PROPERTY_SERVER_TARGET = "Server Target"; //$NON-NLS-1$
-
- protected int fJSPLevel;
- protected int fServletLevel;
- protected IProject wtWebProject;
- protected String wtProjectName;
- protected IPath wtProjectLocation;
- protected String wtEarProjectName;
- protected String fWebContentName;
- protected String fJavaSourceName;
- protected IProject wtEarProject;
- protected IPath wtEarProjectLocation;
- protected boolean wtExampleProject = false;
- protected boolean synch = false;
- protected Vector wtFeatureIds = new Vector();
-
- protected PropertyChangeSupport listeners;
-
- /**
- * Additional property Hashtable
- */
- protected Hashtable wtPropertyTable = new Hashtable(10, 20);
-
- public WebProjectInfo() {
- super();
- }
-
- /**
- * NOTE: Notification for all properties is not implemented yet.
- *
- * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String,
- * java.beans.PropertyChangeListener)
- */
- public void addPropertyChangeListener(String property, PropertyChangeListener listener) {
- if (listeners == null) {
- listeners = new PropertyChangeSupport(this);
- }
- listeners.addPropertyChangeListener(property, listener);
- }
-
- /**
- * NOTE: Notification for all properties is not implemented yet.
- *
- * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String,
- * java.beans.PropertyChangeListener)
- */
- public void removePropertyChangeListener(String property, PropertyChangeListener listener) {
- if (listeners != null) {
- listeners.removePropertyChangeListener(property, listener);
- }
- }
-
- public void addServerJarsToClasspathEntries() {
- // The jars to be added are different based on the level of J2EE supported
- // by the project.
- addToClasspathEntries(getWASClasspathEntries());
- }
-
- public IClasspathEntry[] getWASClasspathEntries() {
- List list = new ArrayList(4);
- //TODO This class needs to be deleted.
- // if (!org.eclipse.jst.j2ee.internal.internal.plugin.J2EEPlugin.hasDevelopmentRole()) {
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/j2ee.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/servletevent.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/ivjejb35.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/runtime.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/pagelist.jar"), null, null)); //$NON-NLS-1$ GMR
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/webcontainer.jar"), null, null)); //$NON-NLS-1$ GMR
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/xalan.jar"), null, null)); //$NON-NLS-1$ GMR
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/als.jar"), null, null)); //$NON-NLS-1$ GMR
- // } else if (isJ2EE13()) {
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/j2ee.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/servletevent.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/ivjejb35.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_50_PLUGINDIR_VARIABLE
- // + "/lib/runtime.jar"), null, null)); //$NON-NLS-1$
- // } else {
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE +
- // "/lib/j2ee.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE +
- // "/lib/webcontainer.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE +
- // "/lib/ivjejb35.jar"), null, null)); //$NON-NLS-1$
- // list.add(JavaCore.newVariableEntry(new Path(IEJBNatureConstants.WAS_PLUGINDIR_VARIABLE +
- // "/lib/websphere.jar"), null, null)); //$NON-NLS-1$
- // }
-
- return (IClasspathEntry[]) list.toArray(new IClasspathEntry[list.size()]);
- }
-
- /**
- * Return the standard classpath for ejb project.
- */
- protected IClasspathEntry[] computeDefaultJavaClasspath() {
-
- super.computeDefaultJavaClasspath();
- IJavaProject javaProject = getJavaProject();
- if (javaProject == null)
- return null;
-
- addWASJarsToClasspathEntries();
- return classpathEntries;
- }
-
- /**
- * Return the context root.
- *
- * @deprecated Use getContextRoot()
- * @return java.lang.String
- */
- public String getDefaultContextRoot() {
- return getContextRoot();
- }
-
- public String getContextRoot() {
- if (fContextRoot != null)
- return fContextRoot;
- return wtProjectName;
- }
-
- /**
- * Subclasses should override as necessary
- */
- protected String getDefaultJavaOutputPath() {
-
- StringBuffer buf = new StringBuffer(getWebContentName());
- buf.append(IPath.SEPARATOR);
- buf.append(IWebNatureConstants.INFO_DIRECTORY);
- buf.append(IPath.SEPARATOR);
- buf.append(IWebNatureConstants.CLASSES_DIRECTORY);
- return buf.toString();
- }
-
- protected String getDefaultSourcePath() {
- return getJavaSourceName();
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public java.lang.String getDefaultUri() {
- return wtProjectName.replace(' ', '_') + ".war";//$NON-NLS-1$
- }
-
- public String[] getFeatureIds() {
- return (String[]) wtFeatureIds.toArray(new String[wtFeatureIds.size()]);
- }
-
- /**
- * Insert the method's description here. Creation date: (10/31/2001 3:10:01 PM)
- *
- * @return boolean
- */
- public int getWebProjectType() {
- if (fJ2EEWebProject)
- return IWebNatureConstants.J2EE_WEB_PROJECT;
-
- return 0;
- }
-
- public boolean isJ2EEWebProject() {
- return fJ2EEWebProject;
- }
-
- public boolean isJSP11() {
- return fJSPLevel == J2EEVersionConstants.JSP_1_1_ID;
- }
-
- public boolean isServlet22() {
- return fServletLevel == J2EEVersionConstants.SERVLET_2_2;
- }
-
- /**
- * @deprecated - Use getModuleVersion() with J2EEVersionConstants
- */
- /**
- * Set the corresponding jsp and servlet levels. Creation date: (11/09/00 10:05:24 AM)
- */
- public void setJ2EEVersion(String newLevel) {
- if (newLevel.equals(J2EE_VERSION_1_2)) {
- fJSPLevel = J2EEVersionConstants.JSP_1_1_ID;
- fServletLevel = J2EEVersionConstants.SERVLET_2_2;
- } else if (newLevel.equals(J2EE_VERSION_1_3)) {
- fJSPLevel = J2EEVersionConstants.JSP_1_2_ID;
- fServletLevel = J2EEVersionConstants.SERVLET_2_3;
- } else {
- fJSPLevel = J2EEVersionConstants.JSP_2_0_ID;
- fServletLevel = J2EEVersionConstants.SERVLET_2_4;
- }
- }
-
- public boolean isJ2EE13() {
- return (isServlet22() && !isJSP11());
- }
-
- /**
- * Is this project being created for an example. Creation date: (10/31/2001 3:10:01 PM)
- *
- * @return boolean
- */
- public boolean isWebExample() {
- return wtExampleProject;
- }
-
- public void setContextRoot(java.lang.String contextRoot) {
- fContextRoot = contextRoot;
- }
-
- public void addFeatureId(java.lang.String featureId) {
- wtFeatureIds.add(featureId);
- }
-
- public void removeFeatureId(java.lang.String featureId) {
- wtFeatureIds.remove(featureId);
-
- }
-
- public void setFeatureIds(java.lang.String[] featureIds) {
- wtFeatureIds = new Vector();
- for (int i = 0; i < featureIds.length; i++)
- wtFeatureIds.add(featureIds[i]);
- }
-
-
- /**
- * Insert the method's description here. Creation date: (10/31/2001 3:10:01 PM)
- *
- * @param newFIsStaticWebProject
- * boolean
- */
- public void setWebProjectType(boolean j2eeWebProject) {
- fJ2EEWebProject = j2eeWebProject;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public int getJSPLevel() {
- return fJSPLevel;
-
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public int getServletLevel() {
- return fServletLevel;
- }
-
- /**
- * This method is required as a separate method so that there are no inconsistencies when firing
- * notifications caused due to change in either the JSP level or the Servlet level (through the
- * setJSPLevel or setServletLevel methods), but not both.
- */
- protected void updateJ2EELevel(String newLevel) {
- if (newLevel.equals(J2EE_VERSION_1_2)) {
- fJSPLevel = J2EEVersionConstants.JSP_1_1_ID;
- fServletLevel = J2EEVersionConstants.SERVLET_2_2;
- } else if (newLevel.equals(J2EE_VERSION_1_3)) {
- fJSPLevel = J2EEVersionConstants.JSP_1_2_ID;
- fServletLevel = J2EEVersionConstants.SERVLET_2_3;
- } else {
- fJSPLevel = J2EEVersionConstants.JSP_2_0_ID;
- fServletLevel = J2EEVersionConstants.SERVLET_2_4;
- }
-
- String oldValue = isJ2EE13() ? J2EE_VERSION_1_2 : J2EE_VERSION_1_3;
- firePropertyChange(PROPERTY_J2EE_VERSION, oldValue, newLevel);
- }
-
- /**
- * @see java.beans.PropertyChangeSupport#firePropertyChange(java.lang.String, java.lang.Object,
- * java.lang.Object)
- */
- protected void firePropertyChange(String property, Object oldValue, Object newValue) {
- if (listeners != null) {
- listeners.firePropertyChange(property, oldValue, newValue);
- }
- }
-
- public String getJ2EELevel() {
- String level = J2EE_VERSION_1_3;
- if (!isJ2EE13()) {
- level = J2EE_VERSION_1_2;
- }
- return level;
- }
-
- /**
- * The J2EE level and the individual Servlet and JSP levels are always in sync now.
- *
- * Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public void setJSPLevel(int newLevel) {
- fJSPLevel = newLevel;
-
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public void setServletLevel(int newLevel) {
- fServletLevel = newLevel;
- }
-
- /**
- * Return an Object for the assocated properties or null
- */
- public Object getProperty(String propertyName) {
-
- return wtPropertyTable.get(propertyName);
- }
-
- /**
- * Set an Object for the assocated properties or null
- */
- public void setProperty(String propertyName, Object value) {
- wtPropertyTable.put(propertyName, value);
- return;
- }
-
- /**
- * Return the project being created; checks the workspace for an existing project
- */
- public IProject getProject() {
- if (wtWebProject == null && getProjectName() != null) {
- IProject aProject = getWorkspace().getRoot().getProject(getProjectName());
- if (aProject.exists())
- wtWebProject = aProject;
- }
- return wtWebProject;
- }
-
- /**
- * Return the location of the project in the file system.
- *
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getProjectLocation() {
- return wtProjectLocation;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public java.lang.String getProjectName() {
- if (wtProjectName == null)
- if (wtWebProject != null)
- wtProjectName = wtWebProject.getName();
- return wtProjectName;
- }
-
- public IPath getProjectPath() {
- return new Path(getProjectName());
- }
-
- /**
- * Return the project being created; checks the workspace for an existing project
- */
- public IProject getEARProject() {
- wtEarProject = null;
- if (!((getEARProjectName().trim()).length() == 0)) {
- IProject aProject = getWorkspace().getRoot().getProject(getEARProjectName());
- if (aProject.exists())
- wtEarProject = aProject;
- }
-
- return wtEarProject;
- }
-
- /**
- * Return the location of the project in the file system.
- *
- * @return org.eclipse.core.runtime.IPath
- */
- public IPath getEARProjectLocation() {
- return wtEarProjectLocation;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @return java.lang.String
- */
- public java.lang.String getEARProjectName() {
- return wtEarProjectName;
- }
-
- public IPath getEARProjectPath() {
- return new Path(getEARProjectName());
- }
-
- public void setProject(IProject aProject) {
- fJSPLevel = getJSPVersion();
- fServletLevel = getServletVersion();
- wtWebProject = aProject;
- super.setProject(aProject);
- }
-
- protected int getJSPVersion() {
- WebArtifactEdit webEdit = null;
- try {
- //TODO migrate to flex projects
- //webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead(project);
- if (webEdit != null)
- return webEdit.getJSPVersion();
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
- return 0;
- }
-
- protected int getServletVersion() {
- WebArtifactEdit webEdit = null;
- try {
- //TODO migrate to flex projects
- //webEdit = (WebArtifactEdit) StructureEdit.getFirstArtifactEditForRead(project);
- if (webEdit != null)
- return webEdit.getServletVersion();
- } finally {
- if (webEdit != null)
- webEdit.dispose();
- }
- return 0;
- }
-
- /**
- * Set the location in the file system that the project is to be created.
- *
- * @param newProjectLocation
- * IPath
- */
- public void setProjectLocation(IPath newProjectLocation) {
- wtProjectLocation = newProjectLocation;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @param newProjectName
- * java.lang.String
- */
- public void setProjectName(java.lang.String newProjectName) {
- if ((wtProjectName == null && newProjectName != null) || (wtProjectName != null && !wtProjectName.equals(newProjectName))) {
- setClasspathEntries(null);
- }
- wtProjectName = newProjectName;
- }
-
- public void setEARProject(IProject aProject) {
- wtEarProject = aProject;
- }
-
- /**
- * Set the location in the file system that the project is to be created.
- *
- * @param newProjectLocation
- * IPath
- */
- public void setEARProjectLocation(IPath newProjectLocation) {
- wtEarProjectLocation = newProjectLocation;
- }
-
- /**
- * Insert the method's description here. Creation date: (11/09/00 10:05:24 AM)
- *
- * @param newProjectName
- * java.lang.String
- */
- public void setEARProjectName(java.lang.String newProjectName) {
- if ((newProjectName != null && !newProjectName.equals(wtEarProjectName)) || (newProjectName == null && wtEarProjectName != null)) {
- //do nothing for now
- }
- wtEarProjectName = newProjectName;
- }
-
-
- /**
- * Insert the method's description here. Creation date: (10/31/2001 3:10:01 PM)
- *
- * @param newFIsStaticWebProject
- * boolean
- */
- public void setWebExample(boolean exampleProject) {
- wtExampleProject = exampleProject;
- }
-
- /**
- * @see J2EEJavaProjectInfo#getJavaProject()
- */
- public IJavaProject getJavaProject() {
- return super.getJavaProject();
- }
-
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IWebProjectWizardInfo#getWebContentName()
- */
- public String getWebContentName() {
- if (fWebContentName == null)
- fWebContentName = isJ2EEWebProject() ? J2EEPlugin.getDefault().getJ2EEPreferences().getJ2EEWebContentFolderName() : J2EEPlugin.getDefault().getJ2EEPreferences().getStaticWebContentFolderName();
- return fWebContentName;
- }
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IWebProjectWizardInfo#setWebContentName(String)
- */
- public void setWebContentName(String name) {
- fWebContentName = name;
- }
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IWebProjectWizardInfo#getJavaSourceName()
- */
- public String getJavaSourceName() {
- if (fJavaSourceName == null)
- fJavaSourceName = J2EEPlugin.getDefault().getJ2EEPreferences().getJavaSourceFolderName();
- return fJavaSourceName;
- }
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.internal.web.operations.IWebProjectWizardInfo#setJavaSourceName(String)
- */
- public void setJavaSourceName(String name) {
- fJavaSourceName = name;
- }
-
- /**
- * In addition to setting the server target, this method also sets the server target type.
- * WebProjectInfo clients don't need to worry about setting the target type.
- *
- * @see org.eclipse.jst.j2ee.internal.internal.j2eeproject.J2EEJavaProjectInfo#setServerTarget(com.ibm.etools.server.target.IServerTarget)
- */
- /*
- * public void setServerTarget(IServerTarget target) { if( (target != null &&
- * !target.equals(getServerTarget())) || (target == null && getServerTarget() != null) ){
- * IServerTarget oldTarget = getServerTarget(); super.setServerTarget(target);
- *
- * ITargetType targetType = null; if( getServerTarget() != null ){ Iterator iterator =
- * getServerTarget().getTargets().iterator(); while (iterator.hasNext()) { ITargetType type =
- * (ITargetType) iterator.next(); if (IServerTargetConstants.WEB_TYPE.equals(type.getId())){
- * targetType = type; break; } } } setServerTargetType(targetType);
- *
- * firePropertyChange(PROPERTY_SERVER_TARGET, oldTarget, target); } }
- */
- public void setSynchronizeWLPs(boolean synch) {
- this.synch = synch;
- }
-
- public boolean getSynchronizeWLPs() {
- return synch;
- }
-
- protected void addWASJarsToClasspathEntries() {
- // The jars to be added are different based on the level of J2EE supported
- // by the project.
- addToClasspathEntries(getWASClasspathEntries());
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectPropertiesUpdateOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectPropertiesUpdateOperation.java
deleted file mode 100644
index 7124cbdea..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebProjectPropertiesUpdateOperation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.core.ClasspathEntry;
-import org.eclipse.jst.j2ee.internal.web.archive.operations.ContextRootUpdateOperation;
-import org.eclipse.jst.j2ee.internal.web.archive.operations.WebContentNameUpdateOperation;
-import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
-
-/**
- * @version 1.0
- * @author
- */
-public class WebProjectPropertiesUpdateOperation implements IHeadlessRunnableWithProgress {
-
- protected WebProjectInfo webProjectInfo;
-// protected J2EEWebNatureRuntime nature;
-
-
- public WebProjectPropertiesUpdateOperation(WebProjectInfo projectInfo) {
- webProjectInfo = projectInfo;
- IProject project = webProjectInfo.getProject();
- //nature = (J2EEWebNatureRuntime) J2EEWebNatureRuntimeUtilities.getRuntime(project);
- }
-
- /*
- * @see IHeadlessRunnableWithProgress#run(IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-
- IProject project = webProjectInfo.getProject();
-
- // Update the context root
- String contextRoot = webProjectInfo.getContextRoot();
- if (contextRoot != null) {
- new ContextRootUpdateOperation(project, contextRoot).run(monitor);
- }
-
- // Update the web content name
- String webContentName = webProjectInfo.getWebContentName();
- if (webContentName != null) {
- new WebContentNameUpdateOperation(project, webContentName).run(monitor);
- }
-
- // Update the Servlet and JSP Levels
- int servletLevel = webProjectInfo.getServletLevel();
- int jspLevel = webProjectInfo.getJSPLevel();
-
- try {
- updateClassPathEntries(monitor);
- //TODO setOn Module forwrite
- /* if (servletLevel != null)
- nature.setServletLevel(servletLevel);
- if (jspLevel != null)
- nature.setJSPLevel(jspLevel);
-
-*/
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
-
- }
-
- protected IClasspathEntry[] getClasspathsFromWebProjectInfo(WebProjectInfo wpInfo) {
- IClasspathEntry[] wasClasspath = wpInfo.getWASClasspathEntries();
- IClasspathEntry[] serverJdkClasspath = wpInfo.getServerJDKClasspathEntries();
- List list = new ArrayList(wasClasspath.length + serverJdkClasspath.length);
- list.addAll(Arrays.asList(wasClasspath));
- list.addAll(Arrays.asList(serverJdkClasspath));
-
- ClasspathEntry[] ret = new ClasspathEntry[list.size()];
- return (IClasspathEntry[]) list.toArray(ret);
- }
-
-
- protected IClasspathEntry[] getOldDefaultClasspath() {
- WebProjectInfo wpInfo = new WebProjectInfo();
- //TODO switch to module level
-/* wpInfo.setProject(nature.getProject());
- wpInfo.setJSPLevel(nature.getJSPLevel());
- wpInfo.setServletLevel(nature.getServletLevel());*/
- return getClasspathsFromWebProjectInfo(wpInfo);
- }
-
- protected IClasspathEntry[] getDefaultClasspath() {
- WebProjectInfo wpInfo = new WebProjectInfo();
- //TODO switch to Module level
- /* wpInfo.setProject(nature.getProject());
- wpInfo.setJSPLevel(webProjectInfo.getJSPLevel());
- wpInfo.setServletLevel(webProjectInfo.getServletLevel());*/
- return getClasspathsFromWebProjectInfo(wpInfo);
- }
-
-
-
- protected void updateClassPathEntries(IProgressMonitor monitor) throws InvocationTargetException {
- IProject project = webProjectInfo.getProject();
- try {
- if (project.hasNature(JavaCore.NATURE_ID)) {
- IJavaProject javaProject = JavaCore.create(project);
- IClasspathEntry[] existingClasspath = javaProject.getRawClasspath();
- IClasspathEntry[] oldDefaultClasspath = getOldDefaultClasspath();
- IClasspathEntry[] defaultClasspath = getDefaultClasspath();
- IClasspathEntry[] newClasspath = ClasspathUtilities.removeClasspathEntries(existingClasspath, oldDefaultClasspath);
- newClasspath = ClasspathUtilities.addClasspathEntries(newClasspath, defaultClasspath);
- javaProject.setRawClasspath(newClasspath, monitor);
- }
- } catch (JavaModelException e) {
- throw new InvocationTargetException(e);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
-
-} \ 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 3f1452f44..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
+++ /dev/null
@@ -1,580 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IFlexibleProject;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-
-public class WebPropertiesUtil {
- // private static final char[] BAD_CHARS = {'/', '\\', ':'};
- private static final char[] BAD_CHARS = {':'};
- public static final String DEFAULT_JAVA_SOURCE_NAME = "Java Source"; //$NON-NLS-1$
-
- /**
- * 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("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.getString("Sychronize_Class_Path_UI_"), 4); //$NON-NLS-1$
- //$NON-NLS-1$ = "Sychronize Class Path"
-
- IFolder 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.getString("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.getString("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.getString("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.getString("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.getString("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.getString("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("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.getString("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.getString("Folder_name_cannot_be_empty_2"); //$NON-NLS-1$
-
- if (contains(folderName, BAD_CHARS))
- return ProjectSupportResourceHandler.getString("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.getString("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.getString("Folder_name_cannot_be_the_same_as_Java_source_folder_5"); //$NON-NLS-1$
-
- return ProjectSupportResourceHandler.getString("Folder_name_cannot_be_the_same_as_Java_class_folder_6"); //$NON-NLS-1$
- }
- }
- }
- }
- } catch (JavaModelException e) {
- return null;
- }
- }
- }
-
- return null;
- }
-
-
- /**
- * Update given web nature to the current version if necessary.
- *
- * @param webNature
- * The web Nature that should be examined.
- * @return True if successful, false if unnecessary.
- * @throws CoreException
- * The exception that occured during the version change operation.
- */
- /*
- * static public boolean updateNatureToCurrentVersion(J2EEWebNatureRuntime webNature) throws
- * CoreException {
- *
- * boolean success = false;
- *
- * if (webNature.getVersion() != WEB.CURRENT_VERSION) {
- * webNature.setVersion(J2EESettings.CURRENT_VERSION); success = true; }
- * ((J2EEModuleWorkbenchURIConverterImpl)
- * webNature.getResourceSet().getURIConverter()).recomputeContainersIfNecessary();
- *
- * return success; }
- */
-
- /**
- * Move the old source folder to the new default folder.
- *
- * @param project
- * The Web Project we are working with.
- * @param oldSourceFolder
- * The old "Java Source" folder that will be moved.
- * @param javaSourceName
- * The new name of the "Java Source" folder, or null for default.
- * @return The location of the new folder, or null if no move was necessary.
- * @throws CoreException
- * The exception that occured during the move operation.
- */
- static public IContainer updateJavaSourceName(IProject project, IContainer oldSourceFolder, String javaSourceName, IProgressMonitor progressMonitor) throws CoreException {
- IContainer newSourceFolder = null;
- if (oldSourceFolder != null) {
- IPath newPath;
- if (javaSourceName == null)
- newPath = new Path(DEFAULT_JAVA_SOURCE_NAME);
- else
- newPath = new Path(javaSourceName);
-
- // Make sure new path is different form old path
- if (!project.getFolder(newPath).getFullPath().equals(oldSourceFolder.getFullPath())) {
- oldSourceFolder.move(newPath, IResource.FORCE | IResource.KEEP_HISTORY, new SubProgressMonitor(progressMonitor, 1));
- JemProjectUtilities.removeFromJavaClassPath(project, oldSourceFolder);
- newSourceFolder = project.getFolder(newPath);
- JemProjectUtilities.appendJavaClassPath(project, JavaCore.newSourceEntry(project.getFolder(newPath).getFullPath()));
- }
- }
- return newSourceFolder;
- }
-
-
- /**
- * Get the source folder that should be used for migration.
- *
- * @param project
- * The Web Project to examine.
- * @return The source folder to use in migration, or null if it should be skipped.
- */
- static public IContainer getJavaSourceFolder(IProject project) {
- List sourceRoots = JemProjectUtilities.getSourceContainers(project);
- IContainer oldSourceFolder = null;
-
- if (sourceRoots != null) {
- if (sourceRoots.size() == 1) {
- IContainer sourceFolder = (IContainer) sourceRoots.get(0);
- if (sourceFolder instanceof IFolder) {
- oldSourceFolder = sourceFolder;
- }
- }
- }
- return oldSourceFolder;
- }
-
- public static IFolder getModuleServerRoot(IProject project) {
- // TODO need to implement module server root properly
- return project.getFolder("WebContent");
- }
-
- public static IVirtualFolder getWebLibFolder(IVirtualComponent webComponent) {
- IPath path = new Path(J2EEConstants.WEB_INF + "/" + "lib");
- IVirtualFolder libFolder = webComponent.getRootFolder().getFolder(path);
- return libFolder;
- }
-
- //TODO delete jsholl
- /**
- * @deprecated use getWebLibFolder(IVirtualComponent webComponent)
- * @param project
- * @return
- */
- public static IFolder getWebLibFolder(IProject project) {
- IFlexibleProject flex = ComponentCore.createFlexibleProject(project);
- return getWebLibFolder(flex.getComponents()[0]).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;
- // }
-
-
-} \ No newline at end of file
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 9594ca2e3..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.j2ee.internal.web.operations;
-
-
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.JavaModelException;
-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.getString("Operation_failed_due_to_SA_ERROR_"); //$NON-NLS-1$ = "Operation failed due to SAX error: "
- public static final String IO_ERROR_MESSAGE = ProjectSupportResourceHandler.getString("Operation_failed_due_to_IO_ERROR_"); //$NON-NLS-1$ = "Operation failed due to IO error: "
- public static final String CORE_ERROR_MESSAGE = ProjectSupportResourceHandler.getString("Operation_failed_due_to_Co_ERROR_"); //$NON-NLS-1$ = "Operation failed due to Core error: "
- public static final String JAVA_MODEL_ERROR_MESSAGE = ProjectSupportResourceHandler.getString("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);
- }
-} \ No newline at end of file
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/WebArtifactEditOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditOperation.java
deleted file mode 100644
index 882256d67..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditOperation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.ArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditOperation;
-import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
-
-public class WebArtifactEditOperation extends ArtifactEditOperation {
-
- public WebArtifactEditOperation(WebArtifactEditOperationDataModel operationDataModel) {
- super(operationDataModel);
- }
-
- protected ArtifactEdit getArtifactEditForModule(WorkbenchComponent module) {
- ComponentHandle handle = ComponentHandle.create(StructureEdit.getContainingProject(module),module.getName());
- return WebArtifactEdit.getWebArtifactEditForWrite(handle);
- }
-
- protected WebArtifactEdit getWebArtifactEdit() {
- return (WebArtifactEdit)getArtifactEdit();
- }
-}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditOperationDataModel.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditOperationDataModel.java
deleted file mode 100644
index 80649e3fd..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditOperationDataModel.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004, 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.jst.j2ee.web.componentcore.util.WebArtifactEdit;
-import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditOperationDataModel;
-import org.eclipse.wst.common.frameworks.internal.operations.WTPOperation;
-
-public class WebArtifactEditOperationDataModel extends ArtifactEditOperationDataModel {
-
- public WTPOperation getDefaultOperation() {
- return new WebArtifactEditOperation(this);
- }
-
- public WebArtifactEdit getWebArtifactEditForRead() {
- return WebArtifactEdit.getWebArtifactEditForRead(getComponent());
- }
-}
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 176a0dcff..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java
+++ /dev/null
@@ -1,37 +0,0 @@
-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.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.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IFlexibleProject;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-
-public class WebArtifactEditUtilities {
-
- public static IVirtualComponent getWebComponent(Servlet servlet) {
- IProject project = ProjectUtilities.getProject(servlet);
- IFlexibleProject flexProject = ComponentCore.createFlexibleProject(project);
- IVirtualComponent[] components = flexProject.getComponents();
- for (int i = 0; i < components.length; i++) {
- IVirtualComponent component = components[i];
- WebArtifactEdit edit = null;
- try {
- if (component.getComponentTypeId().equals(IModuleConstants.JST_WEB_MODULE)) {
- 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 1712d83f2..000000000
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java
+++ /dev/null
@@ -1,48 +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.util;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-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 (editModel.getModuleType().equals(WebArtifactEdit.TYPE_ID))
- 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};
- }
-} \ No newline at end of file

Back to the top