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-07-04 15:49:59 +0000
committerkkomissarchik2006-07-04 15:49:59 +0000
commitd4446a1da04133322372701d2b89916bce448271 (patch)
treeb3843c9ba36ddce7e57aa27757071110a4d5b86a
parent09f21960a5bf2d6a9d76190d42e28d206cd1467a (diff)
downloadwebtools.common.fproj-d4446a1da04133322372701d2b89916bce448271.tar.gz
webtools.common.fproj-d4446a1da04133322372701d2b89916bce448271.tar.xz
webtools.common.fproj-d4446a1da04133322372701d2b89916bce448271.zip
Bulk merge 1_5_maintenance to HEAD (2.0)
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/.options3
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/FacetedProjectFramework.java125
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IActionConfig.java11
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IConstraint.java2
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/ProjectFacetsManager.java2
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetCorePlugin.java37
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProject.java206
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProjectPropertyTester.java40
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/Preset.java5
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.java79
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.properties7
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPage.java5
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/FacetsSelectionPanel.java11
-rw-r--r--plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java35
16 files changed, 395 insertions, 178 deletions
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/.options b/plugins/org.eclipse.wst.common.project.facet.core/.options
index d03aff2..7d7212b 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/.options
+++ b/plugins/org.eclipse.wst.common.project.facet.core/.options
@@ -1,2 +1,3 @@
org.eclipse.wst.common.project.facet.core/delegate/calls = false
-org.eclipse.wst.common.project.facet.core/actionSorting = false \ No newline at end of file
+org.eclipse.wst.common.project.facet.core/actionSorting = false
+org.eclipse.wst.common.project.facet.core/activation = false \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.project.facet.core/META-INF/MANIFEST.MF
index 32650f0..fa4147f 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.project.facet.core/META-INF/MANIFEST.MF
@@ -3,9 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: %providerName
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.project.facet.core; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.100.qualifier
Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.wst.common.project.facet.core.internal.FacetCorePlugin
Bundle-Localization: plugin
Export-Package: org.eclipse.wst.common.project.facet.core,
org.eclipse.wst.common.project.facet.core.internal;x-internal:=true,
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/FacetedProjectFramework.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/FacetedProjectFramework.java
new file mode 100644
index 0000000..a5178a0
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/FacetedProjectFramework.java
@@ -0,0 +1,125 @@
+package org.eclipse.wst.common.project.facet.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.internal.FacetedProjectNature;
+import org.eclipse.wst.common.project.facet.core.internal.ProjectFacetsManagerImpl;
+
+public final class FacetedProjectFramework
+{
+ public static final String PLUGIN_ID
+ = "org.eclipse.wst.common.project.facet.core"; //$NON-NLS-1$
+
+ private static ProjectFacetsManagerImpl impl = null;
+
+ private FacetedProjectFramework() { }
+
+ /**
+ * <p>Determines whether the specified project facet is installed in the
+ * provided project. Returns <code>false</code> if the project is not
+ * accessible, the project is not faceted or the facet id is unrecognized.</p>
+ *
+ * <p>This method is explicitly designed to avoid activation of the Faceted
+ * Project Framework if the project is not faceted. For the code that
+ * operates in the context where it can be assumed that the framework has
+ * started already, better performance can be achieved by storing
+ * {@see IProjectFacet} and {@see IProjectFacetVersion} instances using the
+ * singleton pattern and using the
+ * {@see IFacetedProject.hasProjectFacet(IProjectFacet)} or
+ * {@see IFacetedProject.hasProjectFacet(IProjectFacetVersion)} methods.</p>
+ *
+ * <p>This method is equivalent to calling
+ * {@see hasProjectFacet(IProject,String,String)} with <code>null</code>
+ * version expression parameter.</p>
+ *
+ * @param project the project to check for the facet presence
+ * @param fid the project facet id
+ * @throws CoreException if failed while reading faceted project metadata
+ */
+
+ public static boolean hasProjectFacet( final IProject project,
+ final String fid )
+
+ throws CoreException
+
+ {
+ return hasProjectFacet( project, fid, null );
+ }
+
+ /**
+ * <p>Determines whether the specified project facet is installed in the
+ * provided project. Returns <code>false</code> if the project is not
+ * accessible, the project is not faceted or the facet id is unrecognized.</p>
+ *
+ * <p>This method is explicitly designed to avoid activation of the Faceted
+ * Project Framework if the project is not faceted. For the code that
+ * operates in the context where it can be assumed that the framework has
+ * started already, better performance can be achieved by storing
+ * {@see IProjectFacet} and {@see IProjectFacetVersion} instances using the
+ * singleton pattern and using the
+ * {@see IFacetedProject.hasProjectFacet(IProjectFacet)} or
+ * {@see IFacetedProject.hasProjectFacet(IProjectFacetVersion)} methods.</p>
+ *
+ * @param project the project to check for the facet presence
+ * @param fid the project facet id
+ * @param vexpr the version match expression, or <code>null</code> to
+ * match any version
+ * @throws CoreException if failed while reading faceted project metadata;
+ * if the version expression is invalid
+ */
+
+ public static boolean hasProjectFacet( final IProject project,
+ final String fid,
+ final String vexpr )
+
+ throws CoreException
+
+ {
+ if( project.isAccessible() &&
+ project.isNatureEnabled( FacetedProjectNature.NATURE_ID ) )
+ {
+ initialize();
+
+ final IFacetedProject fproj = ProjectFacetsManager.create( project );
+
+ if( fproj != null )
+ {
+ if( ProjectFacetsManager.isProjectFacetDefined( fid ) )
+ {
+ final IProjectFacet f = ProjectFacetsManager.getProjectFacet( fid );
+
+ if( vexpr == null )
+ {
+ return fproj.hasProjectFacet( f );
+ }
+ else
+ {
+ final IProjectFacetVersion fv = fproj.getInstalledVersion( f );
+
+ if( fv != null )
+ {
+ return f.getVersions( vexpr ).contains( fv );
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private static synchronized void initialize()
+ {
+ if( impl == null )
+ {
+ impl = new ProjectFacetsManagerImpl();
+ }
+ }
+
+ static ProjectFacetsManagerImpl getProjectFacetsManagerImpl()
+ {
+ initialize();
+ return impl;
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IActionConfig.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IActionConfig.java
index 9d803e9..542cf95 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IActionConfig.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IActionConfig.java
@@ -1,3 +1,14 @@
+/******************************************************************************
+ * 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.wst.common.project.facet.core;
import org.eclipse.core.runtime.IStatus;
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IConstraint.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IConstraint.java
index 3d1e182..fe2eebd 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IConstraint.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/IConstraint.java
@@ -64,7 +64,7 @@ public interface IConstraint
public static Type valueOf( final String name )
{
- return (Type) items.get( name );
+ return (Type) items.get( name.toLowerCase() );
}
public String name()
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/ProjectFacetsManager.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/ProjectFacetsManager.java
index b2911ad..c731f11 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/ProjectFacetsManager.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/ProjectFacetsManager.java
@@ -39,7 +39,7 @@ import org.eclipse.wst.common.project.facet.core.internal.ProjectFacetsManagerIm
public final class ProjectFacetsManager
{
private static ProjectFacetsManagerImpl impl
- = new ProjectFacetsManagerImpl();
+ = FacetedProjectFramework.getProjectFacetsManagerImpl();
private ProjectFacetsManager() {}
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetCorePlugin.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetCorePlugin.java
index fc84be8..bab8521 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetCorePlugin.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetCorePlugin.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
+ * 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
@@ -15,11 +15,12 @@ import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.osgi.framework.Bundle;
/**
@@ -27,36 +28,36 @@ import org.osgi.framework.Bundle;
*/
public final class FacetCorePlugin
-
- extends Plugin
-
{
- public static final String PLUGIN_ID
- = "org.eclipse.wst.common.project.facet.core"; //$NON-NLS-1$
+ public static final String PLUGIN_ID = FacetedProjectFramework.PLUGIN_ID;
private static final String TRACING_ACTION_SORTING
= PLUGIN_ID + "/actionSorting"; //$NON-NLS-1$
+
+ private static final String TRACING_FRAMEWORK_ACTIVATION
+ = PLUGIN_ID + "/activation"; //$NON-NLS-1$
- private static FacetCorePlugin plugin;
private static final Set messagesLogged = new HashSet();
- public FacetCorePlugin()
+ private static final ILog platformLog
+ = Platform.getLog( Platform.getBundle( PLUGIN_ID ) );
+
+ public static boolean isTracingActionSorting()
{
- super();
- plugin = this;
+ return checkDebugOption( TRACING_ACTION_SORTING );
}
- public static FacetCorePlugin getInstance()
+ public static boolean isTracingFrameworkActivation()
{
- return plugin;
+ return checkDebugOption( TRACING_FRAMEWORK_ACTIVATION );
}
- public static boolean isTracingActionSorting()
+ private static boolean checkDebugOption( final String debugOption )
{
- final String optionValue
- = Platform.getDebugOption( TRACING_ACTION_SORTING );
+ final String optionValue = Platform.getDebugOption( debugOption );
- return optionValue == null ? false : optionValue.equals( "true" ); //$NON-NLS-1$
+ return optionValue == null
+ ? false : Boolean.valueOf( optionValue ).equals( Boolean.TRUE );
}
public static void log( final Exception e )
@@ -67,7 +68,7 @@ public final class FacetCorePlugin
public static void log( final IStatus status )
{
- getInstance().getLog().log( status );
+ platformLog.log( status );
}
public static void log( final String msg )
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 c037c50..012bbe2 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
@@ -124,7 +124,7 @@ public final class FacetedProject
private final CopyOnWriteSet targetedRuntimes;
private String primaryRuntime;
IFile f;
- private long fLastModified = -1;
+ private long fModificationStamp = -1;
private final List listeners;
private final Object lock = new Object();
private boolean isBeingModified = false;
@@ -237,28 +237,28 @@ public final class FacetedProject
throws CoreException
{
- beginModification();
-
- try
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable()
{
- final IWorkspaceRunnable wr = new IWorkspaceRunnable()
+ public void run( final IProgressMonitor monitor )
+
+ throws CoreException
+
{
- public void run( final IProgressMonitor monitor )
+ beginModification();
- throws CoreException
-
+ try
{
modifyInternal( actions, monitor );
}
- };
-
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, monitor );
- }
- finally
- {
- endModification();
- }
+ finally
+ {
+ endModification();
+ }
+ }
+ };
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, monitor );
notifyListeners();
}
@@ -405,16 +405,16 @@ public final class FacetedProject
throws CoreException
{
- beginModification();
-
- try
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable()
{
- final IWorkspaceRunnable wr = new IWorkspaceRunnable()
+ public void run( final IProgressMonitor monitor )
+
+ throws CoreException
+
{
- public void run( final IProgressMonitor monitor )
+ beginModification();
- throws CoreException
-
+ try
{
synchronized( FacetedProject.this.lock )
{
@@ -424,15 +424,15 @@ public final class FacetedProject
save();
}
- };
-
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
- }
- finally
- {
- endModification();
- }
+ finally
+ {
+ endModification();
+ }
+ }
+ };
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
notifyListeners();
}
@@ -479,33 +479,33 @@ public final class FacetedProject
}
public void setTargetedRuntimes( final Set runtimes,
- final IProgressMonitor monitor )
+ final IProgressMonitor monitor )
throws CoreException
{
- beginModification();
-
- try
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable()
{
- final IWorkspaceRunnable wr = new IWorkspaceRunnable()
+ public void run( final IProgressMonitor monitor )
+
+ throws CoreException
+
{
- public void run( final IProgressMonitor monitor )
+ beginModification();
- throws CoreException
-
+ try
{
setTargetedRuntimesInternal( runtimes, monitor );
}
- };
-
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
- }
- finally
- {
- endModification();
- }
+ finally
+ {
+ endModification();
+ }
+ }
+ };
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
notifyListeners();
}
@@ -617,33 +617,33 @@ public final class FacetedProject
}
public void addTargetedRuntime( final IRuntime runtime,
- final IProgressMonitor monitor )
+ final IProgressMonitor monitor )
throws CoreException
{
- beginModification();
-
- try
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable()
{
- final IWorkspaceRunnable wr = new IWorkspaceRunnable()
+ public void run( final IProgressMonitor monitor )
+
+ throws CoreException
+
{
- public void run( final IProgressMonitor monitor )
+ beginModification();
- throws CoreException
-
+ try
{
addTargetedRuntimeInternal( runtime, monitor );
}
- };
-
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
- }
- finally
- {
- endModification();
- }
+ finally
+ {
+ endModification();
+ }
+ }
+ };
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
notifyListeners();
}
@@ -716,28 +716,28 @@ public final class FacetedProject
throws CoreException
{
- beginModification();
-
- try
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable()
{
- final IWorkspaceRunnable wr = new IWorkspaceRunnable()
+ public void run( final IProgressMonitor monitor )
+
+ throws CoreException
+
{
- public void run( final IProgressMonitor monitor )
+ beginModification();
- throws CoreException
-
+ try
{
removeTargetedRuntimeInternal( runtime, monitor );
}
- };
-
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
- }
- finally
- {
- endModification();
- }
+ finally
+ {
+ endModification();
+ }
+ }
+ };
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
notifyListeners();
}
@@ -825,28 +825,28 @@ public final class FacetedProject
throws CoreException
{
- beginModification();
-
- try
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable()
{
- final IWorkspaceRunnable wr = new IWorkspaceRunnable()
+ public void run( final IProgressMonitor monitor )
+
+ throws CoreException
+
{
- public void run( final IProgressMonitor monitor )
+ beginModification();
- throws CoreException
-
+ try
{
setPrimaryRuntimeInternal( runtime, monitor );
}
- };
-
- final IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
- }
- finally
- {
- endModification();
- }
+ finally
+ {
+ endModification();
+ }
+ }
+ };
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
notifyListeners();
}
@@ -1383,7 +1383,7 @@ public final class FacetedProject
this.f.create( in, true, null );
}
- this.fLastModified = this.f.getLocation().toFile().lastModified();
+ this.fModificationStamp = this.f.getModificationStamp();
}
public void refresh()
@@ -1399,7 +1399,7 @@ public final class FacetedProject
}
if( this.f.exists() &&
- this.f.getLocation().toFile().lastModified() == this.fLastModified )
+ this.f.getModificationStamp() == this.fModificationStamp )
{
return;
}
@@ -1416,11 +1416,11 @@ public final class FacetedProject
if( ! this.f.exists() )
{
- this.fLastModified = -1;
+ this.fModificationStamp = -1;
return;
}
- this.fLastModified = this.f.getLocation().toFile().lastModified();
+ this.fModificationStamp = this.f.getModificationStamp();
final Element root = parse( this.f.getLocation().toFile() );
final Element[] elements = children( root );
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProjectPropertyTester.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProjectPropertyTester.java
index 08f0dfa..426b442 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProjectPropertyTester.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/FacetedProjectPropertyTester.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
+ * 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
@@ -15,10 +15,7 @@ import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
/**
* @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
@@ -48,49 +45,24 @@ public final class FacetedProjectPropertyTester
return false;
}
- final IFacetedProject fpj = ProjectFacetsManager.create( pj );
-
- if( fpj == null || value == null || ! ( value instanceof String ) )
- {
- return false;
- }
-
final String val = (String) value;
final int colon = val.indexOf( ':' );
final String fid;
- final String vexprstr;
+ final String vexpr;
if( colon == -1 || colon == val.length() - 1 )
{
fid = val;
- vexprstr = null;
+ vexpr = null;
}
else
{
fid = val.substring( 0, colon );
- vexprstr = val.substring( colon + 1 );
+ vexpr = val.substring( colon + 1 );
}
- if( ProjectFacetsManager.isProjectFacetDefined( fid ) )
- {
- final IProjectFacet f
- = ProjectFacetsManager.getProjectFacet( fid );
-
- final IProjectFacetVersion fv = fpj.getInstalledVersion( f );
-
- if( fv != null )
- {
- if( vexprstr == null )
- {
- return true;
- }
- else
- {
- return f.getVersions( vexprstr ).contains( fv );
- }
- }
- }
+ return FacetedProjectFramework.hasProjectFacet( pj, fid, vexpr );
}
catch( CoreException e )
{
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/Preset.java b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/Preset.java
index 59ec748..9c458bc 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/Preset.java
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/Preset.java
@@ -97,4 +97,9 @@ public final class Preset
this.isUserDefined = isUserDefined;
}
+ public String toString()
+ {
+ return this.id;
+ }
+
}
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 c6c2017..aa1df05 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
@@ -11,6 +11,8 @@
package org.eclipse.wst.common.project.facet.core.internal;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -103,6 +105,41 @@ public final class ProjectFacetsManagerImpl
public ProjectFacetsManagerImpl()
{
+ long activationStart = 0;
+
+ if( FacetCorePlugin.isTracingFrameworkActivation() )
+ {
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter( sw );
+ ( new Throwable() ).printStackTrace( pw );
+
+ String context = sw.getBuffer().toString();
+ final int endOfFirstLine = context.indexOf( '\n' );
+ context = context.substring( endOfFirstLine + 1 );
+ context = context.replaceAll( "\\t", " " ); //$NON-NLS-1$ //$NON-NLS-2$
+
+ int length = context.length();
+
+ if( context.charAt( length - 2 ) == '\r' )
+ {
+ length = length - 2;
+ }
+ else
+ {
+ length = length - 1;
+ }
+
+ context = context.substring( 0, length );
+
+ final String msg
+ = NLS.bind( Resources.tracingFrameworkActivationStarting,
+ context );
+
+ System.out.println( msg );
+
+ activationStart = System.currentTimeMillis();
+ }
+
this.facets = new IndexedSet();
this.actions = new IndexedSet();
this.categories = new IndexedSet();
@@ -117,6 +154,18 @@ public final class ProjectFacetsManagerImpl
final IWorkspace ws = ResourcesPlugin.getWorkspace();
final IResourceChangeListener ls = new ResourceChangeListener();
ws.addResourceChangeListener( ls, IResourceChangeEvent.POST_CHANGE );
+
+ if( FacetCorePlugin.isTracingFrameworkActivation() )
+ {
+ final long duration
+ = System.currentTimeMillis() - activationStart;
+
+ final String msg
+ = NLS.bind( Resources.tracingFrameworkActivationFinished,
+ String.valueOf( duration ) );
+
+ System.out.println( msg );
+ }
}
public Set getProjectFacets()
@@ -426,12 +475,14 @@ public final class ProjectFacetsManagerImpl
{
if( monitor != null )
{
- monitor.beginTask( "", 2 ); //$NON-NLS-1$
+ monitor.beginTask( "", 1 ); //$NON-NLS-1$
}
try
{
- if( project.exists() && convertIfNecessary )
+ if( project.isAccessible() &&
+ ! project.isNatureEnabled( FacetedProjectNature.NATURE_ID ) &&
+ convertIfNecessary )
{
IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds();
@@ -443,8 +494,6 @@ public final class ProjectFacetsManagerImpl
project.setDescription( description, submon( monitor, 1 ) );
}
- project.open( IResource.BACKGROUND_REFRESH, submon( monitor, 1 ) );
-
return create( project );
}
finally
@@ -1164,6 +1213,16 @@ public final class ProjectFacetsManagerImpl
}
}
+ if( category.getLabel() == null )
+ {
+ category.setLabel( category.getId() );
+ }
+
+ if( category.getDescription() == null )
+ {
+ category.setDescription( "" ); //$NON-NLS-1$
+ }
+
this.categories.add( id, category );
}
@@ -1237,6 +1296,11 @@ public final class ProjectFacetsManagerImpl
descriptor.setLabel( id );
}
+ if( descriptor.getDescription() == null )
+ {
+ descriptor.setDescription( "" ); //$NON-NLS-1$
+ }
+
this.facets.add( id, descriptor );
}
@@ -1955,6 +2019,11 @@ public final class ProjectFacetsManagerImpl
}
}
+ if( preset.getLabel() == null )
+ {
+ preset.setLabel( preset.getId() );
+ }
+
if( preset.getDescription() == null )
{
preset.setDescription( "" ); //$NON-NLS-1$
@@ -2208,6 +2277,8 @@ public final class ProjectFacetsManagerImpl
public static String invalidConflictsConstraint;
public static String deprecatedRuntimeChangedAction;
public static String tracingActionSorting;
+ public static String tracingFrameworkActivationStarting;
+ public static String tracingFrameworkActivationFinished;
public static String unknownProperty;
public static String propertyNotApplicable;
diff --git a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.properties b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.properties
index 052848e..a4277af 100644
--- a/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.properties
+++ b/plugins/org.eclipse.wst.common.project.facet.core/src/org/eclipse/wst/common/project/facet/core/internal/ProjectFacetsManagerImpl.properties
@@ -28,5 +28,12 @@ Finished sorting faceted project actions.\n\
\ sorted = {2}\n\
\ steps = {3}
+tracingFrameworkActivationStarting = \
+Activating Faceted Project Framework...\n\
+{0}
+
+tracingFrameworkActivationFinished = \
+Faceted Project Framework activated successfully in {0} ms.
+
unknownProperty = "{0}" is not a valid property name.
propertyNotApplicable = Property "{0}" is not applicable to action type {1}.
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
index c646ccb..490db8b 100644
--- a/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: %providerName
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.project.facet.ui; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.100.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.wst.common.project.facet.ui.internal.FacetUiPlugin
Bundle-Localization: plugin
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 c54778c..e67af86 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
@@ -281,6 +281,11 @@ public final class FacetsSelectionPage
}
super.setVisible( visible );
+
+ if( visible )
+ {
+ this.panel.setFocus();
+ }
}
private static final class Resources
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 82b158d..9af4ae6 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
@@ -856,7 +856,6 @@ public final class FacetsSelectionPanel
this.filters.add( this.conflictingFilter );
refresh();
- refreshPresetsCombo();
refreshVersionsDropDown();
updateValidationDisplay();
}
@@ -866,7 +865,6 @@ public final class FacetsSelectionPanel
this.filters.add( filter );
refresh();
- refreshPresetsCombo();
refreshVersionsDropDown();
}
@@ -875,10 +873,14 @@ public final class FacetsSelectionPanel
this.filters.remove( filter );
refresh();
- refreshPresetsCombo();
refreshVersionsDropDown();
}
-
+
+ public boolean setFocus()
+ {
+ return this.tree.getTree().setFocus();
+ }
+
public void addProjectFacetsListener( final Listener listener )
{
this.listeners.add( listener );
@@ -1188,6 +1190,7 @@ public final class FacetsSelectionPanel
final Object[] checked = this.tree.getCheckedElements();
this.tree.refresh();
this.tree.setCheckedElements( checked );
+ refreshPresetsCombo();
}
public void syncWithPresetsModel( final Combo combo )
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 7179bdf..59b87a9 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
@@ -15,8 +15,12 @@ import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.resources.IProject;
+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.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.wizard.IWizard;
@@ -182,21 +186,34 @@ public class RuntimesPropertyPage extends PropertyPage
if( ! this.project.getTargetedRuntimes().equals( primary ) ||
! equals( this.project.getPrimaryRuntime(), primary ) )
{
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable()
+ {
+ public void run( final IProgressMonitor monitor )
+
+ throws CoreException
+
+ {
+ final IFacetedProject fpj
+ = RuntimesPropertyPage.this.project;
+
+ fpj.setTargetedRuntimes( targeted, null );
+
+ if( primary != null )
+ {
+ fpj.setPrimaryRuntime( primary, null );
+ }
+ }
+ };
+
final Runnable op = new Runnable()
{
public void run()
{
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+
try
{
- final IFacetedProject fpj
- = RuntimesPropertyPage.this.project;
-
- fpj.setTargetedRuntimes( targeted, null );
-
- if( primary != null )
- {
- fpj.setPrimaryRuntime( primary, null );
- }
+ ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, null );
}
catch( CoreException e )
{

Back to the top