diff options
Diffstat (limited to 'plugins/org.eclipse.jst.jee/jeecreation/org')
22 files changed, 0 insertions, 1158 deletions
diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEEContentDescriber.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEEContentDescriber.java deleted file mode 100644 index 745fc052e..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/contenttype/JEEContentDescriber.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jee.contenttype; - -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.content.IContentDescriber; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek; - -/** - * A content describer for detecting a j2ee module - */ -public final class JEEContentDescriber implements IContentDescriber { - public JEEContentDescriber() { - super(); - } - - public final static QualifiedName JEEVERSION = new QualifiedName("jee-version", "5.0"); //$NON-NLS-1$ - - public int describe(InputStream contents, IContentDescription description) throws IOException { - - JavaEEQuickPeek quickPeek = new JavaEEQuickPeek(contents); - switch (quickPeek.getType()) { - case JavaEEQuickPeek.APPLICATION_CLIENT_TYPE: - case JavaEEQuickPeek.APPLICATION_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.JEE_5_0_ID: - return VALID; - } - return INVALID; - case JavaEEQuickPeek.EJB_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.EJB_3_0_ID: - return VALID; - } - return INVALID; - case JavaEEQuickPeek.WEB_TYPE: - switch (quickPeek.getVersion()) { - case JavaEEQuickPeek.WEB_2_5_ID: - return VALID; - } - return INVALID; - } - - return INVALID; - } - - public QualifiedName[] getSupportedOptions() { - - return new QualifiedName[] { JEEVERSION }; - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProvider.java deleted file mode 100644 index 34250c34c..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.javaee.applicationclient.ApplicationClient; -import org.eclipse.jst.javaee.applicationclient.ApplicationClientDeploymentDescriptor; -import org.eclipse.jst.javaee.applicationclient.ApplicationclientFactory; -import org.eclipse.jst.javaee.applicationclient.IApplicationClientResource; -import org.eclipse.jst.javaee.core.DisplayName; -import org.eclipse.jst.javaee.core.JavaeeFactory; - -public class AppClient5ModelProvider extends JEE5ModelProvider { - - private static final String APPCLIENT5_CONTENT_TYPE = "org.eclipse.jst.jee.ee5appclientDD"; //$NON-NLS-1$ - public AppClient5ModelProvider(IProject proj) { - super(); - this.proj = proj; - setDefaultResourcePath(new Path(J2EEConstants.APP_CLIENT_DD_URI)); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.model.IModelProvider#getModelObject(org.eclipse.core.runtime.IPath) - */ - public Object getModelObject(IPath modelPath) { - IApplicationClientResource appRes = (IApplicationClientResource)getModelResource(modelPath); - if (appRes != null && appRes.getRootObject() != null) - return appRes.getApplicationClient(); - return null; - } - protected String getContentTypeDescriber() { - return APPCLIENT5_CONTENT_TYPE; - } - public void populateRoot(XMLResourceImpl res, String name) { - ApplicationClientDeploymentDescriptor dd = ApplicationclientFactory.eINSTANCE.createApplicationClientDeploymentDescriptor(); - dd.getXMLNSPrefixMap().put("", J2EEConstants.JAVAEE_NS_URL); //$NON-NLS-1$ - dd.getXMLNSPrefixMap().put("xsi", J2EEConstants.XSI_NS_URL); //$NON-NLS-1$ - dd.getXSISchemaLocation().put(J2EEConstants.JAVAEE_NS_URL, J2EEConstants.APP_CLIENT_SCHEMA_LOC_5); - ApplicationClient client = ApplicationclientFactory.eINSTANCE.createApplicationClient(); - DisplayName dn = JavaeeFactory.eINSTANCE.createDisplayName(); - dn.setValue(name); - client.getDisplayNames().add(dn); - dd.setApplicationClient(client); - client.setVersion(J2EEVersionConstants.VERSION_5_TEXT); - res.getContents().add((EObject) dd); - } - - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProviderFactory.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProviderFactory.java deleted file mode 100644 index 3e5758787..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/AppClient5ModelProviderFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderFactory; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class AppClient5ModelProviderFactory implements IModelProviderFactory { - - public IModelProvider create(IProject project) { - return new AppClient5ModelProvider(project); - } - - public IModelProvider create(IVirtualComponent component) { - return new AppClient5ModelProvider(component.getProject()); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProvider.java deleted file mode 100644 index 3ecd489ec..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProvider.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.j2ee.application.WebModule; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.model.IEARModelProvider; -import org.eclipse.jst.javaee.application.Application; -import org.eclipse.jst.javaee.application.ApplicationDeploymentDescriptor; -import org.eclipse.jst.javaee.application.ApplicationFactory; -import org.eclipse.jst.javaee.application.IApplicationResource; -import org.eclipse.jst.javaee.application.Module; -import org.eclipse.jst.javaee.core.DisplayName; -import org.eclipse.jst.javaee.core.JavaeeFactory; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; - -public class EAR5ModelProvider extends JEE5ModelProvider implements IEARModelProvider { - - private static final String EAR5_CONTENT_TYPE = "org.eclipse.jst.jee.ee5earDD"; //$NON-NLS-1$ - public EAR5ModelProvider(IProject proj) { - super(); - this.proj = proj; - setDefaultResourcePath(new Path(J2EEConstants.APPLICATION_DD_URI)); - } - protected String getContentTypeDescriber() { - return EAR5_CONTENT_TYPE; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.j2ee.model.IModelProvider#getModelObject(org.eclipse.core.runtime.IPath) - */ - public Object getModelObject(IPath modelPath) { - IApplicationResource earRes = (IApplicationResource)getModelResource(modelPath); - if (earRes != null && earRes.getRootObject() != null) - return earRes.getApplication(); - return null; - } - - public String getModuleURI(IVirtualComponent moduleComp) { - IVirtualComponent comp = ComponentCore.createComponent(proj); - IVirtualReference [] refs = comp.getReferences(); - for(int i=0; i<refs.length; i++){ - if(refs[i].getReferencedComponent().equals(moduleComp)){ - return refs[i].getArchiveName(); - } - } - return null; - } - /** - * This method will return the context root in this application for the passed in web project. - * - * @param webProject - * @return contextRoot String - */ - public String getWebContextRoot(IProject webProject) { - if (webProject == null || !J2EEProjectUtilities.isDynamicWebProject(webProject)) - return null; - IVirtualComponent webComp = ComponentCore.createComponent(webProject); - String webModuleURI = getModuleURI(webComp); - if (webModuleURI != null) { - Module webModule = (Module) ((Application)getModelObject()).getModule(webModuleURI, null); - if (webModule != null) - return webModule.getWeb().getContextRoot(); - } - return null; - } - public void populateRoot(XMLResourceImpl res, String name) { - ApplicationDeploymentDescriptor dd = ApplicationFactory.eINSTANCE.createApplicationDeploymentDescriptor(); - dd.getXMLNSPrefixMap().put("", J2EEConstants.JAVAEE_NS_URL); //$NON-NLS-1$ - dd.getXMLNSPrefixMap().put("xsi", J2EEConstants.XSI_NS_URL); //$NON-NLS-1$ - dd.getXSISchemaLocation().put(J2EEConstants.JAVAEE_NS_URL, J2EEConstants.APPLICATION_SCHEMA_LOC_5); - Application ear = ApplicationFactory.eINSTANCE.createApplication(); - DisplayName dn = JavaeeFactory.eINSTANCE.createDisplayName(); - dn.setValue(name); - ear.getDisplayNames().add(dn); - ear.setVersion(J2EEVersionConstants.VERSION_5_TEXT); - dd.setApplication(ear); - res.getContents().add((EObject) dd); - } - - /** - * This method will set the context root on the application for the passed in contextRoot. - * - * @param webProject - * @param aContextRoot - */ - public void setWebContextRoot(IProject webProject, String aContextRoot) { - if (webProject == null || !J2EEProjectUtilities.isDynamicWebProject(webProject)) - return; - IVirtualComponent webComp = ComponentCore.createComponent(webProject); - String webModuleURI = getModuleURI(webComp); - if (webModuleURI != null) { - WebModule webModule = (WebModule) ((Application)getModelObject()).getModule(webModuleURI, null); - if (webModule != null) - webModule.setContextRoot(aContextRoot); - // TODO - should this method save? Or should the caller be required to save? - } - } -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProviderFactory.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProviderFactory.java deleted file mode 100644 index c36483017..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/EAR5ModelProviderFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jee.model.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderFactory; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class EAR5ModelProviderFactory implements IModelProviderFactory { - - public IModelProvider create(IProject project) { - return new EAR5ModelProvider(project); - } - - public IModelProvider create(IVirtualComponent component) { - return new EAR5ModelProvider(component.getProject()); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java deleted file mode 100644 index d030096c1..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java +++ /dev/null @@ -1,519 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jee.model.internal; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.common.util.WrappedException; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jem.util.emf.workbench.FlexibleProjectResourceSet; -import org.eclipse.jem.util.emf.workbench.ProjectResourceSet; -import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase; -import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.IModelProviderEvent; -import org.eclipse.jst.j2ee.model.IModelProviderListener; -import org.eclipse.jst.j2ee.model.ModelProviderEvent; -import org.eclipse.jst.javaee.core.internal.util.JavaeeResourceImpl; -import org.eclipse.jst.jee.JEEPlugin; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil; -import org.eclipse.wst.common.componentcore.internal.impl.PlatformURLModuleConnection; -import org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; -import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateInputProvider; -import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidator; -import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorImpl; -import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter; - -public class JEE5ModelProvider implements IModelProvider, ResourceStateInputProvider, ResourceStateValidator, IModelProviderListener{ - - protected XMLResourceImpl writableResource; - protected IProject proj; - protected IPath defaultResourcePath; - protected ResourceStateValidator stateValidator; - protected ResourceAdapter resourceAdapter = new ResourceAdapter(); - protected final ListenerList listeners = new ListenerList(); - //private static boolean resourceChangeListenerEnabled = false; - - private List modelResources = new ArrayList(); - protected class ResourceAdapter extends AdapterImpl { - public void notifyChanged(Notification notification) { - if (notification.getEventType() == Notification.SET - && notification.getFeatureID(null) == Resource.RESOURCE__IS_LOADED) { - resourceIsLoadedChanged((Resource) notification.getNotifier(), notification.getOldBooleanValue(), notification.getNewBooleanValue()); - } else if (notification.getFeatureID(null) == Resource.RESOURCE__IS_MODIFIED) - resourceChanged((Resource) notification.getNotifier()); - } - } - - public JEE5ModelProvider() { - super(); - } - - protected ProjectResourceSet getResourceSet(IProject proj2) { - return (ProjectResourceSet)WorkbenchResourceHelperBase.getResourceSet(proj); - } - - public XMLResourceImpl getWritableResource() { - return writableResource; - } - - public void setWritableResource(XMLResourceImpl writableResource) { - this.writableResource = writableResource; - } - - protected void resourceChanged(Resource aResource) { - if (hasListeners()) { - int eventCode = ModelProviderEvent.KNOWN_RESOURCES_CHANGED; - ModelProviderEvent evt = new ModelProviderEvent(eventCode, this, proj); - evt.addResource(aResource); - notifyListeners(evt); - } - } - - protected void resourceIsLoadedChanged(Resource aResource, boolean oldValue, boolean newValue) { - if (hasListeners()) { - int eventCode = newValue ? ModelProviderEvent.LOADED_RESOURCE : ModelProviderEvent.UNLOADED_RESOURCE; - ModelProviderEvent evt = new ModelProviderEvent(eventCode, this, proj); - evt.addResource(aResource); - notifyListeners(evt); - } - } - private void addManagedResource(XMLResourceImpl res) { - modelResources.add(res); - if (!res.eAdapters().contains(resourceAdapter)) - res.eAdapters().add(resourceAdapter); - } - /** - * Returns true if there are any listeners - */ - public boolean hasListeners() { - return !listeners.isEmpty(); - } - - private URI getModuleURI(URI uri) { - URI moduleuri = ModuleURIUtil.fullyQualifyURI(proj,getContentTypeDescriber()); - IPath requestPath = new Path(moduleuri.path()).append(new Path(uri.path())); - URI resourceURI = URI.createURI(PlatformURLModuleConnection.MODULE_PROTOCOL + requestPath.toString()); - return resourceURI; - } - - protected XMLResourceImpl getModelResource(IPath modelPath) { - if (writableResource != null) { - addManagedResource(writableResource); - return writableResource; - } - if ((modelPath == null) || modelPath.equals(IModelProvider.FORCESAVE)) - modelPath = getDefaultResourcePath(); - ProjectResourceSet resSet = getResourceSet(proj); - IVirtualFolder container = ComponentCore.createComponent(proj).getRootFolder(); - String modelPathURI = modelPath.toString(); - URI uri = URI.createURI(modelPathURI); - - IPath projURIPath = new Path("");//$NON-NLS-1$ - projURIPath = projURIPath.append(container.getProjectRelativePath()); - projURIPath = projURIPath.addTrailingSeparator(); - projURIPath = projURIPath.append(modelPath); - URI projURI = URI.createURI(projURIPath.toString()); - XMLResourceImpl res = null; - try { - if (proj.getFile(projURI.toString()).exists()) - { - res = (XMLResourceImpl) resSet.getResource(getModuleURI(uri),true); - addManagedResource(res); -// if (!resourceChangeListenerEnabled) -// { -// resourceChangeListenerEnabled = true; -// ResourcesPlugin.getWorkspace().addResourceChangeListener(new ResourceChangeListener(), IResourceChangeEvent.POST_CHANGE); -// } - } else {//First find in resource set, then create if not found new Empty Resource. - XMLResourceImpl newRes = createModelResource(modelPath, resSet, projURI); - addManagedResource(newRes); - return newRes; - } - } catch (WrappedException ex) { - if (ex.getCause() instanceof FileNotFoundException) - return null; - else throw ex; - } - return res; - } - - - protected XMLResourceImpl createModelResource(IPath modelPath, ProjectResourceSet resourceSet, URI uri) { - // First try to find existing cached resource. - XMLResourceImpl res = (XMLResourceImpl)resourceSet.getResource(getModuleURI(uri), false); - if (res == null || !res.isLoaded()) { - // Create temp resource if no file exists - res= (XMLResourceImpl)((FlexibleProjectResourceSet)resourceSet).createResource(getModuleURI(uri),WTPResourceFactoryRegistry.INSTANCE.getFactory(uri, getContentType(getContentTypeDescriber()))); - populateRoot(res, resourceSet.getProject().getName()); - } - return res; - } - - public void populateRoot(XMLResourceImpl res, String string) { - // TODO Auto-generated method stub - - } - - private IContentDescription getContentType(String contentTypeDescriber) { - - if (contentTypeDescriber != null) - return Platform.getContentTypeManager().getContentType(contentTypeDescriber).getDefaultDescription(); - else - return null; - - } - - public IPath getDefaultResourcePath() { - return defaultResourcePath; - } - - public void setDefaultResourcePath(IPath defaultResourcePath) { - this.defaultResourcePath = defaultResourcePath; - } - - public Object getModelObject() { - return getModelObject(getDefaultResourcePath()); - } - - public Object getModelObject(IPath modelPath) { - // TODO Auto-generated method stub - return null; - } - - /** - * Used to optionally define an associated content type for XML file creation - * @return - */ - protected String getContentTypeDescriber() { - - return null; - } - - - - public IStatus validateEdit(IPath modelPath, Object context) { - if (modelPath == null) - modelPath = getDefaultResourcePath(); - IWorkspace work = ResourcesPlugin.getWorkspace(); - IFile file = WorkbenchResourceHelper.getFile(getModelResource(modelPath)); - if (file != null && file.exists()) { - IFile[] files = { file }; - if (context == null) - context = IWorkspace.VALIDATE_PROMPT; - return work.validateEdit(files, context); - } else - return Status.OK_STATUS; - } - - public void modify(Runnable runnable, IPath modelPath) { - //About to modify and save this model - try { - JavaeeResourceImpl res = (JavaeeResourceImpl)getModelResource(modelPath); - if (res != null) - setWritableResource(res); - runnable.run(); - try { - if (res != null) { - if (modelPath != null && modelPath.equals(IModelProvider.FORCESAVE)) - res.save(Collections.EMPTY_MAP,true); - else - res.save(Collections.EMPTY_MAP); - } - } catch (IOException e) { - e.printStackTrace(); - } - } catch (Exception ex) { - ex.printStackTrace(); - } finally { - setWritableResource(null); - } - - } - -// private class ResourceChangeListener implements IResourceChangeListener { -// public void resourceChanged(IResourceChangeEvent event) { -// IResourceDelta delta= event.getDelta(); -// // make sure that there is a delta (since some events don't have one) -// if (delta != null) -// { -// IResourceDelta[] affectedChildren= delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED , IResource.FILE); -// IResourceDelta projectDelta = null; -// IResource changedResource = null; -// IProject changedProject = null; -// IPath resourcePath = null; -// -// for (int i= 0; i < affectedChildren.length; i++) { -// projectDelta = affectedChildren[i]; -// changedResource = projectDelta.getResource(); -// changedProject = changedResource.getProject(); -// HashSet<IPath> currentResources = modelResources.get(changedProject); -// // only deal with the projects that have resources that have been loaded -// if (currentResources != null) -// { -// // if this is a project deletion, remove the project from the HashMap. -// if (changedResource == changedProject && projectDelta.getKind() == IResourceDelta.REMOVED) -// { -// modelResources.remove(changedProject); -// // if modelResources is empty, we should self-destruct -// if (modelResources.isEmpty()) -// { -// resourceChangeListenerEnabled = false; -// ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); -// } -// } -// else -// { -// Iterator<IPath> iter = currentResources.iterator(); -// ArrayList<IPath> toUnload = new ArrayList<IPath>(); -// // check each resource that was loaded from the project to see if it is part of the change -// while (iter.hasNext()) -// { -// resourcePath = iter.next(); -// if (projectDelta.findMember(resourcePath) != null) -// { -// // limit the list of resources that need to be unloaded to those that have changed -// toUnload.add(resourcePath); -// } -// } -// if (toUnload.size() > 0) -// { -// Resource current = null; -// ProjectResourceSet resourceSet = getResourceSet(changedProject); -// URIConverter uriConverter = resourceSet.getURIConverter(); -// HashSet<URI> resourceURIs = new HashSet<URI>(); -// iter = toUnload.iterator(); -// while (iter.hasNext()) -// { -// // convert all of the resources to URIs - this is a faster match during the compare -// resourceURIs.add(uriConverter.normalize(URI.createURI(iter.next().toString()))); -// } -// Iterator<Resource> iter2 = resourceSet.getResources().iterator(); -// while (iter2.hasNext()) -// { -// current = iter2.next(); -// if (resourceURIs.contains(current.getURI())) -// { -// current.unload(); -// } -// } -// } -// } -// } -// } -// } -// } -// } - - public void addListener(IModelProviderListener listener) { - - listeners.add(listener); - } - - public void removeListener(IModelProviderListener listener) - { - listeners.remove(listener); - } - /** - * Save only resources that need to be saved (i.e., no other references). - */ - public void modelsChanged(IModelProviderEvent anEvent) { - int code = anEvent.getEventCode(); - switch (code) { - case IModelProviderEvent.REMOVED_RESOURCE : { - if (hasResourceReference(anEvent.getChangedResources())) - removeResources(anEvent.getChangedResources()); - else - return; - break; - } - } - if (hasListeners()) { - anEvent.setModel(this); - notifyListeners(anEvent); - } - } - protected void removeResources(List aList) { - Resource res; - for (int i = 0; i < aList.size(); i++) { - res = (Resource) aList.get(i); - removeResource(res) ; - } - } - /** - * Remove reference to the aResource. - */ - protected boolean removeResource(Resource aResource) { - if (aResource != null) { - aResource.eAdapters().remove(resourceAdapter); - return getResources().remove(aResource); - } - return false; - } - - /** - * Return true if any Resource in the list of - * - * @resources is referenced by me. - */ - protected boolean hasResourceReference(List tResources) { - for (int i = 0; i < tResources.size(); i++) { - if (hasResourceReference((Resource) tResources.get(i))) - return true; - } - return false; - } - /** - * Return true if aResource is referenced by me. - */ - protected boolean hasResourceReference(Resource aResource) { - if (aResource != null) - return getResources().contains(aResource); - return false; - } - - /** - * Notify listeners of - * - * @anEvent. - */ - protected void notifyListeners(IModelProviderEvent anEvent) { - - NotifyRunner notifier = new NotifyRunner(anEvent); - - Object[] notifyList = listeners.getListeners(); - for (int i = 0; i < notifyList.length; i++) { - notifier.setListener( (IModelProviderListener) notifyList[i] ); - SafeRunner.run(notifier); - } - } - public class NotifyRunner implements ISafeRunnable { - - private final IModelProviderEvent event; - private IModelProviderListener listener; - - public NotifyRunner(IModelProviderEvent event) { - Assert.isNotNull(event); - this.event = event; - } - - - public void setListener(IModelProviderListener listener) { - this.listener = listener; - } - - public void handleException(Throwable exception) { - JEEPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, JEEPlugin.PLUGIN_ID, 0, exception.getMessage(), exception)); - - } - - public void run() throws Exception { - if(listener != null) - listener.modelsChanged(event); - } - - } - public ResourceStateValidator getStateValidator() { - if (stateValidator == null) - stateValidator = createStateValidator(); - return stateValidator; - } - - /** - * Method createStateValidator. - * - * @return ResourceStateValidator - */ - private ResourceStateValidator createStateValidator() { - return new ResourceStateValidatorImpl(this); - } - - protected EnterpriseArtifactEdit createArtifactEdit() { - return null; - } - - public void checkActivation(ResourceStateValidatorPresenter presenter) throws CoreException { - getStateValidator().checkActivation(presenter); - - } - - public boolean checkReadOnly() { - return getStateValidator().checkReadOnly(); - } - - public boolean checkSave(ResourceStateValidatorPresenter presenter) throws CoreException { - return getStateValidator().checkSave(presenter); - } - - public void lostActivation(ResourceStateValidatorPresenter presenter) throws CoreException { - getStateValidator().lostActivation(presenter); - - } - - public IStatus validateState(ResourceStateValidatorPresenter presenter) throws CoreException { - if (presenter == null) - return Status.OK_STATUS; - return getStateValidator().validateState(presenter); - } - - public void cacheNonResourceValidateState(List roNonResourceFiles) { - // do nothing - } - - public List getNonResourceFiles() { - return null; - } - - public List getNonResourceInconsistentFiles() { - return null; - } - - public List getResources() { - return modelResources; - } - - - public boolean isDirty() { - - List list = getResources(); - for (int i = 0; i < list.size(); i++) { - if (((Resource) list.get(i)).isModified()) - return true; - } - return false; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index 16f46cd4f..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class AppClientCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider implements - IWebCreateDeploymentFilesDataModelProperties { - public IDataModelOperation getDefaultOperation() { - return new AppClientCreateDeploymentFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesOperation.java deleted file mode 100644 index 724cd1910..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/AppClientCreateDeploymentFilesOperation.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class AppClientCreateDeploymentFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public AppClientCreateDeploymentFilesOperation(IDataModel model) { - super(model); - } - - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - final IVirtualComponent component = ComponentCore.createComponent(project); - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - provider.modify(new Runnable(){ - public void run() { - } - }, IModelProvider.FORCESAVE); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelOperation.java deleted file mode 100644 index 6008bead4..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelOperation.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class CreateDeploymentFilesDataModelOperation extends - AbstractDataModelOperation { - - public CreateDeploymentFilesDataModelOperation(IDataModel model) { - super(model); - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - IProject targetProject = (IProject) model.getProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT); - createDeploymentFiles(targetProject, monitor); - return OK_STATUS; - } - - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - // do nothing - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index 83eb58834..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/CreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import java.util.Set; - -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class CreateDeploymentFilesDataModelProvider extends - AbstractDataModelProvider implements ICreateDeploymentFilesDataModelProperties { - - public Object getDefaultProperty(String propertyName) { - if(ICreateDeploymentFilesDataModelProperties.GENERATE_DD.equals(propertyName)){ - return true; - } - return super.getDefaultProperty(propertyName); - } - - public Set getPropertyNames() { - Set propertyNames = super.getPropertyNames(); - propertyNames.add(GENERATE_DD); - propertyNames.add(TARGET_PROJECT); - return propertyNames; - } - public IDataModelOperation getDefaultOperation() { - return new CreateDeploymentFilesDataModelOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index f01967632..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class EJBCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider implements - IEJBCreateDeploymentFilesDataModelProperties { - public IDataModelOperation getDefaultOperation() { - return new EJBCreateDeploymentFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesOperation.java deleted file mode 100644 index 90386ea2d..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EJBCreateDeploymentFilesOperation.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class EJBCreateDeploymentFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public EJBCreateDeploymentFilesOperation(IDataModel model) { - super(model); - } - - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - final IVirtualComponent component = ComponentCore.createComponent(project); - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - provider.modify(new Runnable(){ - public void run() { - } - }, IModelProvider.FORCESAVE); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index 3c3205806..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class EarCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider implements - IEarCreateDeploymentFilesDataModelProperties { - public IDataModelOperation getDefaultOperation() { - return new EarCreateDeploymentFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesOperation.java deleted file mode 100644 index 7b12a66cf..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/EarCreateDeploymentFilesOperation.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import java.util.List; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualReference; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class EarCreateDeploymentFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public EarCreateDeploymentFilesOperation(IDataModel model) { - super(model); - } - - protected void createDeploymentFiles(IProject project, final IProgressMonitor monitor) { - final IVirtualComponent component = ComponentCore.createComponent(project); - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - provider.modify(new Runnable(){ - public void run() { - IVirtualReference[] componentReferences = J2EEProjectUtilities.getJ2EEModuleReferences(component); - if(componentReferences != null && componentReferences.length > 0){ - final IDataModel dataModel = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider()); - dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, component); - List modList = (List) dataModel.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST); - for(int i = 0; i < componentReferences.length; i++) { - IVirtualComponent referencedComponent = componentReferences[i].getReferencedComponent(); - modList.add(referencedComponent); - } - dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modList); - try { - dataModel.getDefaultOperation().execute(monitor, null); - } catch (ExecutionException e) { - Logger.getLogger().logError(e); - } - } - } - }, IModelProvider.FORCESAVE); - - - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IAppClientCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IAppClientCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 6ed3be670..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IAppClientCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -public interface IAppClientCreateDeploymentFilesDataModelProperties extends - ICreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = AppClientCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ICreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ICreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index dd3ab5ff4..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/ICreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties; - -public interface ICreateDeploymentFilesDataModelProperties extends - IDataModelProperties { - - public static final String TARGET_PROJECT = "ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT"; //$NON-NLS-1$ - /** - * boolean property for Java EE 5 projects, to create/not create a deployment descriptor, - * The default value is false - */ - public static final String GENERATE_DD = "ICreateDeploymentFilesDataModelProperties.GENERATE_DD"; //$NON-NLS-1$ - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEJBCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEJBCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 72d50e2fa..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEJBCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -public interface IEJBCreateDeploymentFilesDataModelProperties extends - ICreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = EJBCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEarCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEarCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 5f1d59b69..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IEarCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -public interface IEarCreateDeploymentFilesDataModelProperties extends - ICreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = EarCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IWebCreateDeploymentFilesDataModelProperties.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IWebCreateDeploymentFilesDataModelProperties.java deleted file mode 100644 index 243337685..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/IWebCreateDeploymentFilesDataModelProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -public interface IWebCreateDeploymentFilesDataModelProperties extends - ICreateDeploymentFilesDataModelProperties { - /** - * This field should not be used. It is not part of the API and may be modified in the future. - */ - public static Class _provider_class = WebCreateDeploymentFilesDataModelProvider.class; - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/JEEFacetInstallDelegate.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/JEEFacetInstallDelegate.java deleted file mode 100644 index 54cc129a8..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/JEEFacetInstallDelegate.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.jst.j2ee.project.facet.J2EEFacetInstallDelegate; - -public abstract class JEEFacetInstallDelegate extends J2EEFacetInstallDelegate { - // this class used to have methods but now due to refactoring/model support it does not. -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesDataModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesDataModelProvider.java deleted file mode 100644 index a66c7e433..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesDataModelProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class WebCreateDeploymentFilesDataModelProvider extends - CreateDeploymentFilesDataModelProvider implements - IWebCreateDeploymentFilesDataModelProperties { - public IDataModelOperation getDefaultOperation() { - return new WebCreateDeploymentFilesOperation(model); - } - -} diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesOperation.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesOperation.java deleted file mode 100644 index a086d4736..000000000 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/project/facet/WebCreateDeploymentFilesOperation.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.eclipse.jst.jee.project.facet; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.javaee.web.WebFactory; -import org.eclipse.jst.javaee.web.WelcomeFileList; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class WebCreateDeploymentFilesOperation extends - CreateDeploymentFilesDataModelOperation { - - - public WebCreateDeploymentFilesOperation(IDataModel model) { - super(model); - } - - protected void createDeploymentFiles(IProject project, IProgressMonitor monitor) { - final IVirtualComponent component = ComponentCore.createComponent(project); - final IModelProvider provider = ModelProviderManager.getModelProvider(project); - - provider.modify(new Runnable(){ - public void run() { - WebApp webApp = (WebApp) provider.getModelObject(); - - // welcome file list - List<String> welcomeFiles = Arrays.asList( - "index.html", //$NON-NLS-1$ - "index.htm", //$NON-NLS-1$ - "index.jsp", //$NON-NLS-1$ - "default.html", //$NON-NLS-1$ - "default.htm", //$NON-NLS-1$ - "default.jsp" //$NON-NLS-1$ - ); - - // Add the welcome-file-list tag - WelcomeFileList welcomeFileList = (WelcomeFileList) WebFactory.eINSTANCE.createWelcomeFileList(); - welcomeFileList.getWelcomeFiles().addAll(welcomeFiles); - webApp.getWelcomeFileLists().add(welcomeFileList); - } - }, IModelProvider.FORCESAVE); - - } - -} |