Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst')
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/frameworks/CommonFrameworksPlugin.java57
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathDecorations.java75
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathDecorationsManager.java371
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathUtil.java113
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java561
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainerInitializer.java83
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaArtifactEditModel.java229
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaArtifactEditModelFactory.java71
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaProjectValidationHandler.java56
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WTPWorkingCopyManager.java542
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyManager.java49
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyManagerFactory.java57
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyProvider.java60
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/IJavaFacetInstallDataModelProperties.java20
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetInstallDataModelProvider.java137
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetUtils.java86
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaProjectFacetCreationDataModelProvider.java32
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/WtpUtils.java69
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/internal/DataModelToJavaFacetInstallConfigAdapter.java48
-rw-r--r--plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/internal/JavaFacetInstallConfigToDataModelAdapter.java50
20 files changed, 0 insertions, 2766 deletions
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/frameworks/CommonFrameworksPlugin.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/frameworks/CommonFrameworksPlugin.java
deleted file mode 100644
index 30c8da29e..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/frameworks/CommonFrameworksPlugin.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.common.frameworks;
-
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
-
-public final class CommonFrameworksPlugin
-
- extends WTPPlugin
-
-{
- public static final String PLUGIN_ID = "org.eclipse.jst.common.frameworks"; //$NON-NLS-1$
- public static final String DEFAULT_SOURCE_FOLDER = "defaultSource"; //$NON-NLS-1$
- public static final String OUTPUT_FOLDER = "outputFolder"; //$NON-NLS-1$
-
- private static CommonFrameworksPlugin inst;
-
- /**
- * Get the plugin singleton.
- */
-
- public static CommonFrameworksPlugin getDefault()
- {
- return inst;
- }
-
- public CommonFrameworksPlugin() {
- super();
- if (inst == null)
- inst = this;
- }
- public String getPluginID()
- {
- return PLUGIN_ID;
- }
-
- public static void log( final Exception e )
- {
- final ILog log = CommonFrameworksPlugin.getDefault().getLog();
- final String msg = "Encountered an unexpected exception."; //$NON-NLS-1$
-
- log.log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e ) );
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathDecorations.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathDecorations.java
deleted file mode 100644
index 4e4cb5f5d..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathDecorations.java
+++ /dev/null
@@ -1,75 +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.common.jdt.internal.classpath;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathAttribute;
-import org.eclipse.jdt.core.JavaCore;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ClasspathDecorations
-{
- private IPath sourceAttachmentPath;
- private IPath sourceAttachmentRootPath;
- private ArrayList extraAttributes = new ArrayList();
-
- public IPath getSourceAttachmentPath()
- {
- return this.sourceAttachmentPath;
- }
-
- public void setSourceAttachmentPath( final IPath sourceAttachmentPath )
- {
- this.sourceAttachmentPath = sourceAttachmentPath;
- }
-
- public IPath getSourceAttachmentRootPath()
- {
- return this.sourceAttachmentRootPath;
- }
-
- public void setSourceAttachmentRootPath( final IPath sourceAttachmentRootPath )
- {
- this.sourceAttachmentRootPath = sourceAttachmentRootPath;
- }
-
- public IClasspathAttribute[] getExtraAttributes()
- {
- final IClasspathAttribute[] array
- = new IClasspathAttribute[ this.extraAttributes.size() ];
-
- return (IClasspathAttribute[]) this.extraAttributes.toArray( array );
- }
-
- public void setExtraAttributes( final IClasspathAttribute[] attrs )
- {
- for( int i = 0; i < attrs.length; i++ )
- {
- this.extraAttributes.add( attrs[ i ] );
- }
- }
-
- public void addExtraAttribute( final String name,
- final String value )
- {
- final IClasspathAttribute attr
- = JavaCore.newClasspathAttribute( name, value );
-
- this.extraAttributes.add( attr );
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathDecorationsManager.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathDecorationsManager.java
deleted file mode 100644
index c66358a53..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathDecorationsManager.java
+++ /dev/null
@@ -1,371 +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.common.jdt.internal.classpath;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathAttribute;
-import org.eclipse.jst.common.frameworks.CommonFrameworksPlugin;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ClasspathDecorationsManager
-{
- private final File f;
- private final HashMap decorations;
-
- public ClasspathDecorationsManager( final String plugin )
- {
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- final File wsdir = ws.getRoot().getLocation().toFile();
- final File wsmdroot = new File( wsdir, ".metadata/.plugins" ); //$NON-NLS-1$
- final File pmdroot = new File( wsmdroot, plugin );
-
- this.f = new File( pmdroot, "classpath.decorations.xml" ); //$NON-NLS-1$
- this.decorations = read();
- }
-
- public ClasspathDecorations getDecorations( final String key,
- final String entry )
- {
- final HashMap submap = (HashMap) this.decorations.get( key );
-
- if( submap == null )
- {
- return null;
- }
-
- return (ClasspathDecorations) submap.get( entry );
- }
-
- public void setDecorations( final String key,
- final String entry,
- final ClasspathDecorations dec )
- {
- HashMap submap = (HashMap) this.decorations.get( key );
-
- if( submap == null )
- {
- submap = new HashMap();
- this.decorations.put( key, submap );
- }
-
- submap.put( entry, dec );
- }
-
- public void clearAllDecorations( final String key )
- {
- this.decorations.remove( key );
- }
-
- public void save()
- {
- final File folder = this.f.getParentFile();
-
- if( ! folder.exists() && ! folder.mkdirs() )
- {
- return;
- }
-
- PrintWriter w = null;
-
- try
- {
- w = new PrintWriter( new BufferedWriter( new FileWriter( this.f ) ) );
-
- w.println( "<classpath>" ); //$NON-NLS-1$
-
- for( Iterator itr1 = decorations.entrySet().iterator();
- itr1.hasNext(); )
- {
- final Map.Entry entry1 = (Map.Entry) itr1.next();
- final Map submap = (Map) entry1.getValue();
-
- w.print( " <container id=\"" ); //$NON-NLS-1$
- w.print( (String) entry1.getKey() );
- w.println( "\">" ); //$NON-NLS-1$
-
- for( Iterator itr2 = submap.entrySet().iterator();
- itr2.hasNext(); )
- {
- final Map.Entry entry2 = (Map.Entry) itr2.next();
-
- final ClasspathDecorations dec
- = (ClasspathDecorations) entry2.getValue();
-
- w.print( " <entry id=\"" ); //$NON-NLS-1$
- w.print( (String) entry2.getKey() );
- w.println( "\">" ); //$NON-NLS-1$
-
- if( dec.getSourceAttachmentPath() != null )
- {
- w.print( " <source-attachment-path>" ); //$NON-NLS-1$
- w.print( dec.getSourceAttachmentPath().toString() );
- w.println( "</source-attachment-path>" ); //$NON-NLS-1$
- }
-
- if( dec.getSourceAttachmentRootPath() != null )
- {
- w.print( " <source-attachment-root-path>" ); //$NON-NLS-1$
- w.print( dec.getSourceAttachmentRootPath().toString() );
- w.println( "</source-attachment-root-path>" ); //$NON-NLS-1$
- }
-
- final IClasspathAttribute[] attrs
- = dec.getExtraAttributes();
-
- for( int i = 0; i < attrs.length; i++ )
- {
- final IClasspathAttribute attr = attrs[ i ];
-
- w.print( " <attribute name=\"" ); //$NON-NLS-1$
- w.print( attr.getName() );
- w.print( "\">" ); //$NON-NLS-1$
- w.print( attr.getValue() );
- w.println( "</attribute>" ); //$NON-NLS-1$
- }
-
- w.println( " </entry>" ); //$NON-NLS-1$
- }
-
- w.println( " </container>" ); //$NON-NLS-1$
- }
-
- w.println( "</classpath>" ); //$NON-NLS-1$
- }
- catch( IOException e )
- {
- CommonFrameworksPlugin.log( e );
- }
- finally
- {
- w.close();
- }
- }
-
- private HashMap read()
- {
- final HashMap map = new HashMap();
- if( ! this.f.exists() ) return map;
-
- InputStream in = null;
- Element root = null;
-
- try
- {
- final DocumentBuilderFactory factory
- = DocumentBuilderFactory.newInstance();
-
- final DocumentBuilder docbuilder = factory.newDocumentBuilder();
-
- in = new BufferedInputStream( new FileInputStream( f ) );
- root = docbuilder.parse( in ).getDocumentElement();
- }
- catch( Exception e )
- {
- CommonFrameworksPlugin.log( e );
- return map;
- }
- finally
- {
- if( in != null )
- {
- try
- {
- in.close();
- }
- catch( IOException e ) {}
- }
- }
-
- for( Iterator itr1 = elements( root, "container" ); itr1.hasNext(); ) //$NON-NLS-1$
- {
- final Element e1 = (Element) itr1.next();
- final String cid = e1.getAttribute( "id" ); //$NON-NLS-1$
-
- final HashMap submap = new HashMap();
- map.put( cid, submap );
-
- for( Iterator itr2 = elements( e1, "entry" ); itr2.hasNext(); ) //$NON-NLS-1$
- {
- final Element e2 = (Element) itr2.next();
- final String eid = e2.getAttribute( "id" ); //$NON-NLS-1$
- final ClasspathDecorations dec = new ClasspathDecorations();
-
- submap.put( eid, dec );
-
- for( Iterator itr3 = elements( e2 ); itr3.hasNext(); )
- {
- final Element e3 = (Element) itr3.next();
- final String n = e3.getNodeName();
-
- if( n.equals( "source-attachment-path" ) ) //$NON-NLS-1$
- {
- dec.setSourceAttachmentPath( new Path( text( e3 ) ) );
- }
- else if( n.equals( "source-attachment-root-path" ) ) //$NON-NLS-1$
- {
- dec.setSourceAttachmentRootPath( new Path( text( e3 ) ) );
- }
- else if( n.equals( "attribute" ) ) //$NON-NLS-1$
- {
- final String name = e3.getAttribute( "name" ); //$NON-NLS-1$
- dec.addExtraAttribute( name, text( e3 ) );
- }
- }
- }
- }
-
- return map;
- }
-
- private static String text( final Element el )
- {
- final NodeList nodes = el.getChildNodes();
-
- String str = null;
- StringBuffer buf = null;
-
- for( int i = 0, n = nodes.getLength(); i < n; i++ )
- {
- final Node node = nodes.item( i );
-
- if( node.getNodeType() == Node.TEXT_NODE )
- {
- final String val = node.getNodeValue();
-
- if( buf != null )
- {
- buf.append( val );
- }
- else if( str != null )
- {
- buf = new StringBuffer();
- buf.append( str );
- buf.append( val );
-
- str = null;
- }
- else
- {
- str = val;
- }
- }
- }
-
- if( buf != null )
- {
- return buf.toString();
- }
- return str;
- }
-
- private static Iterator elements( final Element el,
- final String name )
- {
- return new ElementsIterator( el, name );
- }
-
- private static Iterator elements( final Element el )
- {
- return new ElementsIterator( el, null );
- }
-
- private static final class ElementsIterator
-
- implements Iterator
-
- {
- private final NodeList nodes;
- private final int length;
- private final String name;
- private int position;
- private Element element;
-
- public ElementsIterator( final Element parent,
- final String name )
- {
- this.nodes = parent.getChildNodes();
- this.length = nodes.getLength();
- this.position = -1;
- this.name = name;
-
- advance();
- }
-
- private void advance()
- {
- this.element = null;
- this.position++;
-
- for( ; this.position < this.length && this.element == null;
- this.position++ )
- {
- final Node node = this.nodes.item( this.position );
-
- if( node.getNodeType() == Node.ELEMENT_NODE &&
- ( this.name == null ||
- node.getNodeName().equals( this.name ) ) )
- {
- this.element = (Element) node;
- }
- }
- }
-
- public boolean hasNext()
- {
- return ( this.element != null );
- }
-
- public Object next()
- {
- final Element el = this.element;
-
- if( el == null )
- {
- throw new NoSuchElementException();
- }
-
- advance();
-
- return el;
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathUtil.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathUtil.java
deleted file mode 100644
index c4161f49b..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/ClasspathUtil.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2006 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.common.jdt.internal.classpath;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IPath;
-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.jem.util.logger.proxy.Logger;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class ClasspathUtil
-{
- private ClasspathUtil() {}
-
- public static Set getResolvedClasspath( final IJavaProject jproj,
- final IPath entryToIgnore )
- {
- return getResolvedClasspath( jproj, Collections.singleton( entryToIgnore ) );
- }
-
- public static Set getResolvedClasspath( final IJavaProject jproj,
- final Set entriesToIgnore )
- {
- final Set resolved = new HashSet();
-
- try
- {
- final IClasspathEntry[] entries = jproj.getRawClasspath();
-
- for( int i = 0; i < entries.length; i++ )
- {
- IClasspathEntry entry = entries[ i ];
-
- if( entriesToIgnore.contains( entry.getPath() ) )
- {
- continue;
- }
-
- switch( entry.getEntryKind() )
- {
- case IClasspathEntry.CPE_LIBRARY:
- case IClasspathEntry.CPE_PROJECT:
- {
- resolved.add( entry.getPath() );
- break;
- }
- case IClasspathEntry.CPE_VARIABLE:
- {
- entry = JavaCore.getResolvedClasspathEntry( entry );
-
- if( entry != null )
- {
- resolved.add( entry.getPath() );
- }
-
- break;
- }
- case IClasspathEntry.CPE_CONTAINER:
- {
- final IClasspathContainer container;
-
- try
- {
- container = JavaCore.getClasspathContainer( entry.getPath(), jproj );
- }
- catch( JavaModelException e )
- {
- Logger.getLogger().logError( e );
- continue;
- }
-
- if( container != null )
- {
- final IClasspathEntry[] containerEntries
- = container.getClasspathEntries();
-
- for( int j = 0; j < containerEntries.length; j++ )
- {
- resolved.add( containerEntries[ j ].getPath() );
- }
- }
- }
- }
- }
- }
- catch( JavaModelException e )
- {
- Logger.getLogger().logError( e );
- }
-
- return resolved;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java
deleted file mode 100644
index 34d2253e6..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java
+++ /dev/null
@@ -1,561 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005, 2006 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.common.jdt.internal.classpath;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-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.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IAccessRule;
-import org.eclipse.jdt.core.IClasspathAttribute;
-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.frameworks.CommonFrameworksPlugin;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class FlexibleProjectContainer
-
- implements IClasspathContainer
-
-{
- protected static final class PathType
- {
- public static final PathType
- LIB_DIRECTORY = new PathType(),
- CLASSES_DIRECTORY = new PathType();
- }
-
- private static ClasspathDecorationsManager decorations;
-
- static
- {
- // Register the resource listener that will listen for changes to
- // resources relevant to flexible project containers across the
- // workspace and refresh them as necessary.
-
- Listener.register();
-
- // Read the decorations from the workspace metadata.
-
- final String plugin = CommonFrameworksPlugin.PLUGIN_ID;
- decorations = new ClasspathDecorationsManager( plugin );
- }
-
- private static final String SEPARATOR = "!"; //$NON-NLS-1$
-
- public static String getDecorationManagerKey(IProject project, String container){
- return project.getName() + SEPARATOR + container;
- }
-
- protected final IPath path;
- protected final IJavaProject owner;
- protected final IProject project;
- private final IPath[] paths;
- private final PathType[] pathTypes;
- private final List entries;
- private final IClasspathEntry[] cpentries;
- private static final Set containerTypes = new HashSet();
-
- public FlexibleProjectContainer( final IPath path,
- final IJavaProject owner,
- final IProject project,
- final IPath[] paths,
- final PathType[] types )
- {
- this.path = path;
- this.owner = owner;
- this.project = project;
- this.paths = paths;
- this.pathTypes = types;
-
- if( ! isFlexibleProject( this.project ) )
- {
- // Silently noop if the referenced project is not a flexible
- // project. Should I be doing something else here?
-
- this.entries = Collections.EMPTY_LIST;
- this.cpentries = new IClasspathEntry[ 0 ];
-
- return;
- }
-
- addFlexibleProjectContainerType( path.segment( 0 ) );
-
- this.entries = computeClasspathEntries();
- this.cpentries = new IClasspathEntry[ this.entries.size() ];
-
- for( int i = 0, n = this.entries.size(); i < n; i++ )
- {
- IPath entryPath = (IPath) this.entries.get( i );
- IResource resource =ResourcesPlugin.getWorkspace().getRoot().findMember(entryPath);
- if(null != resource && resource.getType() == IResource.PROJECT)
- this.cpentries[ i ] = JavaCore.newProjectEntry(entryPath, false);
- else
- this.cpentries[ i ] = newLibraryEntry( entryPath );
- }
- }
-
- public int getKind()
- {
- return K_APPLICATION;
- }
-
- public IPath getPath()
- {
- return this.path;
- }
-
- public IClasspathEntry[] getClasspathEntries()
- {
- return this.cpentries;
- }
-
- public boolean isOutOfDate( final IResourceDelta delta )
- {
- if( delta == null )
- {
- return false;
- }
-
- final List currentEntries = computeClasspathEntries();
- return ! this.entries.equals( currentEntries );
- }
-
- public abstract void refresh();
-
- static ClasspathDecorationsManager getDecorationsManager()
- {
- return decorations;
- }
-
- private List computeClasspathEntries()
- {
- final List entries = new ArrayList();
-
- final IVirtualComponent vc
- = ComponentCore.createComponent( this.project );
-
- if( vc == null )
- {
- return entries;
- }
-
- IVirtualReference[] refs = vc.getReferences();
- IVirtualComponent comp = null;
- Set jarsHandled = new HashSet();
- String jarName = null;
- for (int i = 0; i < refs.length; i++) {
- comp = refs[i].getReferencedComponent();
- if (!refs[i].getRuntimePath().equals(paths[0].makeAbsolute()))
- continue;
- jarName = refs[i].getArchiveName();
- if(null != jarName){
- jarsHandled.add(jarName);
- }
- IPath newPath = null;
- if (comp.isBinary()) {
- VirtualArchiveComponent archiveComp = (VirtualArchiveComponent) comp;
- if (archiveComp.getArchiveType().equals(VirtualArchiveComponent.CLASSPATHARCHIVETYPE)) {
- // do not process components dynamically computed from the Java classpath
- continue;
- }
- java.io.File diskFile = archiveComp.getUnderlyingDiskFile();
- if (diskFile.exists()) {
- newPath =new Path(diskFile.getAbsolutePath());
- } else {
- IFile iFile = archiveComp.getUnderlyingWorkbenchFile();
- if (!entries.contains(iFile.getFullPath())){
- newPath = iFile.getFullPath();
- }
- }
- } else {
- IProject project = comp.getProject();
- newPath = project.getFullPath();
- }
-
- if( newPath != null )
- {
- entries.add( newPath );
- }
- }
-
- for( int i = 0; i < this.paths.length; i++ )
- {
- final IVirtualFolder rootFolder = vc.getRootFolder();
- final IVirtualFolder vf = rootFolder.getFolder( paths[ i ] );
-
- if( this.pathTypes[ i ] == PathType.LIB_DIRECTORY )
- {
- final IVirtualResource[] contents;
-
- try
- {
- contents = members( vf );
- }
- catch( CoreException e )
- {
- CommonFrameworksPlugin.log( e );
- continue;
- }
-
- for( int j = 0; j < contents.length; j++ )
- {
- final IResource r = contents[ j ].getUnderlyingResource();
- final IPath p = r.getLocation();
-
- if(!jarsHandled.contains(p.lastSegment()) && isJarFile( r ) )
- {
- jarsHandled.add(p.lastSegment());
- entries.add( p );
- }
- }
- }
- else
- {
- final IContainer[] uf = vf.getUnderlyingFolders();
-
- for( int j = 0; j < uf.length; j++ )
- {
- final IPath p = uf[ j ].getFullPath();
-
- if( ! jarsHandled.contains( p.lastSegment() ) &&
- ! isSourceOrOutputDirectory( p ) )
- {
- jarsHandled.add(p.lastSegment());
- entries.add( p );
- }
- }
- }
- }
-
- return entries;
- }
-
- // TODO: This method was created to provide a safe last-minute workaround
- // for the issue described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=162974.
- // This code needs to be revisited in a future release to find a more
- // permanent solution.
-
- protected IVirtualResource[] members( final IVirtualFolder vf )
-
- throws CoreException
-
- {
- return vf.members();
- }
-
- private IClasspathEntry newLibraryEntry( final IPath p )
- {
- IPath srcpath = null;
- IPath srcrootpath = null;
- IClasspathAttribute[] attrs = {};
- IAccessRule[] access = {};
-
- final ClasspathDecorations dec
- = decorations.getDecorations( getDecorationManagerKey(project, getPath().toString()), p.toString() );
-
- if( dec != null )
- {
- srcpath = dec.getSourceAttachmentPath();
- srcrootpath = dec.getSourceAttachmentRootPath();
- attrs = dec.getExtraAttributes();
- }
-
- return JavaCore.newLibraryEntry( p, srcpath, srcrootpath, access, attrs,
- false );
-
- }
-
- private boolean isSourceOrOutputDirectory( final IPath aPath )
- {
- if( isJavaProject( this.project ) )
- {
- try
- {
- final IJavaProject jproject = JavaCore.create( this.project );
- final IClasspathEntry[] cp = jproject.getRawClasspath();
-
- for( int i = 0; i < cp.length; i++ )
- {
- final IClasspathEntry cpe = cp[ i ];
-
- if( cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE )
- {
- final IPath src = cpe.getPath();
- final IPath output = cpe.getOutputLocation();
-
- if( src.equals( aPath ) ||
- output != null && output.equals( aPath ) )
- {
- return true;
- }
- }
- }
-
- if( jproject.getOutputLocation().equals( aPath ) )
- {
- return true;
- }
- }
- catch( JavaModelException e )
- {
- CommonFrameworksPlugin.log( e );
- }
- }
-
- return false;
- }
-
- private static boolean isJavaProject( final IProject pj )
- {
- try
- {
- return pj.getNature( JavaCore.NATURE_ID ) != null;
- }
- catch( CoreException e )
- {
- return false;
- }
- }
-
- private static boolean isFlexibleProject( final IProject pj )
- {
- try
- {
- return pj.getNature( IModuleConstants.MODULE_NATURE_ID ) != null;
- }
- catch( CoreException e )
- {
- return false;
- }
- }
-
- private static boolean isJarFile( final IResource f )
- {
- if( f.getType() == IResource.FILE )
- {
- final String fname = f.getName();
-
- if( fname.endsWith( ".jar" ) || fname.endsWith( ".zip" ) ) //$NON-NLS-1$ //$NON-NLS-2$
- {
- return true;
- }
- }
-
- return false;
- }
-
- private static boolean isMetadataFile( final IResource f )
- {
- if( f.getType() == IResource.FILE )
- {
- final String fname = f.getName();
-
- if( fname.equals( ".component" ) || //$NON-NLS-1$
- fname.equals( "org.eclipse.wst.common.component" ) || //$NON-NLS-1$
- fname.equals( ".classpath")) //$NON-NLS-1$
- {
- return true;
- }
- }
-
- return false;
- }
-
- private static boolean isFlexibleProjectContainer( final IPath path )
- {
- synchronized( containerTypes )
- {
- return containerTypes.contains( path.segment( 0 ) );
- }
- }
-
- private static void addFlexibleProjectContainerType( final String type )
- {
- synchronized( containerTypes )
- {
- containerTypes.add( type );
- }
- }
-
- private static final class Listener
-
- implements IResourceChangeListener
-
- {
- public static void register()
- {
- final Listener listener = new Listener();
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.addResourceChangeListener( listener, IResourceChangeEvent.PRE_BUILD );
- }
-
- public void resourceChanged( final IResourceChangeEvent event )
- {
- // Screen the delta before going any further.
-
- if( ! isInterestingEvent( event ) )
- {
- return;
- }
-
- // Locate all of the flexible project containers.
-
- final ArrayList containers = new ArrayList();
-
- final IProject[] projects
- = ResourcesPlugin.getWorkspace().getRoot().getProjects();
-
- for( int i = 0; i < projects.length; i++ )
- {
- final IProject project = projects[ i ];
-
- try
- {
- if( isJavaProject( project ) )
- {
- final IJavaProject jproj = JavaCore.create( project );
- final IClasspathEntry[] cpes = jproj.getRawClasspath();
-
- for( int j = 0; j < cpes.length; j++ )
- {
- final IClasspathEntry cpe = cpes[ j ];
- final IPath path = cpe.getPath();
-
- if( cpe.getEntryKind() == IClasspathEntry.CPE_CONTAINER &&
- isFlexibleProjectContainer( path ) )
- {
- final IClasspathContainer cont
- = JavaCore.getClasspathContainer( path, jproj );
-
- containers.add( cont );
- }
- }
- }
- }
- catch( JavaModelException e )
- {
- CommonFrameworksPlugin.log( e );
- }
- }
-
- // Refresh the containers that are out of date.
-
- final IResourceDelta delta = event.getDelta();
-
- for( int i = 0, n = containers.size(); i < n; i++ )
- {
- final FlexibleProjectContainer c
- = (FlexibleProjectContainer) containers.get( i );
-
- if( c.isOutOfDate( delta ) )
- {
- c.refresh();
- }
- }
- }
-
- private static boolean isInterestingEvent( final IResourceChangeEvent event )
- {
- final boolean[] result = new boolean[ 1 ];
-
- final IResourceDeltaVisitor visitor = new IResourceDeltaVisitor()
- {
- public boolean visit( final IResourceDelta delta )
- {
- final IResource r = delta.getResource();
-
- switch( r.getType() )
- {
- case IResource.ROOT:
- {
- return true;
- }
- case IResource.PROJECT:
- {
- return ModuleCoreNature.isFlexibleProject( (IProject) r );
- }
- case IResource.FOLDER:
- {
- final int kind = delta.getKind();
-
- if( kind == IResourceDelta.ADDED ||
- kind == IResourceDelta.REMOVED )
- {
- result[ 0 ] = true;
- return false;
- }
- else
- {
- return true;
- }
- }
- case IResource.FILE:
- {
- if( isJarFile( r ) || isMetadataFile( r ) )
- {
- result[ 0 ] = true;
- }
-
- return false;
- }
- default:
- {
- return false;
- }
- }
- }
- };
-
- try
- {
- event.getDelta().accept( visitor, false );
- }
- catch( CoreException e )
- {
- CommonFrameworksPlugin.log( e );
- }
-
- return result[ 0 ];
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainerInitializer.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainerInitializer.java
deleted file mode 100644
index 90540683d..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainerInitializer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005, 2006 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.common.jdt.internal.classpath;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.ClasspathContainerInitializer;
-import org.eclipse.jdt.core.IClasspathAttribute;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public abstract class FlexibleProjectContainerInitializer
-
- extends ClasspathContainerInitializer
-
-{
- private static final ClasspathDecorationsManager decorations
- = FlexibleProjectContainer.getDecorationsManager();
-
- public boolean canUpdateClasspathContainer( final IPath containerPath,
- final IJavaProject project)
- {
- return true;
- }
-
- public void requestClasspathContainerUpdate( final IPath containerPath,
- final IJavaProject project,
- final IClasspathContainer sg )
-
- throws CoreException
-
- {
- final String key = FlexibleProjectContainer.getDecorationManagerKey(project.getProject(), containerPath.toString());
-
- final IClasspathEntry[] entries = sg.getClasspathEntries();
-
- decorations.clearAllDecorations( key );
-
- for( int i = 0; i < entries.length; i++ )
- {
- final IClasspathEntry entry = entries[ i ];
-
- final IPath srcpath = entry.getSourceAttachmentPath();
- final IPath srcrootpath = entry.getSourceAttachmentRootPath();
- final IClasspathAttribute[] attrs = entry.getExtraAttributes();
-
- if( srcpath != null || attrs.length > 0 )
- {
- final String eid = entry.getPath().toString();
- final ClasspathDecorations dec = new ClasspathDecorations();
-
- dec.setSourceAttachmentPath( srcpath );
- dec.setSourceAttachmentRootPath( srcrootpath );
- dec.setExtraAttributes( attrs );
-
- decorations.setDecorations( key, eid, dec );
- }
- }
-
- decorations.save();
-
- final IClasspathContainer container
- = JavaCore.getClasspathContainer( containerPath, project );
-
- ( (FlexibleProjectContainer) container ).refresh();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaArtifactEditModel.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaArtifactEditModel.java
deleted file mode 100644
index fe87044db..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaArtifactEditModel.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.common.jdt.internal.integration;
-
-import java.util.Set;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
-import org.eclipse.wst.common.frameworks.internal.SaveFailedException;
-import org.eclipse.wst.common.internal.emf.resource.CompatibilityXMIResource;
-import org.eclipse.wst.common.internal.emf.resource.ReferencedResource;
-import org.eclipse.wst.common.internal.emf.resource.TranslatorResource;
-import org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext;
-
-public class JavaArtifactEditModel extends ArtifactEditModel implements WorkingCopyProvider {
-
- private WorkingCopyManager workingCopyManager = null;
-
- public JavaArtifactEditModel(String anEditModelId, EMFWorkbenchContext context, boolean toMakeReadOnly,
- boolean toAccessUnknownResourcesAsReadOnly, URI moduleURI, URI rootURI, String rootContentType) {
- super(anEditModelId, context, toMakeReadOnly, toAccessUnknownResourcesAsReadOnly, moduleURI, rootURI, rootContentType);
- // TODO Auto-generated constructor stub
- }
-
- public JavaArtifactEditModel(String editModelID, EMFWorkbenchContext context, boolean toMakeReadOnly, URI moduleURI, URI rootURI,
- String rootContentType) {
- super(editModelID, context, toMakeReadOnly, moduleURI, rootURI, rootContentType);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param anEditModelId
- * @param aContext
- * @param toMakeReadOnly
- * @param toAccessUnknownResourcesAsReadOnly
- * @param aModuleURI
- */
- public JavaArtifactEditModel(String anEditModelId, EMFWorkbenchContext aContext, boolean toMakeReadOnly, boolean toAccessUnknownResourcesAsReadOnly, URI aModuleURI) {
- super(anEditModelId, aContext, toMakeReadOnly,
- toAccessUnknownResourcesAsReadOnly, aModuleURI);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param anEditModelId
- * @param aContext
- * @param toMakeReadOnly
- * @param aModuleURI
- */
- public JavaArtifactEditModel(String anEditModelId, EMFWorkbenchContext aContext, boolean toMakeReadOnly, URI aModuleURI) {
- super(anEditModelId, aContext, toMakeReadOnly, aModuleURI);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * This will delete
- *
- * @cu from the workbench and fix the internal references for this working copy manager.
- */
- public void delete(org.eclipse.jdt.core.ICompilationUnit cu, org.eclipse.core.runtime.IProgressMonitor monitor) {
- getWorkingCopyManager().delete(cu, monitor);
- }
-
- /**
- * This method should only be called by the J2EENature.
- */
- protected void doDispose() {
- super.doDispose();
- resetWorkingCopyManager();
- }
-
- public Set getAffectedFiles() {
- java.util.Set affected = super.getAffectedFiles();
- if (getWorkingCopyManager() != null)
- affected.addAll(getWorkingCopyManager().getAffectedFiles());
-
- return affected;
- }
-
- /**
- * Returns the working copy remembered for the compilation unit encoded in the given editor
- * input. Does not connect the edit model to the working copy.
- *
- * @param input
- * ICompilationUnit
- * @return the working copy of the compilation unit, or <code>null</code> if the input does
- * not encode an editor input, or if there is no remembered working copy for this
- * compilation unit
- */
- public org.eclipse.jdt.core.ICompilationUnit getExistingWorkingCopy(org.eclipse.jdt.core.ICompilationUnit cu) throws org.eclipse.core.runtime.CoreException {
- return getWorkingCopyManager().getExistingWorkingCopy(cu);
- }
-
- /**
- * Returns the working copy remembered for the compilation unit.
- *
- * @param input
- * ICompilationUnit
- * @return the working copy of the compilation unit, or <code>null</code> if there is no
- * remembered working copy for this compilation unit
- */
- public org.eclipse.jdt.core.ICompilationUnit getWorkingCopy(ICompilationUnit cu, boolean forNewCU) throws CoreException {
- return getWorkingCopyManager().getWorkingCopy(cu, forNewCU);
- }
-
- /**
- * Save the new compilation units only.
- */
- protected void handleSaveIfNecessaryDidNotSave(IProgressMonitor monitor) {
- getWorkingCopyManager().saveOnlyNewCompilationUnits(monitor);
- }
-
- /**
- * @see org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel#isDirty()
- */
- public boolean isDirty() {
- boolean dirtyBool = super.isDirty();
- if (!dirtyBool && getWorkingCopyManager() != null)
- dirtyBool = getWorkingCopyManager().hasWorkingCopies();
- return dirtyBool;
- }
-
- /**
- * This will force all of the referenced Resources to be saved.
- */
- public void primSave(IProgressMonitor monitor) {
- saveCompilationUnits(monitor);
- if (monitor == null || !monitor.isCanceled())
- super.primSave(monitor);
- }
- protected void runSaveOperation(IWorkspaceRunnable runnable, IProgressMonitor monitor) throws SaveFailedException {
- try {
- ResourcesPlugin.getWorkspace().run(runnable, null,IWorkspace.AVOID_UPDATE,monitor);
- } catch (CoreException e) {
- throw new SaveFailedException(e);
- }
- }
-
- /**
- * Insert the method's description here. Creation date: (4/11/2001 4:14:26 PM)
- *
- * @return java.util.Set
- */
- public void processResource(Resource aResource) {
- if (aResource != null && !getResources().contains(aResource)) {
- if (aResource instanceof ReferencedResource) {
- access((ReferencedResource) aResource);
- //We need a better way to pass this through the save options instead.
- //We also need to make this dynamic based on the project target
- ((ReferencedResource) aResource).setFormat(CompatibilityXMIResource.FORMAT_MOF5);
- } else if (!isReadOnly())
- aResource.setTrackingModification(true);
- addResource(aResource);
- }
- }
-
- /**
- * Release each of the referenced resources.
- */
- protected void release(Resource aResource) {
-
- removeResource(aResource);
- if (aResource != null) {
- boolean isRefRes = aResource instanceof ReferencedResource;
- if (isRefRes)
- release((ReferencedResource) aResource);
- if (!isDisposing())
- resetWorkingCopyManager();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.workbench.J2EEEditModel#resourceIsLoadedChanged(org.eclipse.emf.ecore.resource.Resource,
- * boolean, boolean)
- */
- protected void resourceIsLoadedChanged(Resource aResource, boolean oldValue, boolean newValue) {
- if (!isReverting && !disposing && !isReadOnly() && oldValue && !newValue && aResource instanceof TranslatorResource)
- resetWorkingCopyManager();
- super.resourceIsLoadedChanged(aResource, oldValue, newValue);
- }
-
- protected void reverted(ReferencedResource revertedResource) {
- if (getWorkingCopyManager() != null)
- getWorkingCopyManager().revert();
- revertAllResources();
- }
-
- /**
- * This will save all of the referenced CompilationUnits to be saved.
- */
- public void saveCompilationUnits(IProgressMonitor monitor) {
- getWorkingCopyManager().saveCompilationUnits(monitor);
- }
-
- public WorkingCopyManager getWorkingCopyManager() {
- if (workingCopyManager == null)
- workingCopyManager = WorkingCopyManagerFactory.newRegisteredInstance();
- return workingCopyManager;
- }
-
- /**
- * Reset the working copy manager because the ejb-jar.xml was removed without disposing.
- */
- protected void resetWorkingCopyManager() {
- if (workingCopyManager != null) {
- workingCopyManager.dispose();
- workingCopyManager = null;
- }
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaArtifactEditModelFactory.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaArtifactEditModelFactory.java
deleted file mode 100644
index 355a5325c..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaArtifactEditModelFactory.java
+++ /dev/null
@@ -1,71 +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.common.jdt.internal.integration;
-
-import java.util.Map;
-
-import org.eclipse.emf.common.util.URI;
-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;
-
-/**
- * <p>
- * The following class is experimental until fully documented.
- * </p>
- */
-public class JavaArtifactEditModelFactory extends EditModelFactory {
-
- public static final String MODULE_EDIT_MODEL_ID = "org.eclipse.jst.modulecore.editModel"; //$NON-NLS-1$
-
- public static final String PARAM_MODULE_URI = "MODULE_URI"; //$NON-NLS-1$
-
- public static final String PARAM_ROOT_URI = "ROOT_URI"; //$NON-NLS-1$
-
- public static final String PARAM_ROOT_CONTENT_TYPE = "ROOT_CONTENT_TYPE"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#createEditModelForRead(java.lang.String, org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext, java.util.Map)
- */
- public EditModel createEditModelForRead(String editModelID, EMFWorkbenchContext context, Map params) {
- URI moduleURI = (URI) ((params != null) ? params.get(PARAM_MODULE_URI) : null);
- URI rootURI = (URI) ((params != null) ? params.get(PARAM_ROOT_URI) : null);
- String rootContentType = (String) ((params != null) ? params.get(PARAM_ROOT_CONTENT_TYPE) : null);
- if(moduleURI == null)
- throw new IllegalStateException("A Module URI must be provided"); //$NON-NLS-1$
-
- return new JavaArtifactEditModel(editModelID, context, true, moduleURI,rootURI,rootContentType);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#createEditModelForWrite(java.lang.String, org.eclipse.wst.common.internal.emfworkbench.EMFWorkbenchContext, java.util.Map)
- */
- public EditModel createEditModelForWrite(String editModelID, EMFWorkbenchContext context, Map params) {
- URI moduleURI = (URI) ((params != null) ? params.get(PARAM_MODULE_URI) : null);
- URI rootURI = (URI) ((params != null) ? params.get(PARAM_ROOT_URI) : null);
- String rootContentType = (String) ((params != null) ? params.get(PARAM_ROOT_CONTENT_TYPE) : null);
- if(moduleURI == null)
- throw new IllegalStateException("A Module URI must be provided"); //$NON-NLS-1$
- return new JavaArtifactEditModel(editModelID, context, false,false, moduleURI,rootURI,rootContentType);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelFactory#getCacheID(java.lang.String, java.util.Map)
- */
- public String getCacheID(String editModelID, Map params) {
- URI moduleURI = (URI)params.get(PARAM_MODULE_URI);
- if(moduleURI != null)
- return editModelID+":"+moduleURI.toString(); //$NON-NLS-1$
- return editModelID+":NOURI"; //$NON-NLS-1$
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaProjectValidationHandler.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaProjectValidationHandler.java
deleted file mode 100644
index ece991275..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/JavaProjectValidationHandler.java
+++ /dev/null
@@ -1,56 +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.common.jdt.internal.integration;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.wst.validation.internal.IValidationSelectionHandler;
-
-
-/**
- * Java Project validation
- */
-public class JavaProjectValidationHandler implements IValidationSelectionHandler {
-
- private String validationType = null;
-
- /**
- * Default constructor
- */
- public JavaProjectValidationHandler() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.frameworks.internal.IValidationSelectionHandler#getBaseValidationType(java.lang.Object)
- */
- public IResource getBaseValidationType(Object selection) {
- if (selection instanceof IJavaProject)
- return ((IJavaProject)selection).getProject();
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.frameworks.internal.IValidationSelectionHandler#getValidationTypeString()
- */
- public String getValidationTypeString() {
- return validationType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.frameworks.internal.IValidationSelectionHandler#setValidationTypeString(java.lang.String)
- */
- public void setValidationTypeString(String validationType) {
- this.validationType = validationType;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WTPWorkingCopyManager.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WTPWorkingCopyManager.java
deleted file mode 100644
index dd1e4e2ef..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WTPWorkingCopyManager.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.common.jdt.internal.integration;
-
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.ISaveHandler;
-import org.eclipse.wst.common.frameworks.internal.SaveFailedException;
-import org.eclipse.wst.common.frameworks.internal.SaveHandlerHeadless;
-import org.eclipse.wst.common.frameworks.internal.SaveHandlerRegister;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * Insert the type's description here. Creation date: (4/27/2001 4:14:30 PM)
- *
- * @author: Administrator
- */
-public class WTPWorkingCopyManager implements WorkingCopyManager {
-
- //New CUs that will need to be deleted upon dispose
- private List originalNewCompilationUnits;
- //New CUs that were created that need saved immediately (after each gen)
- private List needsSavingCompilationUnits;
- //A complete list of new CUs that is only cleared on save and dispose
- private List newCompilationUnits;
- private HashMap deletedCompilationUnits;
- protected static final Class IRESOURCE_CLASS = IResource.class;
-
- /**
- * WTPWorkingCopyManager constructor comment.
- */
- public WTPWorkingCopyManager() {
- super();
- }
-
- protected void addDeletedCompilationUnit(ICompilationUnit cu) {
- getNeedsSavingCompilationUnits().remove(cu);
- if (!getOriginalNewCompilationUnits().contains(cu) && !getDeletedCompilationUnits().containsKey(cu))
- primAddDeletedCompilationUnit(cu);
- getOriginalNewCompilationUnits().remove(cu);
- }
-
- protected void addNewCompilationUnit(ICompilationUnit cu, ICompilationUnit workingCopy) {
- getNewCompilationUnits().add(cu);
- getNeedsSavingCompilationUnits().add(workingCopy);
- if (!getDeletedCompilationUnits().containsKey(cu))
- getOriginalNewCompilationUnits().add(cu);
- }
-
- /**
- * This will save all of the new CompilationUnits to be saved.
- */
- protected void commitWorkingCopy(ICompilationUnit wc, IProgressMonitor monitor) {
- try {
- try {
- wc.commitWorkingCopy(false, monitor);
- } catch (JavaModelException e) {
- if (isFailedWriteFileFailure(e) && shouldSaveReadOnly(wc))
- wc.commitWorkingCopy(false, monitor);
- else
- throw e;
- }
- } catch (JavaModelException e) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(e);
- throw new SaveFailedException(e);
- } finally {
- try {
- wc.discardWorkingCopy();
- } catch (JavaModelException e1) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(e1);
- throw new SaveFailedException(e1);
- }
- }
- }
-
- /**
- * This will delete
- *
- * @cu from the workbench and fix the internal references for this working copy manager.
- */
- public void delete(ICompilationUnit cu, IProgressMonitor monitor) {
- if (cu.isWorkingCopy())
- cu = cu.getPrimary();
- addDeletedCompilationUnit(cu);
- try {
- cu.delete(false, monitor);
- } catch (JavaModelException e) {
- if (e.getStatus().getCode() != org.eclipse.jdt.core.IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST)
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(e);
- }
- }
-
- protected void discardOriginalNewCompilationUnits() {
- if (getOriginalNewCompilationUnits().isEmpty())
- return;
- List cus = getOriginalNewCompilationUnits();
- ICompilationUnit cu;
- ICompilationUnit wc = null;
- for (int i = 0; i < cus.size(); i++) {
- cu = (ICompilationUnit) cus.get(i);
- if (cu.isWorkingCopy()) {
- wc = cu;
- cu = wc.getPrimary();
- }
- primDelete(cu);
- if (wc != null)
- try {
- wc.discardWorkingCopy();
- } catch (JavaModelException e) {
- Logger.getLogger().logError(e);
- }
- }
- }
-
- public void dispose() {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor aMonitor) {
- primDispose();
- }
- };
- try {
- if (!WTPCommonPlugin.getWorkspace().isTreeLocked()) {
- WTPCommonPlugin.getWorkspace().run(runnable,null, IWorkspace.AVOID_UPDATE,null);
- } else {
- runnable.run(null);
- }
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- //runOperation(runnable, null, true);
- }
-
- public void revert() {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor aMonitor) {
- primRevert();
- }
- };
- runOperation(runnable, null, true);
- }
-
- public Set getAffectedFiles() {
- return Collections.EMPTY_SET;
- }
-
- /**
- * Insert the method's description here. Creation date: (7/11/2001 6:43:37 PM)
- *
- * @return java.util.HashMap
- */
- protected HashMap getDeletedCompilationUnits() {
- if (deletedCompilationUnits == null)
- deletedCompilationUnits = new HashMap();
- return deletedCompilationUnits;
- }
-
- /**
- * Returns the working copy remembered for the compilation unit encoded in the given editor
- * input. Does not connect the edit model to the working copy.
- *
- * @param input
- * ICompilationUnit
- * @return the working copy of the compilation unit, or <code>null</code> if the input does
- * not encode an editor input, or if there is no remembered working copy for this
- * compilation unit
- */
- public org.eclipse.jdt.core.ICompilationUnit getExistingWorkingCopy(ICompilationUnit cu) throws CoreException {
- ICompilationUnit newCU = getNewCompilationUnitWorkingCopy(cu);
- if (newCU != null)
- return newCU;
- return null;
- }
-
- /**
- * Insert the method's description here. Creation date: (7/19/2001 11:00:19 AM)
- *
- * @return java.util.List
- */
- protected java.util.List getNeedsSavingCompilationUnits() {
- if (needsSavingCompilationUnits == null)
- needsSavingCompilationUnits = new ArrayList();
- return needsSavingCompilationUnits;
- }
-
- /**
- * Insert the method's description here. Creation date: (4/26/2001 3:49:05 PM)
- *
- * @return java.util.List
- */
- protected java.util.List getNewCompilationUnits() {
- if (newCompilationUnits == null)
- newCompilationUnits = new ArrayList();
- return newCompilationUnits;
- }
-
- /**
- * It is possible that we have already created this CompilationUnit and its working copy. If
- * this is the case, return our new working copy and do not create a new one.
- */
- protected ICompilationUnit getNewCompilationUnitWorkingCopy(ICompilationUnit cu) {
- if (hasNewCompilationUnit(cu)) {
- List list = getNeedsSavingCompilationUnits();
- ICompilationUnit copy;
- for (int i = 0; i < list.size(); i++) {
- copy = (ICompilationUnit) list.get(i);
- if (cu.equals(copy.getPrimary()))
- return copy;
- }
- }
- return null;
- }
-
- /**
- * Insert the method's description here. Creation date: (4/26/2001 3:49:05 PM)
- *
- * @return java.util.List
- */
- protected java.util.List getOriginalNewCompilationUnits() {
- if (originalNewCompilationUnits == null)
- originalNewCompilationUnits = new ArrayList();
- return originalNewCompilationUnits;
- }
-
- /**
- * Return the IPackageFragment for the given ICompilationUnit.
- */
- protected IPackageFragment getPackageFragment(ICompilationUnit cu) {
- if (cu == null)
- return null;
- IJavaElement parent = cu;
- int elementType = cu.getElementType();
- while (parent != null && elementType != IJavaElement.PACKAGE_FRAGMENT) {
- parent = parent.getParent();
- if (parent != null)
- elementType = parent.getElementType();
- else
- elementType = -1;
- }
- return (IPackageFragment) parent;
- }
-
- protected ISaveHandler getSaveHandler() {
- return SaveHandlerRegister.getSaveHandler();
- }
-
- /**
- * Returns the working copy remembered for the compilation unit.
- *
- * @param input
- * ICompilationUnit
- * @return the working copy of the compilation unit, or <code>null</code> if there is no
- * remembered working copy for this compilation unit
- */
- public ICompilationUnit getWorkingCopy(ICompilationUnit cu, boolean forNewCU) throws org.eclipse.core.runtime.CoreException {
- if (cu == null || cu.isWorkingCopy())
- return cu;
- ICompilationUnit newCU = getNewCompilationUnitWorkingCopy(cu);
- if (newCU != null)
- return newCU;
- ICompilationUnit workingCopy = cu.getWorkingCopy(null);
- addNewCompilationUnit(cu, workingCopy);
- return workingCopy;
- }
-
- /**
- * Has a new compilation unit already been created.
- */
- protected boolean hasNewCompilationUnit(ICompilationUnit cu) {
- return getNewCompilationUnits().contains(cu);
- }
-
- protected boolean isFailedWriteFileFailure(Exception ex) {
- return SaveHandlerHeadless.isFailedWriteFileFailure(ex);
- }
-
- protected void primAddDeletedCompilationUnit(ICompilationUnit cu) {
- if (cu == null)
- return;
- Object[] info = new Object[2];
- info[0] = getPackageFragment(cu);
- try {
- info[1] = cu.getSource();
- } catch (JavaModelException e) {
- info[1] = null;
- }
- getDeletedCompilationUnits().put(cu, info);
- }
-
- // This is an internal delete call.
- protected void primDelete(ICompilationUnit cu) {
- try {
- if (cu.exists())
- cu.delete(true, new org.eclipse.core.runtime.NullProgressMonitor());
- } catch (JavaModelException e) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(e);
- //What to do here?
- }
- }
-
- protected void primDispose() {
- discardOriginalNewCompilationUnits();
- reviveDeletedCompilationUnits();
- newCompilationUnits = null;
- needsSavingCompilationUnits = null;
- originalNewCompilationUnits = null;
- deletedCompilationUnits = null;
- }
-
- protected void primRevert() {
- discardOriginalNewCompilationUnits();
- reviveDeletedCompilationUnits();
- newCompilationUnits = null;
- needsSavingCompilationUnits = null;
- originalNewCompilationUnits = null;
- deletedCompilationUnits = null;
- }
-
- /**
- * Returns the working copy remembered for the compilation unit encoded in the given editor
- * input.
- *
- * @param input
- * ICompilationUnit
- * @return the working copy of the compilation unit, or <code>null</code> if the input does
- * not encode an editor input, or if there is no remembered working copy for this
- * compilation unit
- */
- protected ICompilationUnit primGetWorkingCopy(ICompilationUnit cu) throws CoreException {
- return null;
- }
-
- /**
- * This will save all of the referenced CompilationUnits to be saved.
- */
- protected void primSaveCompilationUnits(org.eclipse.core.runtime.IProgressMonitor monitor) {
- saveNewCompilationUnits(monitor);
- getDeletedCompilationUnits().clear();
- }
-
- /**
- * This will save all of the new CompilationUnits to be saved.
- */
- protected void primSaveOnlyNewCompilationUnits(org.eclipse.core.runtime.IProgressMonitor monitor) {
- List cus = getNeedsSavingCompilationUnits();
- ICompilationUnit wc;
- for (int i = 0; i < cus.size(); i++) {
- wc = (ICompilationUnit) cus.get(i);
- commitWorkingCopy(wc, monitor);
- }
- cus.clear();
- }
-
- protected void removeDeletedCompilationUnit(ICompilationUnit cu) {
- if (getDeletedCompilationUnits().remove(cu) != null) {
- if (cu.isWorkingCopy()) {
- ICompilationUnit original, nextCU, testCU;
- original = cu.getPrimary();
- Set cus = getDeletedCompilationUnits().keySet();
- Iterator it = cus.iterator();
- while (it.hasNext()) {
- nextCU = (ICompilationUnit) it.next();
- testCU = nextCU.isWorkingCopy() ? (ICompilationUnit) nextCU.getPrimary() : nextCU;
- if (testCU.equals(original)) {
- cus.remove(nextCU);
- return;
- }
- }
- }
- }
- }
-
- protected void reviveDeletedCompilationUnit(ICompilationUnit cu, Object[] info, IProgressMonitor pm) {
- if (info[0] != null && info[1] != null) {
- String typeName = cu.getElementName();
- IPackageFragment pack = (IPackageFragment) info[0];
- String source = (String) info[1];
- try {
- ICompilationUnit existingCU = pack.getCompilationUnit(typeName);
- if (existingCU.exists() && getNewCompilationUnits().contains(existingCU))
- existingCU.delete(false, pm);
- pack.createCompilationUnit(typeName, source, false, pm);
- } catch (JavaModelException e) {
- org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(e);
- }
- }
- }
-
- protected void reviveDeletedCompilationUnits() {
- if (getDeletedCompilationUnits().isEmpty())
- return;
- IProgressMonitor pm = new org.eclipse.core.runtime.NullProgressMonitor();
- Iterator it = getDeletedCompilationUnits().entrySet().iterator();
- Map.Entry entry;
- ICompilationUnit cu;
- Object[] info;
- while (it.hasNext()) {
- entry = (Map.Entry) it.next();
- cu = (ICompilationUnit) entry.getKey();
- info = (Object[]) entry.getValue();
- reviveDeletedCompilationUnit(cu, info, pm);
- }
-
- }
-
- protected void runOperation(IWorkspaceRunnable aRunnable, IProgressMonitor monitor, boolean validate) {
- primRunOperation(aRunnable, monitor);
-
- // TODO Break the validator depedency
- // if (validate)
- // primRunOperation(aRunnable, monitor);
- // else {
- // IProject proj = getValidationProject();
- //
- // ValidatorManager mgr = ValidatorManager.getManager();
- // boolean disableValidators = proj != null;
- // boolean wasSuspended = false;
- // if (disableValidators) {
- // wasSuspended = mgr.isSuspended(proj);
- // if (!wasSuspended)
- // mgr.suspendValidation(proj, true);
- // }
- // try {
- // primRunOperation(aRunnable, monitor);
- // } finally {
- // if (disableValidators && !wasSuspended)
- // mgr.suspendValidation(proj, false);
- // }
- // }
- }
-
- protected void primRunOperation(IWorkspaceRunnable aRunnable, IProgressMonitor monitor) {
-
- if (aRunnable != null) {
- //if (workspace.isTreeLocked())
- //Logger.getLogger().logTrace(ResourceHandler.getString("Cannot_run_J2EEUIWorkingCo_ERROR_"));
- // //$NON-NLS-1$ = "Cannot run J2EEUIWorkingCopyManager operation because the Workspace
- // tree is locked."
- //else {
- if (!WTPCommonPlugin.getWorkspace().isTreeLocked()) {
- try {
- WTPCommonPlugin.getWorkspace().run(aRunnable, monitor);
- } catch (CoreException e) {
- throw new SaveFailedException(e);
- }
- }
- }
- }
-
- /**
- * This will save all of the referenced CompilationUnits to be saved.
- */
- public void saveCompilationUnits(org.eclipse.core.runtime.IProgressMonitor monitor) {
- getSaveHandler().access();
- try {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor aMonitor) {
- primSaveCompilationUnits(aMonitor);
- }
- };
- runOperation(runnable, monitor, true);
- } catch (SaveFailedException ex) {
- getSaveHandler().handleSaveFailed(ex, monitor);
- } finally {
- getSaveHandler().release();
- }
- }
-
- /**
- * This will save all of the referenced CompilationUnits to be saved.
- */
- protected void saveNewCompilationUnits(IProgressMonitor monitor) {
- primSaveOnlyNewCompilationUnits(monitor);
- getOriginalNewCompilationUnits().clear();
- getNewCompilationUnits().clear();
- }
-
- /**
- * This will save all of the new CompilationUnits to be saved.
- */
- public void saveOnlyNewCompilationUnits(org.eclipse.core.runtime.IProgressMonitor monitor) {
- getSaveHandler().access();
- try {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor aMonitor) {
- primSaveOnlyNewCompilationUnits(aMonitor);
- }
- };
- runOperation(runnable, monitor, false);
- } catch (SaveFailedException ex) {
- getSaveHandler().handleSaveFailed(ex, monitor);
- } finally {
- getSaveHandler().release();
- }
- }
-
- protected boolean shouldSaveReadOnly(ICompilationUnit wc) {
- IResource resource = null;
-
- resource = (IResource) wc.getPrimary().getAdapter(IRESOURCE_CLASS);
-
- if (resource == null || resource.getType() != IResource.FILE || !resource.getResourceAttributes().isReadOnly())
- return false;
-
- return getSaveHandler().shouldContinueAndMakeFileEditable((IFile) resource);
- }
-
- /**
- * @see com.ibm.etools.j2ee.workbench.IJ2EEWorkingCopyManager#hasWorkingCopies()
- */
- public boolean hasWorkingCopies() {
- return (deletedCompilationUnits != null && !deletedCompilationUnits.isEmpty()) || (needsSavingCompilationUnits != null && !needsSavingCompilationUnits.isEmpty()) || (newCompilationUnits != null && !newCompilationUnits.isEmpty());
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyManager.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyManager.java
deleted file mode 100644
index 35ccc89fb..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyManager.java
+++ /dev/null
@@ -1,49 +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.common.jdt.internal.integration;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-
-/**
- * @author Administrator
- *
- *
- */
-public interface WorkingCopyManager extends WorkingCopyProvider {
-
- void dispose();
-
- java.util.Set getAffectedFiles();
-
- /**
- * This will save all of the referenced CompilationUnits to be saved.
- */
- void saveCompilationUnits(IProgressMonitor monitor);
-
- /**
- * This will save all of the new CompilationUnits to be saved.
- */
- void saveOnlyNewCompilationUnits(IProgressMonitor monitor);
-
- /**
- * Method hasWorkingCopies.
- *
- * @return boolean
- */
- boolean hasWorkingCopies();
-
- /**
- * Revert all working copies.
- */
- void revert();
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyManagerFactory.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyManagerFactory.java
deleted file mode 100644
index 9153f9e99..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyManagerFactory.java
+++ /dev/null
@@ -1,57 +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.common.jdt.internal.integration;
-
-import org.eclipse.jem.util.UIContextDetermination;
-
-
-/**
- * @author mdelder
- *
- *
- */
-public class WorkingCopyManagerFactory {
-
- // protected static Class workingCopyManagerClass;
-
- public static WorkingCopyManager newRegisteredInstance() {
- return (WorkingCopyManager) UIContextDetermination.createInstance("workingCopyManager"); //$NON-NLS-1$
- }
-
- // public static IWorkingCopyManager createWorkingCopyManager() {
- // if (getWorkingCopyManagerClass() != null)
- // try {
- // return (IWorkingCopyManager) getWorkingCopyManagerClass().newInstance();
- // } catch (InstantiationException e1) {
- // } catch (IllegalAccessException e2) {
- // }
- // return null;
- // }
- //
- // /**
- // * Insert the method's description here.
- // * Creation date: (4/26/2001 7:53:15 AM)
- // * @return java.lang.Class
- // */
- // public static java.lang.Class getWorkingCopyManagerClass() {
- // return workingCopyManagerClass;
- // }
- //
- // /**
- // * Insert the method's description here.
- // * Creation date: (4/26/2001 7:53:15 AM)
- // * @param newWorkingCopyManagerClass java.lang.Class
- // */
- // public static void setWorkingCopyManagerClass(java.lang.Class newWorkingCopyManagerClass) {
- // workingCopyManagerClass = newWorkingCopyManagerClass;
- // }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyProvider.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyProvider.java
deleted file mode 100644
index 2696f5c54..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/integration/WorkingCopyProvider.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.common.jdt.internal.integration;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-
-
-/**
- * The user of the Java code generation framework must supply an implementation of this interface.
- * The framework will obtain compilation working copies from this interface. The supplier of the
- * implementation is responsible for committing the working copies when appropriate for the user's
- * edit model.
- */
-public interface WorkingCopyProvider {
-
- /**
- * This will delete compilation unit from the workbench and fix the internal references for this
- * working copy manager.
- *
- * @param cu
- * the compilation unit to delete
- * @param monitor
- * the progress monitor to use for the delete
- */
- void delete(ICompilationUnit cu, IProgressMonitor monitor);
-
- /**
- * Returns the working copy remembered for the compilation unit. That is, the manager already
- * has a working copy for this unit, it does not create a new working copy. Does not connect the
- * edit model to the working copy.
- *
- * @param input
- * the compilation unit
- * @return the working copy of the compilation unit, or <code>null</code> it there is no
- * remembered working copy for this compilation unit
- */
- ICompilationUnit getExistingWorkingCopy(ICompilationUnit cu) throws CoreException;
-
- /**
- * Returns the working copy remembered for the compilation unit or creates a new working copy
- * for the compilation unit and returns it. If a working copy is passed in, it is returned.
- *
- * @param input
- * the compilation unit
- * @return the working copy of the compilation unit
- * @exception CoreException
- * if the working copy can not be created
- */
- ICompilationUnit getWorkingCopy(ICompilationUnit cu, boolean forNewCU) throws CoreException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/IJavaFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/IJavaFacetInstallDataModelProperties.java
deleted file mode 100644
index e340b1ed1..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/IJavaFacetInstallDataModelProperties.java
+++ /dev/null
@@ -1,20 +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.common.project.facet;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
-
-public interface IJavaFacetInstallDataModelProperties extends IDataModelProperties {
-
- public static final String SOURCE_FOLDER_NAME = "IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME"; //$NON-NLS-1$
- public static final String DEFAULT_OUTPUT_FOLDER_NAME = "IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME"; //$NON-NLS-1$
- public static final String JAVA_FACET_INSTALL_CONFIG = "IJavaFacetInstallDataModelProperties.JAVA_FACET_INSTALL_CONFIG";
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetInstallDataModelProvider.java
deleted file mode 100644
index bdf592999..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,137 +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.common.project.facet;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.common.project.facet.core.JavaFacetInstallConfig;
-import org.eclipse.jst.common.project.facet.core.JavaFacetInstallConfig.ChangeEvent;
-import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.util.IEventListener;
-
-public class JavaFacetInstallDataModelProvider extends FacetInstallDataModelProvider implements IJavaFacetInstallDataModelProperties {
-
- private final JavaFacetInstallConfig installConfig;
-
- public JavaFacetInstallDataModelProvider()
- {
- this( new JavaFacetInstallConfig() );
- }
-
- public JavaFacetInstallDataModelProvider( final JavaFacetInstallConfig installConfig )
- {
- this.installConfig = installConfig;
- }
-
- public Set getPropertyNames()
- {
- Set propertyNames = super.getPropertyNames();
- propertyNames.add(JAVA_FACET_INSTALL_CONFIG);
- propertyNames.add(SOURCE_FOLDER_NAME);
- propertyNames.add(DEFAULT_OUTPUT_FOLDER_NAME);
- return propertyNames;
- }
-
- @Override
- public void init()
- {
- super.init();
-
- final IDataModel dm = getDataModel();
-
- dm.setProperty( FACET_ID, IModuleConstants.JST_JAVA );
- dm.setProperty( JAVA_FACET_INSTALL_CONFIG, this.installConfig );
-
- String sourceFolderName = null;
-
- if( ! this.installConfig.getSourceFolders().isEmpty() )
- {
- sourceFolderName = this.installConfig.getSourceFolders().get( 0 ).toPortableString();
- }
-
- dm.setProperty( SOURCE_FOLDER_NAME, sourceFolderName );
-
- String defaultOutputFolderName = null;
-
- if( this.installConfig.getDefaultOutputFolder() != null )
- {
- defaultOutputFolderName = this.installConfig.getDefaultOutputFolder().toPortableString();
- }
-
- dm.setProperty( DEFAULT_OUTPUT_FOLDER_NAME, defaultOutputFolderName );
-
- final IEventListener<JavaFacetInstallConfig.ChangeEvent> listener
- = new IEventListener<JavaFacetInstallConfig.ChangeEvent>()
- {
- public void handleEvent( final ChangeEvent event )
- {
- if( event.getType() == JavaFacetInstallConfig.ChangeEvent.Type.SOURCE_FOLDERS_CHANGED )
- {
- String val = null;
-
- if( installConfig.getSourceFolders().size() > 0 )
- {
- val = installConfig.getSourceFolders().get( 0 ).toPortableString();
- }
-
- dm.setProperty( SOURCE_FOLDER_NAME, val );
- }
- else if( event.getType() == JavaFacetInstallConfig.ChangeEvent.Type.DEFAULT_OUTPUT_FOLDER_CHANGED )
- {
- final String val = installConfig.getDefaultOutputFolder().toPortableString();
- dm.setProperty( DEFAULT_OUTPUT_FOLDER_NAME, val );
- }
- }
- };
-
- this.installConfig.addListener( listener );
- }
-
- public boolean propertySet( final String propertyName,
- final Object propertyValue )
- {
- if( propertyName.equals( SOURCE_FOLDER_NAME ) )
- {
- final List<IPath> sourceFolders;
-
- if( propertyValue == null )
- {
- sourceFolders = Collections.emptyList();
- }
- else
- {
- sourceFolders = Collections.<IPath>singletonList( new Path( (String) propertyValue ) );
- }
-
- this.installConfig.setSourceFolders( sourceFolders );
-
- return true;
- }
- else if( propertyName.equals( DEFAULT_OUTPUT_FOLDER_NAME ) )
- {
- this.installConfig.setDefaultOutputFolder( new Path( (String) propertyValue ) );
- return true;
- }
- else if( propertyName.equals( JAVA_FACET_INSTALL_CONFIG ) )
- {
- return false;
- }
-
- return super.propertySet( propertyName, propertyValue );
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetUtils.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetUtils.java
deleted file mode 100644
index a0f649dfa..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetUtils.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005, 2006 BEA Systems, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.common.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jst.common.project.facet.core.JavaFacet;
-import org.eclipse.jst.common.project.facet.core.internal.JavaFacetUtil;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class JavaFacetUtils
-{
- public static final IProjectFacet JAVA_FACET = JavaFacet.FACET;
- public static final IProjectFacetVersion JAVA_13 = JavaFacet.JAVA_13;
- public static final IProjectFacetVersion JAVA_14 = JavaFacet.JAVA_14;
- public static final IProjectFacetVersion JAVA_50 = JavaFacet.JAVA_50;
- public static final IProjectFacetVersion JAVA_60 = JavaFacet.JAVA_60;
-
- public static String getCompilerLevel()
- {
- return JavaFacetUtil.getCompilerLevel();
- }
-
- public static String getCompilerLevel( final IProject project )
- {
- return JavaFacetUtil.getCompilerLevel( project );
- }
-
- public static void setCompilerLevel( final IProject project,
- final IProjectFacetVersion fv )
-
- throws CoreException
-
- {
- JavaFacetUtil.setCompilerLevel( project, fv );
- }
-
- public static void setCompilerLevel( final IProject project,
- final String level )
-
- throws CoreException
-
- {
- JavaFacetUtil.setCompilerLevel( project, level );
- }
-
- public static void scheduleFullBuild( final IProject project )
- {
- JavaFacetUtil.scheduleFullBuild( project );
- }
-
- public static void resetClasspath( final IProject project,
- final IProjectFacetVersion oldver,
- final IProjectFacetVersion newver )
-
- throws CoreException
-
- {
- JavaFacetUtil.resetClasspath( project, oldver, newver );
- }
-
- public static IProjectFacetVersion compilerLevelToFacet( final String ver )
- {
- return JavaFacetUtil.compilerLevelToFacet( ver );
- }
-
- public static String facetToCompilerLevel( final IProjectFacetVersion fv )
- {
- return JavaFacetUtil.facetToCompilerLevel( fv );
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaProjectFacetCreationDataModelProvider.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaProjectFacetCreationDataModelProvider.java
deleted file mode 100644
index cef5b2d24..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaProjectFacetCreationDataModelProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.common.project.facet;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
-
-public class JavaProjectFacetCreationDataModelProvider extends FacetProjectCreationDataModelProvider {
-
- public JavaProjectFacetCreationDataModelProvider() {
- super();
- }
-
- public void init() {
- super.init();
-
- Collection requiredFacets = new ArrayList();
- requiredFacets.add(JavaFacetUtils.JAVA_FACET);
- setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/WtpUtils.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/WtpUtils.java
deleted file mode 100644
index b82d7d2dd..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/WtpUtils.java
+++ /dev/null
@@ -1,69 +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.common.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class WtpUtils
-{
- private WtpUtils() {}
-
- private static final String WTP_NATURE
- = "org.eclipse.wst.common.modulecore.ModuleCoreNature"; //$NON-NLS-1$
-
- private static final String JEM_NATURE
- = "org.eclipse.jem.workbench.JavaEMFNature"; //$NON-NLS-1$
-
- private static final String[] NATURES = {WTP_NATURE, JEM_NATURE};
-
- public static void addNatures( final IProject project )
-
- throws CoreException
-
- {
- for (int i = 0; i < NATURES.length; i++) {
- if (!project.hasNature(NATURES[i])) {
- ProjectUtilities.addNatureToProject(project, NATURES[i]);
- }
- }
- }
-
- public static void addNaturestoEAR( final IProject project )
-
- throws CoreException
-
- {
- final IProjectDescription desc = project.getDescription();
- final String[] current = desc.getNatureIds();
- final String[] replacement = new String[ current.length + 1 ];
- System.arraycopy( current, 0, replacement, 0, current.length );
- replacement[ current.length ] = WTP_NATURE;
- desc.setNatureIds( replacement );
- project.setDescription( desc, null );
- }
-
- public static void removeNatures( final IProject project )
-
- throws CoreException
-
- {
- ProjectUtilities.removeNatureFromProject( project, WTP_NATURE );
- ProjectUtilities.removeNatureFromProject( project, JEM_NATURE );
- }
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/internal/DataModelToJavaFacetInstallConfigAdapter.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/internal/DataModelToJavaFacetInstallConfigAdapter.java
deleted file mode 100644
index e402d887d..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/internal/DataModelToJavaFacetInstallConfigAdapter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2008 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
- ******************************************************************************/
-
-package org.eclipse.jst.common.project.facet.internal;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
-import org.eclipse.jst.common.project.facet.core.JavaFacetInstallConfig;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class DataModelToJavaFacetInstallConfigAdapter
-
- implements IAdapterFactory
-
-{
- private static final Class[] ADAPTER_TYPES = { JavaFacetInstallConfig.class };
-
- public Object getAdapter( final Object adaptable,
- final Class adapterType )
- {
- if( adapterType == JavaFacetInstallConfig.class )
- {
- final IDataModel dm = (IDataModel) adaptable;
-
- return (JavaFacetInstallConfig) dm.getProperty( IJavaFacetInstallDataModelProperties.JAVA_FACET_INSTALL_CONFIG );
- }
-
- return null;
- }
-
- public Class[] getAdapterList()
- {
- return ADAPTER_TYPES;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/internal/JavaFacetInstallConfigToDataModelAdapter.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/internal/JavaFacetInstallConfigToDataModelAdapter.java
deleted file mode 100644
index f42c4c5c5..000000000
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/internal/JavaFacetInstallConfigToDataModelAdapter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2008 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
- ******************************************************************************/
-
-package org.eclipse.jst.common.project.facet.internal;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
-import org.eclipse.jst.common.project.facet.core.JavaFacetInstallConfig;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public final class JavaFacetInstallConfigToDataModelAdapter
-
- implements IAdapterFactory
-
-{
- private static final Class[] ADAPTER_TYPES = { IDataModel.class };
-
- public Object getAdapter( final Object adaptable,
- final Class adapterType )
- {
- if( adapterType == IDataModel.class )
- {
- final JavaFacetInstallDataModelProvider provider
- = new JavaFacetInstallDataModelProvider( (JavaFacetInstallConfig) adaptable );
-
- return DataModelFactory.createDataModel( provider );
- }
-
- return null;
- }
-
- public Class[] getAdapterList()
- {
- return ADAPTER_TYPES;
- }
-
-}

Back to the top