Skip to main content

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

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkkomissarchik2006-05-16 18:33:29 +0000
committerkkomissarchik2006-05-16 18:33:29 +0000
commit7a58b796e53662002d6687b4b179adaaabf55f3b (patch)
tree208a74d54b966dc1269bc037fb72fb6855049d68
parent3ba96940130f450178a6c14253705df377ef0644 (diff)
downloadwebtools.common.fproj-7a58b796e53662002d6687b4b179adaaabf55f3b.tar.gz
webtools.common.fproj-7a58b796e53662002d6687b4b179adaaabf55f3b.tar.xz
webtools.common.fproj-7a58b796e53662002d6687b4b179adaaabf55f3b.zip
[123477] Handle projects with undefined facets gracefully
[141774] Changing Java facet from 1.4 to 5.0 causes duplicate Ja...
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacet.java6
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacetVersion.java10
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.java27
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.properties2
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/CopyOnWriteSet.java17
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProject.java98
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacet.java15
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetVersion.java9
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.java2
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/BridgedRuntime.java5
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/Runtime.java5
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/RuntimeComponentType.java15
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/whatsnew.txt87
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/images/warning.gifbin0 -> 324 bytes
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java2
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java151
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties4
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java6
18 files changed, 312 insertions, 149 deletions
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacet.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacet.java
index f7f4ffe..72f738d 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacet.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacet.java
@@ -46,9 +46,11 @@ public interface IProjectFacet
String getId();
/**
- * Returns the id of the plugin that defines this project facet.
+ * Returns the id of the plugin that defines this project facet. This method
+ * will return <code>null</code> if this facet is not defined.
*
- * @return the id of the plugin that defines this project facet
+ * @return the id of the plugin that defines this project facet, or
+ * <code>null</code>
*/
String getPluginId();
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacetVersion.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacetVersion.java
index 517e8a4..6ffb75b 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacetVersion.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IProjectFacetVersion.java
@@ -48,6 +48,16 @@ public interface IProjectFacetVersion
String getVersionString();
/**
+ * Returns the id of the plugin that defines this project facet version.
+ * This method will return <code>null</code> if this version is not defined.
+ *
+ * @return the id of the plugin that defines this project facet version, or
+ * <code>null</code>
+ */
+
+ String getPluginId();
+
+ /**
* Returns the constraint that has to be satisfied prior to installing this
* project facet.
*
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.java
index b79dc0d..5010337 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.java
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectValidator;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.eclipse.wst.common.project.facet.core.runtime.internal.UnknownRuntime;
@@ -74,6 +75,30 @@ public final class BasicFacetedProjectValidator
}
}
}
+
+ // Does the project contain any unknown facets or versions?
+
+ for( Iterator itr = fproj.getProjectFacets().iterator(); itr.hasNext(); )
+ {
+ final IProjectFacetVersion fv = (IProjectFacetVersion) itr.next();
+ final IProjectFacet f = fv.getProjectFacet();
+
+ if( f.getPluginId() == null )
+ {
+ final String msg
+ = NLS.bind( Resources.facetNotFound, f.getId() );
+
+ fproj.createWarningMarker( msg );
+ }
+ else if( fv.getPluginId() == null )
+ {
+ final String msg
+ = NLS.bind( Resources.facetVersionNotFound, f.getId(),
+ fv.getVersionString() );
+
+ fproj.createWarningMarker( msg );
+ }
+ }
}
private static final class Resources
@@ -83,6 +108,8 @@ public final class BasicFacetedProjectValidator
{
public static String runtimeNotDefined;
public static String facetNotSupported;
+ public static String facetNotFound;
+ public static String facetVersionNotFound;
static
{
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.properties b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.properties
index ab2461c..c6511af 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.properties
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/BasicFacetedProjectValidator.properties
@@ -1,2 +1,4 @@
runtimeNotDefined = Target runtime {0} is not defined.
facetNotSupported = Project facet {0} is not supported by target runtime {1}.
+facetNotFound = Implementation of project facet {0} could not be found. Functionality will be limited.
+facetVersionNotFound = Implementation of version {1} of project facet {0} could not be found. Functionality will be limited.
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/CopyOnWriteSet.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/CopyOnWriteSet.java
index 6ef359d..ca26fc4 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/CopyOnWriteSet.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/CopyOnWriteSet.java
@@ -99,12 +99,17 @@ public final class CopyOnWriteSet
return this.baseReadOnly;
}
- private void copy()
+ private boolean copy()
{
if( this.baseReadOnly != null )
{
this.base = new HashSet( this.base );
this.baseReadOnly = null;
+ return true;
+ }
+ else
+ {
+ return false;
}
}
@@ -124,8 +129,14 @@ public final class CopyOnWriteSet
public void remove()
{
- copy();
- this.itr.remove();
+ if( copy() )
+ {
+ CopyOnWriteSet.this.base.remove( this.current );
+ }
+ else
+ {
+ this.itr.remove();
+ }
}
public boolean hasNext()
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProject.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProject.java
index c162d2f..38a0bed 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProject.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProject.java
@@ -22,9 +22,11 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
@@ -117,6 +119,7 @@ public final class FacetedProject
private final IProject project;
private final CopyOnWriteSet facets;
private final CopyOnWriteSet fixed;
+ private final Map unknownFacets = new HashMap();
private final CopyOnWriteSet targetedRuntimes;
private String primaryRuntime;
IFile f;
@@ -446,7 +449,11 @@ public final class FacetedProject
throws CoreException
{
- setTargetedRuntimes( Collections.singleton( runtime ), monitor );
+ final Set runtimes
+ = runtime == null
+ ? Collections.EMPTY_SET : Collections.singleton( runtime );
+
+ setTargetedRuntimes( runtimes, monitor );
}
public Set getTargetedRuntimes()
@@ -1387,6 +1394,7 @@ public final class FacetedProject
this.facets.clear();
this.fixed.clear();
+ this.unknownFacets.clear();
this.targetedRuntimes.clear();
this.primaryRuntime = null;
@@ -1418,19 +1426,16 @@ public final class FacetedProject
else if( name.equals( EL_FIXED ) )
{
final String id = e.getAttribute( ATTR_FACET );
+ final IProjectFacet f;
- if( ! ProjectFacetsManager.isProjectFacetDefined( id ) )
+ if( ProjectFacetsManager.isProjectFacetDefined( id ) )
{
- final String msg
- = NLS.bind( Resources.facetNotDefined, id );
-
- final IStatus st = FacetCorePlugin.createErrorStatus( msg );
-
- throw new CoreException( st );
+ f = ProjectFacetsManager.getProjectFacet( id );
+ }
+ else
+ {
+ f = createUnknownFacet( id );
}
-
- final IProjectFacet f
- = ProjectFacetsManager.getProjectFacet( id );
this.fixed.add( f );
}
@@ -1439,38 +1444,69 @@ public final class FacetedProject
final String id = e.getAttribute( ATTR_FACET );
final String version = e.getAttribute( ATTR_VERSION );
- if( ! ProjectFacetsManager.isProjectFacetDefined( id ) )
+ final IProjectFacet f;
+
+ if( ProjectFacetsManager.isProjectFacetDefined( id ) )
{
- final String msg
- = NLS.bind( Resources.facetNotDefined, id );
-
- final IStatus st = FacetCorePlugin.createErrorStatus( msg );
-
- throw new CoreException( st );
+ f = ProjectFacetsManager.getProjectFacet( id );
}
-
- final IProjectFacet f
- = ProjectFacetsManager.getProjectFacet( id );
-
- if( ! f.hasVersion( version ) )
+ else
{
- final String msg
- = NLS.bind( Resources.facetVersionNotDefined, id,
- version );
-
- final IStatus st = FacetCorePlugin.createErrorStatus( msg );
-
- throw new CoreException( st );
+ f = createUnknownFacet( id );
}
- final IProjectFacetVersion fv = f.getVersion( version );
+ final IProjectFacetVersion fv;
+ if( f.hasVersion( version ) )
+ {
+ fv = f.getVersion( version );
+ }
+ else
+ {
+ fv = createUnknownFacetVersion( f, version );
+ }
+
this.facets.add( fv );
}
}
}
}
+ private ProjectFacet createUnknownFacet( final String id )
+ {
+ ProjectFacet f = (ProjectFacet) this.unknownFacets.get( id );
+
+ if( f == null )
+ {
+ f = new ProjectFacet();
+ f.setId( id );
+ f.setLabel( id );
+
+ this.unknownFacets.put( id, f );
+ }
+
+ return f;
+ }
+
+ private ProjectFacetVersion createUnknownFacetVersion( final IProjectFacet f,
+ final String version )
+ {
+ final ProjectFacetVersion fv;
+
+ if( f.hasVersion( version ) )
+ {
+ fv = (ProjectFacetVersion) f.getVersion( version );
+ }
+ else
+ {
+ fv = new ProjectFacetVersion();
+ fv.setProjectFacet( (ProjectFacet) f );
+ fv.setVersionString( version );
+ }
+
+ return fv;
+ }
+
private static Element parse( final File f )
{
final DocumentBuilder docbuilder;
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacet.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacet.java
index 6c819a5..61bd15a 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacet.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacet.java
@@ -133,10 +133,17 @@ public final class ProjectFacet
throws VersionFormatException, CoreException
{
- final Comparator comp = getVersionComparator( true, VERSION_ADAPTER );
- final Object max = Collections.max( this.versions, comp );
-
- return (IProjectFacetVersion) max;
+ if( this.versions.size() > 0 )
+ {
+ final Comparator comp = getVersionComparator( true, VERSION_ADAPTER );
+ final Object max = Collections.max( this.versions, comp );
+
+ return (IProjectFacetVersion) max;
+ }
+ else
+ {
+ return null;
+ }
}
public IProjectFacetVersion getLatestSupportedVersion( final IRuntime r )
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetVersion.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetVersion.java
index 72617d5..d846f33 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetVersion.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetVersion.java
@@ -90,7 +90,12 @@ public final class ProjectFacetVersion
this.constraint = constraint;
}
- void setPlugin( final String plugin )
+ public String getPluginId()
+ {
+ return this.plugin;
+ }
+
+ void setPluginId( final String plugin )
{
this.plugin = plugin;
}
@@ -192,7 +197,7 @@ public final class ProjectFacetVersion
{
final IProjectFacet f = (IProjectFacet) itr.next();
- if( f.getVersions().contains( this ) )
+ if( this.facet == f )
{
return true;
}
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.java
index 92c64fe..bd350b9 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.java
@@ -1252,7 +1252,7 @@ public final class ProjectFacetsManagerImpl
fv.setProjectFacet( f );
fv.setVersionString( ver );
- fv.setPlugin( config.getContributor().getName() );
+ fv.setPluginId( config.getContributor().getName() );
final IConfigurationElement[] children = config.getChildren();
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/BridgedRuntime.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/BridgedRuntime.java
index 18c91ab..5f23475 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/BridgedRuntime.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/BridgedRuntime.java
@@ -65,6 +65,11 @@ public final class BridgedRuntime
public synchronized boolean supports( final IProjectFacetVersion fv )
{
+ if( fv.getPluginId() == null )
+ {
+ return true;
+ }
+
final List comp = this.stub.getRuntimeComponents();
if( this.supported == null || ! this.composition.equals( comp ) )
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/Runtime.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/Runtime.java
index ba4e520..952362b 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/Runtime.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/Runtime.java
@@ -71,6 +71,11 @@ public final class Runtime
public synchronized boolean supports( final IProjectFacetVersion fv )
{
+ if( fv.getPluginId() == null )
+ {
+ return true;
+ }
+
if( this.supported == null )
{
this.supported = RuntimeManagerImpl.getSupportedFacets( this.components );
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/RuntimeComponentType.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/RuntimeComponentType.java
index 27d74a0..b1d4545 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/RuntimeComponentType.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/runtime/internal/RuntimeComponentType.java
@@ -90,10 +90,17 @@ public final class RuntimeComponentType
throws VersionFormatException, CoreException
{
- final Comparator comp = getVersionComparator( true, VERSION_ADAPTER );
- final Object max = Collections.max( this.versions, comp );
-
- return (IRuntimeComponentVersion) max;
+ if( this.versions.size() > 0 )
+ {
+ final Comparator comp = getVersionComparator( true, VERSION_ADAPTER );
+ final Object max = Collections.max( this.versions, comp );
+
+ return (IRuntimeComponentVersion) max;
+ }
+ else
+ {
+ return null;
+ }
}
public Object getAdapter( final Class type )
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/whatsnew.txt b/plugins/org.eclipse.wst.common.project.facet.core/whatsnew.txt
deleted file mode 100644
index b968286..0000000
--- a/plugins/org.eclipse.wst.common.project.facet.core/whatsnew.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-New API:
-
-org.eclipse.wst.common.project.facet.core:
-
-1. IActionDefinition
-2. IProjectFacetVersion.getActionDefinition( Action.Type type )
-3. ProjectFacetsManager.getActionDefinitions()
-4. ProjectFacetsManager.isActionDefined( String id )
-5. ProjectFacetsManager.getActionDefinition( String id )
-6. ProjectFacetsManager.definePreset( String name, String description, Set facets )
-7. IPreset.getDescription()
-8. IFacetedProject.getTargetedRuntimes()
-9. IFacetedProject.setTargetedRuntimes( Set runtimes, IProgressMonitor monitor )
-10. IFacetedProject.addTargetedRuntime( IRuntime runtime, IProgressMonitor monitor )
-11. IFacetedProject.removeTargetedRuntime( IRuntime runtime, IProgressMonitor monitor )
-12. IFacetedProject.getPrimaryRuntime()
-13. IFacetedProject.setPrimaryRuntime( IRuntime runtime, IProgressMonitor monitor )
-
-org.eclipse.wst.common.project.facet.ui:
-
-1. ProjectFacetsUiManager.getWizardPages( String actionId )
-
-org.eclipse.wst.common.project.facet.core.facets extension point
-
-1. Added <description> element to the preset definition.
-
-Deprecated API:
-
-The following describes API that was deprecated in this release as well as the
-replacement API to use going forward. All of the API deprecated in the 1.5
-release is still fully supported in this release, but it will be removed in the
-next major release of WTP.
-
-1. The extension point schema for defining wizard pages associated with the
- project facet actions has been revised to be more flexible.
-
- Deprecated extension point:
-
- <extension point="org.eclipse.wst.common.project.facet.ui.wizard">
- <wizard-pages facet="...">
- <install> (0 or 1)
- <page class="..."/> (1 or more)
- </install>
- <uninstall> (0 or 1)
- <page class="..."/> (1 or more)
- </uninstall>
- </wizard-pages>
- </extension>
-
- New extension point:
-
- <extension point="org.eclipse.wst.common.project.facet.ui.wizardPages">
- <wizard-pages action="..."> (1 or more)
- <page class="..."/> (1 or more)
- </wizard-pages>
- </extension>
-
- Note the new extension point id. The "action" attribute should contain the
- action that these pages are to be associated with. The action id can
- be explicitly specified via the new "id" attribute available on the "action"
- element of the core facets extension point. If not specified, the default id
- is generated using the "[facet-id]#[version-expression]#[action-type]"
- pattern.
-
- Also, the following method has been deprecated and replaced:
-
- org.eclipse.wst.common.project.facet.ui.ProjectFacetsUiManager:
-
- deprecated: getWizardPages( Action.Type type, IProjectFacetVersion fv )
- new: getWizardPages( String actionId )
-
-2. The ability to for a project to target multiple runtimes has been further
- fleshed out during this release. This meant deprecation of some existing api.
-
- Deprecated API:
-
- IFacetedProject.getRuntime()
- IFacetedProject.setRuntime( IRuntime runtime )
-
- Replacement API:
-
- IFacetedProject.getTargetedRuntimes()
- IFacetedProject.setTargetedRuntimes( Set runtimes, IProgressMonitor monitor )
- IFacetedProject.addTargetedRuntime( IRuntime runtime, IProgressMonitor monitor )
- IFacetedProject.removeTargetedRuntime( IRuntime runtime, IProgressMonitor monitor )
- IFacetedProject.getPrimaryRuntime()
- IFacetedProject.setPrimaryRuntime( IRuntime runtime, IProgressMonitor monitor )
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/images/warning.gif b/plugins/org.eclipse.wst.common.project.facet.ui/images/warning.gif
new file mode 100644
index 0000000..2b2e50f
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.project.facet.ui/images/warning.gif
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java
index 105efc0..c54778c 100644
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java
+++ b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java
@@ -166,6 +166,8 @@ public final class FacetsSelectionPage
{
this.panel.setDefaultFacetsForRuntime( this.initialSetDefaultFacetsForRuntime );
}
+
+ setPageComplete( this.panel.isSelectionValid() );
this.panel.addSelectionChangedListener
(
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java
index 2bbdb90..f6eeaa3 100644
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java
+++ b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -545,7 +546,7 @@ public final class FacetsSelectionPanel
public boolean isSelectionValid()
{
- return this.problems.isOK();
+ return ( this.problems.getSeverity() != IStatus.ERROR );
}
public Set getActions()
@@ -723,19 +724,27 @@ public final class FacetsSelectionPanel
public void setSelectedProjectFacets( final Set sel )
{
+ final List toCheck = new ArrayList();
+ final List needsCategoryRefresh = new ArrayList();
+
for( Iterator itr = sel.iterator(); itr.hasNext(); )
{
final IProjectFacetVersion fv
= (IProjectFacetVersion) itr.next();
final IProjectFacet f = fv.getProjectFacet();
- final TableRowData trd = findTableRowData( f );
+ final TableRowData trd = findTableRowData( f, true );
+ if( fv.getPluginId() == null )
+ {
+ trd.addUnknownVersion( fv );
+ }
+
trd.setSelected( true );
trd.setCurrentVersion( fv );
-
- this.tree.setChecked( trd, true );
- refreshCategoryState( trd );
+
+ toCheck.add( trd );
+ needsCategoryRefresh.add( trd );
}
for( Iterator itr = this.data.iterator(); itr.hasNext(); )
@@ -745,13 +754,19 @@ public final class FacetsSelectionPanel
if( trd.isSelected() && ! sel.contains( trd.getCurrentVersion() ) )
{
trd.setSelected( false );
-
- this.tree.setChecked( trd, false );
- refreshCategoryState( trd );
+ needsCategoryRefresh.add( trd );
}
}
refresh();
+
+ this.tree.setCheckedElements( toCheck.toArray() );
+
+ for( Iterator itr = needsCategoryRefresh.iterator(); itr.hasNext(); )
+ {
+ refreshCategoryState( (TableRowData) itr.next() );
+ }
+
updateValidationDisplay();
}
@@ -803,7 +818,7 @@ public final class FacetsSelectionPanel
for( Iterator itr = fixed.iterator(); itr.hasNext(); )
{
final IProjectFacet f = (IProjectFacet) itr.next();
- final TableRowData trd = findTableRowData( f );
+ final TableRowData trd = findTableRowData( f, true );
this.fixed.add( f );
trd.setFixed( true );
@@ -1086,7 +1101,7 @@ public final class FacetsSelectionPanel
this.actions.removeAll( toremove );
this.actions.addAll( toadd );
- this.problems = ProjectFacetsManager.check( this.base, this.actions );
+ this.problems = calculateProblems();
this.problemsView.refresh();
if( this.problems.isOK() )
@@ -1107,6 +1122,46 @@ public final class FacetsSelectionPanel
notifyProjectFacetsListeners();
}
+ private IStatus calculateProblems()
+ {
+ IStatus st = ProjectFacetsManager.check( this.base, this.actions );
+
+ for( Iterator itr = this.base.iterator(); itr.hasNext(); )
+ {
+ final IProjectFacetVersion fv = (IProjectFacetVersion) itr.next();
+ final IProjectFacet f = fv.getProjectFacet();
+
+ String msg = null;
+
+ if( f.getPluginId() == null )
+ {
+ msg = NLS.bind( Resources.facetNotFound, f.getId() );
+ }
+ else if( fv.getPluginId() == null )
+ {
+ msg = NLS.bind( Resources.facetVersionNotFound, f.getId(),
+ fv.getVersionString() );
+ }
+
+ if( msg != null )
+ {
+ final IStatus sub
+ = new Status( IStatus.WARNING, FacetUiPlugin.PLUGIN_ID, 0,
+ msg, null );
+
+ final IStatus[] existing = st.getChildren();
+ final IStatus[] modified = new IStatus[ existing.length + 1 ];
+ System.arraycopy( existing, 0, modified, 0, existing.length );
+ modified[ existing.length ] = sub;
+
+ st = new MultiStatus( FacetUiPlugin.PLUGIN_ID, 0, modified,
+ "", null ); //$NON-NLS-1$
+ }
+ }
+
+ return st;
+ }
+
private void refresh()
{
// Somehow the checked state of nested items gets lost when a refresh
@@ -1429,9 +1484,15 @@ public final class FacetsSelectionPanel
return false;
}
-
+
private TableRowData findTableRowData( final IProjectFacet f )
{
+ return findTableRowData( f, false );
+ }
+
+ private TableRowData findTableRowData( final IProjectFacet f,
+ final boolean createIfNecessary )
+ {
for( int i = 0, n = this.data.size(); i < n; i++ )
{
final TableRowData trd = (TableRowData) this.data.get( i );
@@ -1441,6 +1502,20 @@ public final class FacetsSelectionPanel
return trd;
}
}
+
+ if( createIfNecessary )
+ {
+ try
+ {
+ final TableRowData trd = new TableRowData( f );
+ this.data.add( trd );
+ return trd;
+ }
+ catch( CoreException e )
+ {
+ FacetUiPlugin.log( e );
+ }
+ }
throw new IllegalStateException();
}
@@ -1660,6 +1735,37 @@ public final class FacetsSelectionPanel
return list;
}
+
+ public void addUnknownVersion( final IProjectFacetVersion fv )
+ {
+ try
+ {
+ final Comparator c = this.f.getVersionComparator();
+ boolean added = false;
+
+ for( int i = 0, n = this.versions.size(); i < n; i++ )
+ {
+ final IProjectFacetVersion x
+ = (IProjectFacetVersion) this.versions.get( i );
+
+ if( c.compare( x.getVersionString(), fv.getVersionString() ) < 0 )
+ {
+ this.versions.add( i, fv );
+ added = true;
+ break;
+ }
+ }
+
+ if( ! added )
+ {
+ this.versions.add( fv );
+ }
+ }
+ catch( CoreException e )
+ {
+ FacetUiPlugin.log( e );
+ }
+ }
public IProjectFacetVersion getCurrentVersion()
{
@@ -2083,14 +2189,21 @@ public final class FacetsSelectionPanel
{
private Image errorImage;
+ private Image warningImage;
public ProblemsLabelProvider()
{
final Bundle bundle = Platform.getBundle( FacetUiPlugin.PLUGIN_ID );
- final URL url = bundle.getEntry( "images/error.gif" ); //$NON-NLS-1$
+
+ URL url = bundle.getEntry( "images/error.gif" ); //$NON-NLS-1$
this.errorImage
= ImageDescriptor.createFromURL( url ).createImage();
+
+ url = bundle.getEntry( "images/warning.gif" ); //$NON-NLS-1$
+
+ this.warningImage
+ = ImageDescriptor.createFromURL( url ).createImage();
}
public String getColumnText( final Object element,
@@ -2102,7 +2215,16 @@ public final class FacetsSelectionPanel
public Image getColumnImage( final Object element,
final int column )
{
- return this.errorImage;
+ final IStatus st = (IStatus) element;
+
+ if( st.getSeverity() == IStatus.ERROR )
+ {
+ return this.errorImage;
+ }
+ else
+ {
+ return this.warningImage;
+ }
}
public boolean isLabelProperty( final Object obj,
@@ -2114,6 +2236,7 @@ public final class FacetsSelectionPanel
public void dispose()
{
this.errorImage.dispose();
+ this.warningImage.dispose();
}
public void addListener( final ILabelProviderListener listener ) {}
@@ -2182,6 +2305,8 @@ public final class FacetsSelectionPanel
public static String couldNotSelectPreset;
public static String couldNotDeselectFixedFacetTitle;
public static String couldNotDeselectFixedFacetMessage;
+ public static String facetNotFound;
+ public static String facetVersionNotFound;
static
{
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties
index 3bd816c..5415199 100644
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties
+++ b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.properties
@@ -11,4 +11,6 @@ showRuntimes = << Show &Runtimes
hideRuntimes = Hide &Runtimes >>
couldNotSelectPreset = Could not select configuration {0}. Required facet {1} {2} is not visible.
couldNotDeselectFixedFacetTitle = Fixed Project Facet
-couldNotDeselectFixedFacetMessage = Project facet {0} cannot be deselected. It is critical to the proper function of this project. \ No newline at end of file
+couldNotDeselectFixedFacetMessage = Project facet {0} cannot be deselected. It is critical to the proper function of this project.
+facetNotFound = Implementation of project facet {0} could not be found. Functionality will be limited.
+facetVersionNotFound = Implementation of version {1} of project facet {0} could not be found. Functionality will be limited.
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java
index 1e2e66e..7179bdf 100644
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java
+++ b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java
@@ -192,7 +192,11 @@ public class RuntimesPropertyPage extends PropertyPage
= RuntimesPropertyPage.this.project;
fpj.setTargetedRuntimes( targeted, null );
- fpj.setPrimaryRuntime( primary, null );
+
+ if( primary != null )
+ {
+ fpj.setPrimaryRuntime( primary, null );
+ }
}
catch( CoreException e )
{

Back to the top