This commit was manufactured by cvs2svn to create tag 'R1_5_5'.
diff --git a/features/org.eclipse.wst.common_core.feature/feature.xml b/features/org.eclipse.wst.common_core.feature/feature.xml
index 67782e7..5b66728 100644
--- a/features/org.eclipse.wst.common_core.feature/feature.xml
+++ b/features/org.eclipse.wst.common_core.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.wst.common_core.feature"
label="%featureName"
- version="1.5.1.qualifier"
+ version="1.5.5.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.wst.common_core.feature/sourceTemplateFeature/feature.xml b/features/org.eclipse.wst.common_core.feature/sourceTemplateFeature/feature.xml
index 1b9788d..ebb270b 100644
--- a/features/org.eclipse.wst.common_core.feature/sourceTemplateFeature/feature.xml
+++ b/features/org.eclipse.wst.common_core.feature/sourceTemplateFeature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.wst.common_core.feature.source"
label="%featureName"
- version="1.5.1.qualifier"
+ version="1.5.5.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.wst.common_sdk.feature/feature.xml b/features/org.eclipse.wst.common_sdk.feature/feature.xml
index 7b09133..360eb28 100644
--- a/features/org.eclipse.wst.common_sdk.feature/feature.xml
+++ b/features/org.eclipse.wst.common_sdk.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.wst.common_sdk.feature"
label="%featureName"
- version="1.5.0.qualifier"
+ version="1.5.5.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.wst.common_ui.feature/feature.xml b/features/org.eclipse.wst.common_ui.feature/feature.xml
index bbd79bf..c183d13 100644
--- a/features/org.eclipse.wst.common_ui.feature/feature.xml
+++ b/features/org.eclipse.wst.common_ui.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.wst.common_ui.feature"
label="%featureName"
- version="1.5.1.qualifier"
+ version="1.5.5.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.wst.common_ui.feature/sourceTemplateFeature/feature.xml b/features/org.eclipse.wst.common_ui.feature/sourceTemplateFeature/feature.xml
index 0210abd..13a6d56 100644
--- a/features/org.eclipse.wst.common_ui.feature/sourceTemplateFeature/feature.xml
+++ b/features/org.eclipse.wst.common_ui.feature/sourceTemplateFeature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.wst.common_ui.feature.source"
label="%featureName"
- version="1.5.1.qualifier"
+ version="1.5.5.qualifier"
provider-name="%providerName">
<description>
diff --git a/plugins/org.eclipse.jem.util/.classpath b/plugins/org.eclipse.jem.util/.classpath
index d4d58af..25434f7 100644
--- a/plugins/org.eclipse.jem.util/.classpath
+++ b/plugins/org.eclipse.jem.util/.classpath
@@ -3,8 +3,7 @@
<classpathentry kind="src" path="jemutil"/>
<classpathentry kind="src" path="property_files"/>
<classpathentry kind="src" path="jemutil-nonworkbnech"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry sourcepath="org.eclipse.perfmsr.core.stub/perfmsr.jar" kind="lib" path="org.eclipse.perfmsr.core.stub/perfmsr.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/org.eclipse.jem.util/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.jem.util/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..8c58b56
--- /dev/null
+++ b/plugins/org.eclipse.jem.util/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Sun Apr 15 21:22:05 EDT 2007
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/plugins/org.eclipse.jem.util/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.jem.util/.settings/org.eclipse.jdt.core.prefs
index d78073f..77b1d97 100644
--- a/plugins/org.eclipse.jem.util/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.jem.util/.settings/org.eclipse.jdt.core.prefs
@@ -1,11 +1,15 @@
-#Tue Feb 21 10:09:19 EST 2006
+#Sun Apr 15 21:31:03 EDT 2007
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -41,6 +45,7 @@
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
index 69586e5..429caa0 100644
--- a/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
@@ -20,6 +20,7 @@
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.2.0,3.0.0)",
org.eclipse.emf.ecore.xmi;bundle-version="[2.2.0,3.0.0)",
- org.eclipse.perfmsr.core;resolution:=optional,
+ org.eclipse.perfmsr.core;bundle-version="1.0.0";resolution:=optional,
com.ibm.icu;bundle-version="[3.4.4.1,4.0.0)"
Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/plugins/org.eclipse.jem.util/build.properties b/plugins/org.eclipse.jem.util/build.properties
index b40afd0..31b39df 100644
--- a/plugins/org.eclipse.jem.util/build.properties
+++ b/plugins/org.eclipse.jem.util/build.properties
@@ -21,3 +21,4 @@
property_files/,\
jemutil-nonworkbnech/
jars.compile.order = .
+jars.extra.classpath = org.eclipse.perfmsr.core.stub/perfmsr.jar
diff --git a/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
index 11b3d26..b7a0e9a 100644
--- a/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.emf/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.emf; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.4.qualifier
Bundle-Activator: org.eclipse.wst.common.internal.emf.plugin.EcoreUtilitiesPlugin
Bundle-Vendor: %pluginProvider
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
index 5107fe7..c6c5a2f 100644
--- a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
@@ -8,6 +8,8 @@
**************************************************************************************************/
package org.eclipse.wst.common.internal.emf.resource;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -60,6 +62,9 @@
protected Translator[] childTranslators;
protected boolean isRoot = false;
+
+ private static final String PLATFORM = "org.eclipse.core.runtime.Platform"; //$NON-NLS-1$
+ private static final String ISRUNNING = "isRunning"; //$NON-NLS-1$
private class DependencyAdapter extends org.eclipse.emf.common.notify.impl.AdapterImpl {
@@ -125,12 +130,35 @@
protected void initChildTranslators() {
List children = new ArrayList();
- // Get extended child translators
- Translator[] extendedChildren = TranslatorService.getInstance().getTranslators();
- for (int i = 0; i < extendedChildren.length; i++) {
- if (extendedChildren[i] != null)
- children.add(extendedChildren[i]);
- }
+ boolean isRunning = false; //is the OSGI platform running ?
+ try {
+ // If the Platform class can be found, then continue to check if the OSGI platform is running
+ Class clazz = Class.forName(PLATFORM);
+ Method m = clazz.getMethod(ISRUNNING, null);
+ isRunning = ((Boolean)m.invoke(clazz, null)).booleanValue();
+ } catch (ClassNotFoundException e) {
+ // Ignore because this must be in a non_OSGI environment
+ } catch (SecurityException e) {
+ // Ignore because this must be in a non_OSGI environment
+ } catch (NoSuchMethodException e) {
+ // Ignore because this must be in a non_OSGI environment
+ } catch (IllegalArgumentException e) {
+ // Ignore because this must be in a non_OSGI environment
+ } catch (IllegalAccessException e) {
+ // Ignore because this must be in a non_OSGI environment
+ } catch (InvocationTargetException e) {
+ // Ignore because this must be in a non_OSGI environment
+ }
+ //Check for extended child translators because we are in OSGI mode
+ if (isRunning) {
+ Translator[] extendedChildren = TranslatorService.getInstance().getTranslators();
+ for (int i = 0; i < extendedChildren.length; i++) {
+ if (extendedChildren[i] != null)
+ children.add(extendedChildren[i]);
+ }
+ }
+
+
children.addAll(Arrays.asList(fTranslator.getChildren(getTarget(), fRenderer.getVersionID())));
VariableTranslatorFactory factory = fTranslator.getVariableTranslatorFactory();
@@ -412,9 +440,11 @@
}
// Remove any remaining adapters.
- for (; i < mofChildren.size(); i++) {
- removeMOFValue((EObject) mofChildren.get(i), map);
- }
+ //make a copy so we remove all items - bug 192468
+ Object[] childrenArray = mofChildren.toArray();
+ for (; i < childrenArray.length; i++) {
+ removeMOFValue((EObject) childrenArray[i], map);
+ }
// The adapters cannot be updated as they created. We must wait until
// all of the adapters are created and removed before updating,
@@ -1115,6 +1145,7 @@
try {
return map.convertStringToValue(trimmedValue, emfObject);
} catch (FeatureValueConversionException ex) {
+ org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ex);
handleFeatureValueConversionException(ex);
return null;
}
@@ -1678,12 +1709,25 @@
map.clearList(mofObject);
// Go through the list of nodes and update the MOF collection
+ int addIndex = 0;
for (int i = 0; i < nodeChildren.size(); i++) {
Node child = (Node) nodeChildren.get(i);
Object attributeValue = extractValue(child, map, mofObject);
- if (attributeValue != null)
- map.setMOFValue(mofObject, attributeValue, i);
-
+ boolean advanceAddIndex = true;
+ if (attributeValue != null){
+ if(map.getFeature() != null && map.getFeature().isUnique() && mofObject.eGet(map.getFeature()) != null && mofObject.eGet(map.getFeature()) instanceof List && ((List) mofObject.eGet(map.getFeature())).contains(attributeValue)){
+ advanceAddIndex = false;
+ String domName = map.domNameAndPath != null ? map.domNameAndPath : "attribute"; //$NON-NLS-1$
+ org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(new IllegalArgumentException("The 'no duplicates' constraint is violated by "+domName+" = "+attributeValue));
+ handleInvalidMultiNodes(child.getNodeName());
+ } else {
+ map.setMOFValue(mofObject, attributeValue, addIndex);
+ }
+ if(advanceAddIndex){
+ addIndex ++;
+ }
+ }
+
// Adapt the node so update will occur.
addDOMAdapter(child);
}
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/ReferencedXMIResourceImpl.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/ReferencedXMIResourceImpl.java
index df07748..1c0e098 100644
--- a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/ReferencedXMIResourceImpl.java
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/ReferencedXMIResourceImpl.java
@@ -320,8 +320,10 @@
setForceRefresh(false);
setModified(false); //dcb - this is required to ensure that resources without files are
// marked as not modified.
- if (readReferenceCount == 0 && editReferenceCount == 0)
- resetAsNew();
+ if (readReferenceCount == 0 && editReferenceCount == 0) {
+ getResourceSet().getResources().remove(this);
+ }
+
}
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/utilities/DOMUtilities.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/utilities/DOMUtilities.java
index 7eeac6c..3e80a89 100644
--- a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/utilities/DOMUtilities.java
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/utilities/DOMUtilities.java
@@ -11,10 +11,13 @@
package org.eclipse.wst.common.internal.emf.utilities;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -558,17 +561,37 @@
}
+
private static InputStream createHeaderInputStream(String doctype, String publicId, String systemId, boolean includeDummy) {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- PrintWriter writer = new PrintWriter(outputStream);
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ // The prior code (which is still in the catch block), uses
+ // the system default encoding [System.getProperty("file.encoding")];
+ // on Z/OS this is Cp1047. The combination of "UTF-8" in the header
+ // and "Cp1047" in the writer create an unusable input stream.
+
+ PrintWriter writer;
+
+ try {
+ OutputStreamWriter outputWriter = new OutputStreamWriter(outputStream, "UTF-8"); //$NON-NLS-1$
+ // throws UnsupportedEncodingException
+ writer = new PrintWriter(outputWriter);
+ } catch (UnsupportedEncodingException e) {
+ // Should never get here (earlier code)
+ writer = new PrintWriter(outputStream);
+ }
+
writeHeader(writer, doctype, publicId, systemId);
if (includeDummy)
addDummyEntity(writer);
writer.flush();
writer.close();
- return new java.io.ByteArrayInputStream(outputStream.toByteArray());
+
+ byte[] bytes = outputStream.toByteArray();
+ return new ByteArrayInputStream(bytes);
}
+
private static void writeHeader(PrintWriter writer, String doctype, String publicId, String systemId) {
writer.write("<?xml version=\""); //$NON-NLS-1$
writer.write("1.0"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.emfworkbench.integration/META-INF/MANIFEST.MF
index 10db65d..ac5d3c6 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.emfworkbench.integration; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.5.qualifier
Bundle-Activator: org.eclipse.wst.common.internal.emfworkbench.integration.EMFWorkbenchEditPlugin
Bundle-Vendor: %pluginVendor
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/plugin.xml b/plugins/org.eclipse.wst.common.emfworkbench.integration/plugin.xml
index adb8868..5673b57 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/plugin.xml
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/plugin.xml
@@ -33,5 +33,15 @@
class="org.eclipse.wst.common.internal.emfworkbench.EmfPackagePropertyTester">
</propertyTester>
</extension>
+
+ <extension
+ point="org.eclipse.jem.util.uiContextSensitiveClass">
+ <uiContextSensitiveClass
+ key="ValidateEditContext"
+ className="org.eclipse.wst.common.internal.emfworkbench.validateedit.ValidateEditHeadlessContext"
+ context="Headless">
+ </uiContextSensitiveClass>
+ </extension>
+
</plugin>
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/EMFWorkbenchContext.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/EMFWorkbenchContext.java
index 5d21be8..378788b 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/EMFWorkbenchContext.java
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/EMFWorkbenchContext.java
@@ -126,25 +126,29 @@
* @see J2EEEditModel
*/
public final EditModel getEditModelForRead(String editModelID, Object accessorKey, Map params) {
- EditModel editModel = getExistingEditModel(editModelID, params, true);
- if (null == editModel) {
- editModel = createEditModelForRead(editModelID, params);
- synchronized (editModel) {
- cacheEditModel(editModel, params);
- EditModelLeastUsedCache.INSTANCE.access(editModel);
- editModel.access(accessorKey);
- }
- } else {
- synchronized (editModel) {
- if (editModel.isDisposed() || editModel.isDisposing()) {
- editModel = createEditModelForRead(editModelID, params);
+ try {
+ EditModel editModel = getExistingEditModel(editModelID, params, true);
+ if (null == editModel) {
+ editModel = createEditModelForRead(editModelID, params);
+ synchronized (editModel) {
cacheEditModel(editModel, params);
+ EditModelLeastUsedCache.getInstance().access(editModel);
+ editModel.access(accessorKey);
}
- EditModelLeastUsedCache.INSTANCE.access(editModel);
- editModel.access(accessorKey);
+ } else {
+ synchronized (editModel) {
+ if (editModel.isDisposed() || editModel.isDisposing()) {
+ editModel = createEditModelForRead(editModelID, params);
+ cacheEditModel(editModel, params);
+ }
+ EditModelLeastUsedCache.getInstance().access(editModel);
+ editModel.access(accessorKey);
+ }
}
+ return editModel;
+ } finally {
+ EditModelLeastUsedCache.getInstance().optimizeLRUSizeIfNecessary();
}
- return editModel;
}
/**
@@ -222,7 +226,7 @@
synchronized (readOnlyModels) {
synchronized (editableModels) {
Collection readOnly = readOnlyModels.values();
- EditModelLeastUsedCache.INSTANCE.removeAllCached(readOnly);
+ EditModelLeastUsedCache.getInstance().removeAllCached(readOnly);
discardModels(readOnly);
discardModels(editableModels.values());
}
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/EditModelLeastUsedCache.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/EditModelLeastUsedCache.java
index 37a1171..4559083 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/EditModelLeastUsedCache.java
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/EditModelLeastUsedCache.java
@@ -4,33 +4,56 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
+/**
+ * This class will be used to cache the recently used edit models. Loading and unloading of edit models can be
+ * costly, especially if operations and/or post operations have a need to reload the same edit model repeatedly.
+ * This will allow those repeatedly used edit models to be cached, thereby improving performance. By design, the
+ * edit models load resources and these resources are stored in memory, so we don't want to cache every edit
+ * model accessed, so this is a least used cache mechanism, where the max size is 10. If an edit model is used
+ * it is put to the back of the stack, and new edit models accessed are put to the back of the stack, so that the
+ * top of the stack is the first edit model disposed when the cache is higher than the threshhold.
+ *
+ */
public class EditModelLeastUsedCache {
- private final DynamicGrowthModel dynamicGrowthModel = new DynamicGrowthModel();
-
+
/**
- * Provide a singleton.
+ * Provide a singleton instance.
*/
- static EditModelLeastUsedCache INSTANCE = new EditModelLeastUsedCache();
+ private static EditModelLeastUsedCache INSTANCE = new EditModelLeastUsedCache();
- private int threshhold = dynamicGrowthModel.getOptimalSize();
+ /**
+ * The threshold, or most edit models we will keep open at a time is 10. This is low enough to not
+ * overwhelm workbench memory and high enough to aid in operations which continually reload 3-4
+ * edit models.
+ */
+ private final static int threshhold = 10;
- /* A LHS is required to ensure the order of the items is maintained. Other
+ /**
+ * A LHS is required to ensure the order of the items is maintained. Other
* Set implementations (HashSet, TreeSet) do not preserve the order. This
* is critical to the implementation. DO NOT CHANGE THIS.
*/
private LinkedHashSet lru = new LinkedHashSet(threshhold);
/**
+ * Accessor for the EditModelLeastUsedCache INSTANCE
+ *
+ * @return the EditModelLeastUsedCache INSTANCE
+ */
+ public static EditModelLeastUsedCache getInstance() {
+ return INSTANCE;
+ }
+
+ /**
* Remove the all elements from the lru that are contained
* in <code>aCollection</code>. This method assumes the
* EditModels in the aCollection will be discarded and it
* will not attempt to decrememt its reference count.
* @param aCollection - A {@link Collection} of {@link EditModel}.
*/
- void removeAllCached(Collection aCollection) {
+ public void removeAllCached(Collection aCollection) {
if (aCollection != null) {
lru.removeAll(aCollection);
}
@@ -43,51 +66,42 @@
* @param editModel - The {@link EditModel} that we want to place
* in the least used cache.
*/
- void access(EditModel editModel) {
- if (lru.contains(editModel)) {
- moveToEnd(editModel);
- } else {
- editModel.access(this);
- lru.add(editModel);
+ public void access(EditModel editModel) {
+ boolean shouldAccess = true;
+ synchronized (lru) {
+ if (lru.contains(editModel)) {
+ moveToEnd(editModel);
+ shouldAccess = false;
+ }
}
- IPath key = editModel.getProject().getFullPath().append(editModel.getEditModelID());
- if (dynamicGrowthModel.injectKey(key)){
- optimizeLRUSize() ;
-
+ if (shouldAccess) {
+ editModel.access(this);
+ synchronized (lru) {
+ lru.add(editModel);
+ }
}
}
-
-
- /*
+ /**
* If we hit the capacity of the lru then remove the first one
* and release access.
*/
- private void optimizeLRUSize() {
- if(threshhold > dynamicGrowthModel.getOptimalSize()) {
- // shrink
- if(lru.size() >= threshhold) {
- // remove elements and release them.
- int iterations = lru.size() - threshhold + 1;
- int i = 0;
+ public void optimizeLRUSizeIfNecessary() {
+ EditModel model = null;
+ synchronized (lru) {
+ if (lru.size() > threshhold) {
+ // remove oldest element and release the edit model.
Iterator iterator = lru.iterator();
- if (iterator.hasNext() && (i < iterations)) {
-
- EditModel model = (EditModel) iterator.next();
- if (model != null) {
- lru.remove(model);
- model.releaseAccess(this);
- }
- i++;
+ model = (EditModel) iterator.next();
+ if (model != null) {
+ lru.remove(model);
}
-
}
- /* else ok */
}
- threshhold = dynamicGrowthModel.getOptimalSize();
+ if (model != null)
+ model.releaseAccess(this);
}
-
/**
* Move the editModel to the end of the list
* @param editModel -- EditModel to be moved
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/EMFWorkbenchEditContextFactory.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/EMFWorkbenchEditContextFactory.java
index 33b554e..4110873 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/EMFWorkbenchEditContextFactory.java
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/EMFWorkbenchEditContextFactory.java
@@ -57,7 +57,7 @@
protected static LockManager lockManager = new LockManager();
protected static Map projectLocks = new Hashtable();
- protected static ILock getProjectLockObject(IProject aProject){
+ public static ILock getProjectLockObject(IProject aProject){
if(null == aProject){
return null;
}
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/EditModelRegistry.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/EditModelRegistry.java
index 0733b32..dcfa367 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/EditModelRegistry.java
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/edit/EditModelRegistry.java
@@ -304,7 +304,7 @@
return this.factory;
}
- private void initializeResources() {
+ private synchronized void initializeResources() {
if (editModelResources == null) {
if (configurationElement != null) {
@@ -328,6 +328,7 @@
discardConfigurationElementIfNecessary();
} else {
editModelResources = Collections.EMPTY_LIST;
+ editModelExtensions = Collections.EMPTY_LIST;
}
}
}
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/integration/EditModel.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/integration/EditModel.java
index 9c385d4..2d077f9 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/integration/EditModel.java
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/integration/EditModel.java
@@ -457,7 +457,7 @@
protected void runSaveOperation(IWorkspaceRunnable runnable, IProgressMonitor monitor) throws SaveFailedException {
try {
- ResourcesPlugin.getWorkspace().run(runnable, getProject(), IWorkspace.AVOID_UPDATE, monitor);
+ ResourcesPlugin.getWorkspace().run(runnable, ResourcesPlugin.getWorkspace().getRoot(), IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
throw new SaveFailedException(e);
}
@@ -506,15 +506,18 @@
addEditModelResource(res);
}
Collection resourceExtensions = EditModelRegistry.getInstance().getEditModelExtensions(getEditModelID());
- if (resourceExtensions.isEmpty()) {
- knownResourceExtensions = Collections.EMPTY_LIST;
- } else {
+ /* bug 170690 - initialize knownResourceExtensions if necessary, and change reference from iter to it */
+ if (knownResourceExtensions == null)
+ {
+ knownResourceExtensions = new ArrayList();
+ }
+ if (!resourceExtensions.isEmpty())
+ {
knownResourceExtensions.addAll(resourceExtensions);
Iterator it = resourceExtensions.iterator();
ResourceSetWorkbenchEditSynchronizer sync = (ResourceSetWorkbenchEditSynchronizer) getEmfContext().getResourceSet().getSynchronizer();
while (it.hasNext()) {
- String extension = (String) iter.next();
- sync.enableAutoload(extension);
+ sync.enableAutoload(it.next().toString());
}
}
}
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/integration/ResourceSetWorkbenchEditSynchronizer.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/integration/ResourceSetWorkbenchEditSynchronizer.java
index 5a812e4..2c180da 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/integration/ResourceSetWorkbenchEditSynchronizer.java
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/integration/ResourceSetWorkbenchEditSynchronizer.java
@@ -34,6 +34,8 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.resource.Resource;
@@ -125,25 +127,53 @@
}
}
+ private ILock lock;
+ private static final long delay = 30;
+
+ private ILock getLock() {
+ if (lock == null)
+ lock = Platform.getJobManager().newLock();
+ return lock;
+ }
+
+ private void releaseLock() {
+ getLock().release();
+ }
+ private boolean aquireLock() throws InterruptedException{
+ return getLock().acquire(delay);
+ }
+
protected void acceptDelta(final IResourceChangeEvent event) {
- final IResourceDelta delta = event.getDelta();
-
- if (ResourcesPlugin.getWorkspace().isTreeLocked()) {
- primAcceptDelta(delta, event);
- }
- else {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- primAcceptDelta(delta, event);
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(runnable, project, IWorkspace.AVOID_UPDATE, null);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ boolean hasLocked = false;
+ try {
+ hasLocked = aquireLock();
+ } catch (InterruptedException e) {
+ Logger.getLogger().write(e);
+ }
+
+ try{
+ final IResourceDelta delta = event.getDelta();
+
+ if (ResourcesPlugin.getWorkspace().isTreeLocked()) {
+ primAcceptDelta(delta, event);
}
+ else {
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ primAcceptDelta(delta, event);
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(runnable, project, IWorkspace.AVOID_UPDATE, null);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }finally{
+ if( hasLocked )
+ releaseLock();
}
}
@@ -248,9 +278,11 @@
}
}
} else {
- /*Unload if found and is not modified.*/
+ /*Unload if found and is not modified but inconsistent.*/
+ if (resource.isLoaded() && WorkbenchResourceHelper.isReferencedResource(resource) && !WorkbenchResourceHelper.isConsistent((ReferencedResource)resource)) {
deferredUnloadResources.add(resource);
didProcess = true;
+ }
}
} else {
//Process resource as a refresh.
@@ -277,7 +309,7 @@
if (isRemove)
deferredRemoveResources.add(resource);
- else if (resource.isLoaded() && !(WorkbenchResourceHelper.isReferencedResource(resource) && WorkbenchResourceHelper.isConsistent((ReferencedResource)resource)))
+ else if (resource.isLoaded() && WorkbenchResourceHelper.isReferencedResource(resource) && !WorkbenchResourceHelper.isConsistent((ReferencedResource)resource))
deferredUnloadResources.add(resource);
}
return false;
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.frameworks.ui/META-INF/MANIFEST.MF
index a268174..af7d2cf 100644
--- a/plugins/org.eclipse.wst.common.frameworks.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.frameworks.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.wst.common.frameworks.ui; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.2.qualifier
Bundle-Activator: org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin
Bundle-Localization: plugin
Export-Package: org.eclipse.wst.common.frameworks.internal.datamodel.ui;x-internal:=true,
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/plugin.xml b/plugins/org.eclipse.wst.common.frameworks.ui/plugin.xml
index e98a3bc..f1e3ab7 100644
--- a/plugins/org.eclipse.wst.common.frameworks.ui/plugin.xml
+++ b/plugins/org.eclipse.wst.common.frameworks.ui/plugin.xml
@@ -49,5 +49,12 @@
id="org.eclipse.wst.common.frameworks.internal.operation.extension.ui.PasteActionOperation"/>
</extension>
-->
+ <extension
+ point="org.eclipse.jem.util.uiContextSensitiveClass">
+ <uiContextSensitiveClass
+ key="ISimpleValidateEditContext"
+ className="org.eclipse.wst.common.frameworks.internal.ui.SimpleValidateEditContextUI"
+ context="UI"/>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimpleValidateEditContextUI.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimpleValidateEditContextUI.java
new file mode 100644
index 0000000..1ddef36
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/SimpleValidateEditContextUI.java
@@ -0,0 +1,22 @@
+package org.eclipse.wst.common.frameworks.internal.ui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.common.frameworks.internal.ISimpleValidateEditContext;
+import org.eclipse.wst.common.frameworks.internal.SimpleValidateEditContextHeadless;
+
+public class SimpleValidateEditContextUI extends SimpleValidateEditContextHeadless implements ISimpleValidateEditContext {
+
+ protected IStatus validateEditImpl(final IFile[] filesToValidate) {
+ final IStatus [] status = new IStatus[1];
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ status[0] = ResourcesPlugin.getWorkspace().validateEdit(filesToValidate, Display.getCurrent().getActiveShell());
+ }
+ });
+ return status[0];
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.common.frameworks/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.frameworks/META-INF/MANIFEST.MF
index 162841d..a6395ac 100644
--- a/plugins/org.eclipse.wst.common.frameworks/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.frameworks/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.frameworks; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.4.qualifier
Bundle-Activator: org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin
Bundle-Vendor: %provider
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.common.frameworks/plugin.xml b/plugins/org.eclipse.wst.common.frameworks/plugin.xml
index 0f4338a..0ac2055 100644
--- a/plugins/org.eclipse.wst.common.frameworks/plugin.xml
+++ b/plugins/org.eclipse.wst.common.frameworks/plugin.xml
@@ -26,5 +26,13 @@
className="org.eclipse.wst.common.frameworks.internal.enablement.EnablementManager">
</uiContextSensitiveClass>
</extension>
+ <extension
+ point="org.eclipse.jem.util.uiContextSensitiveClass">
+ <uiContextSensitiveClass
+ key="ISimpleValidateEditContext"
+ className="org.eclipse.wst.common.frameworks.internal.SimpleValidateEditContextHeadless"
+ context="Headless">
+ </uiContextSensitiveClass>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/datamodel/IDataModelProperties.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/datamodel/IDataModelProperties.java
index 93245bc..56b04c4 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/datamodel/IDataModelProperties.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/datamodel/IDataModelProperties.java
@@ -23,13 +23,13 @@
* </p>
* <p>
* The first way to register the correct {@link IDataModelProvider} class is for
- * the interface to define a public static final Class _provider_class field
+ * the interface to define a public static Class _provider_class field
* which is set to the {@link IDataModelProvider} class, e.g.
* </p>
* <p>
* <code>public static final Class _provider_class = some.company.FooDataModelProvider.class</code>
* </p>
- * The mechanism is recommended whenever the {@link IDataModelProperties} and
+ * The above mechanism is recommended whenever the {@link IDataModelProperties} and
* {@link IDataModelProvider} classes are both defined in the same plugin scope.
* A second mechanism using the DataModelProviderExtension extension point is
* available when the {@link IDataModelProvider} class is definend outside the
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/ISimpleValidateEditContext.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/ISimpleValidateEditContext.java
new file mode 100644
index 0000000..c5ffaf9
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/ISimpleValidateEditContext.java
@@ -0,0 +1,12 @@
+package org.eclipse.wst.common.frameworks.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IStatus;
+
+public interface ISimpleValidateEditContext {
+
+ public static final String CLASS_KEY = "ISimpleValidateEditContext"; //$NON-NLS-1$
+
+ public IStatus validateEdit(IFile [] files);
+
+}
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/SimpleValidateEdit.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/SimpleValidateEdit.java
new file mode 100644
index 0000000..1dbfa40
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/SimpleValidateEdit.java
@@ -0,0 +1,29 @@
+package org.eclipse.wst.common.frameworks.internal;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jem.util.UIContextDetermination;
+
+public class SimpleValidateEdit {
+
+ /**
+ * @param files must contain only {@link IFile}s
+ * @return
+ */
+ public static boolean validateEdit(List files){
+ if(files == null || files.size() == 0){
+ return true;
+ }
+ return validateEdit( (IFile [])files.toArray(new IFile[files.size()]));
+ }
+
+ public static boolean validateEdit(IFile[] files) {
+ if(files == null || files.length == 0){
+ return true;
+ }
+ ISimpleValidateEditContext validator = (ISimpleValidateEditContext) UIContextDetermination.createInstance(ISimpleValidateEditContext.CLASS_KEY);
+ return validator.validateEdit(files).isOK();
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/SimpleValidateEditContextHeadless.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/SimpleValidateEditContextHeadless.java
new file mode 100644
index 0000000..d41d601
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/SimpleValidateEditContextHeadless.java
@@ -0,0 +1,31 @@
+package org.eclipse.wst.common.frameworks.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+
+public class SimpleValidateEditContextHeadless implements ISimpleValidateEditContext {
+
+ public IStatus validateEdit(IFile[] files) {
+ final List filesList = new ArrayList();
+ for(int i=0;i<files.length; i++){
+ if(files[i].exists() && files[i].isReadOnly()){
+ filesList.add(files[i]);
+ }
+ }
+ if(filesList.size() > 0){
+ IFile [] filesToValidate = (IFile [])filesList.toArray(new IFile[filesList.size()]);
+ return validateEditImpl(filesToValidate);
+ }
+ return IDataModelProvider.OK_STATUS;
+ }
+
+ protected IStatus validateEditImpl(IFile[] filesToValidate) {
+ return ResourcesPlugin.getWorkspace().validateEdit(filesToValidate, null);
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java
index 35ed923..7d8fc75 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java
@@ -73,6 +73,15 @@
}
/**
+ * Added to provide compatibility for the Java 1.4.2 addition of
+ * <code>Throwable.getCause()</code>.
+ * @return The nested exception held by the receiver.
+ */
+ public java.lang.Throwable getCause() {
+ return getNestedException();
+ }
+
+ /**
* Print out a stack trace to the system err.
*/
public void printStackTrace() {
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/datamodel/DataModelPausibleOperationImpl.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/datamodel/DataModelPausibleOperationImpl.java
index 154d182..bdc6e1a 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/datamodel/DataModelPausibleOperationImpl.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/datamodel/DataModelPausibleOperationImpl.java
@@ -387,6 +387,7 @@
}
} catch (Throwable e) {
this.setStatus(new Status(IStatus.ERROR, WTPCommonPlugin.PLUGIN_ID, 0, WTPResourceHandler.getString("25", new Object[]{operation.getClass().getName()}), e)); //$NON-NLS-1$
+ WTPCommonPlugin.getDefault().getLogger().logError(e);
}
}
};
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/enablement/EnablementManager.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/enablement/EnablementManager.java
index 5494844..4f49608 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/enablement/EnablementManager.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/enablement/EnablementManager.java
@@ -64,19 +64,23 @@
if (project != null && !project.isAccessible()) project = null;
EnablementIdentifier identifier = null;
+ boolean identifierRequiresUpdate = false;
synchronized(this) {
Map identifiersById = getIdentifiersById(project);
-
identifier = (EnablementIdentifier) identifiersById.get(identifierId);
-
- if (identifier == null) {
- identifier = createIdentifier(identifierId, project);
- updateIdentifier(identifier);
+ if(identifier == null){
+ identifierRequiresUpdate = true;
+ identifier = createIdentifier(identifierId, project);
identifiersById.put(identifierId, identifier);
}
+ }
+
+ synchronized (identifier){
+ if(identifierRequiresUpdate){
+ updateIdentifier(identifier);
+ }
+ return identifier;
}
-
- return identifier;
}
protected EnablementIdentifier createIdentifier(String identifierId, IProject project) {
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationDataModelProviderNew.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationDataModelProviderNew.java
index 4cd1cd1..08147d0 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationDataModelProviderNew.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationDataModelProviderNew.java
@@ -148,7 +148,7 @@
* @param projectLoc
* @todo Generated comment
*/
- private IStatus validateExisting(String projectName, String projectLoc) {
+ public static IStatus validateExisting(String projectName, String projectLoc) {
if (projectName != null && !projectName.equals("")) {//$NON-NLS-1$
File file = new File(projectLoc);
if (file.exists()) {
diff --git a/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
index 289e90c..b34d92c 100644
--- a/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: Modulecore Plug-in
Bundle-Vendor: %provider
Bundle-SymbolicName: org.eclipse.wst.common.modulecore; singleton:=true
-Bundle-Version: 1.1.2.qualifier
+Bundle-Version: 1.1.54.qualifier
Bundle-Activator: org.eclipse.wst.common.componentcore.internal.ModulecorePlugin
Bundle-Localization: plugin
Export-Package: org.eclipse.wst.common.componentcore,
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ModuleCoreNature.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ModuleCoreNature.java
index d506bc5..017920f 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ModuleCoreNature.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ModuleCoreNature.java
@@ -340,20 +340,22 @@
try {
IProject aProject = StructureEdit.getContainingProject(aModuleURI);
IFacetedProject facetedProject = ProjectFacetsManager.create(aProject);
- String[] editModelIDs = EditModelRegistry.getInstance().getRegisteredEditModelIDs();
- for (int i=0; i<editModelIDs.length; i++) {
- try {
- IProjectFacet facet = ProjectFacetsManager.getProjectFacet(editModelIDs[i]);
- if (facet != null && facetedProject.hasProjectFacet(facet)) {
- ArtifactEditModel editModel = (ArtifactEditModel) getEditModelForRead(editModelIDs[i], anAccessorKey, params);
- if (editModel !=null)
- return editModel;
+ if (facetedProject != null) {
+ String[] editModelIDs = EditModelRegistry.getInstance().getRegisteredEditModelIDs();
+ for (int i=0; i<editModelIDs.length; i++) {
+ try {
+ IProjectFacet facet = ProjectFacetsManager.getProjectFacet(editModelIDs[i]);
+ if (facet != null && facetedProject.hasProjectFacet(facet)) {
+ ArtifactEditModel editModel = (ArtifactEditModel) getEditModelForRead(editModelIDs[i], anAccessorKey, params);
+ if (editModel !=null)
+ return editModel;
+ }
+ } catch (IllegalArgumentException e) {
+ // Ignore exceptions that come from ProjectFacetsManager
+ continue;
+ } catch (Exception e) {
+ ModulecorePlugin.logError(Status.ERROR, ModuleCoreMessages.Acquiring_ArtifactEdit_For_Read_Exception, e);
}
- } catch (IllegalArgumentException e) {
- // Ignore exceptions that come from ProjectFacetsManager
- continue;
- } catch (Exception e) {
- ModulecorePlugin.logError(Status.ERROR, ModuleCoreMessages.Acquiring_ArtifactEdit_For_Read_Exception, e);
}
}
} catch (Exception e){
@@ -440,20 +442,22 @@
try {
IProject aProject = StructureEdit.getContainingProject(aModuleURI);
IFacetedProject facetedProject = ProjectFacetsManager.create(aProject);
- String[] editModelIDs = EditModelRegistry.getInstance().getRegisteredEditModelIDs();
- for (int i=0; i<editModelIDs.length; i++) {
- try {
- IProjectFacet facet = ProjectFacetsManager.getProjectFacet(editModelIDs[i]);
- if (facet != null && facetedProject.hasProjectFacet(facet)) {
- ArtifactEditModel editModel = (ArtifactEditModel) getEditModelForWrite(editModelIDs[i], anAccessorKey, params);
- if (editModel !=null)
- return editModel;
+ if (facetedProject != null) {
+ String[] editModelIDs = EditModelRegistry.getInstance().getRegisteredEditModelIDs();
+ for (int i=0; i<editModelIDs.length; i++) {
+ try {
+ IProjectFacet facet = ProjectFacetsManager.getProjectFacet(editModelIDs[i]);
+ if (facet != null && facetedProject.hasProjectFacet(facet)) {
+ ArtifactEditModel editModel = (ArtifactEditModel) getEditModelForWrite(editModelIDs[i], anAccessorKey, params);
+ if (editModel !=null)
+ return editModel;
+ }
+ } catch (IllegalArgumentException e) {
+ // Ignore exceptions that come from ProjectFacetsManager
+ continue;
+ } catch (Exception e) {
+ ModulecorePlugin.logError(Status.ERROR, ModuleCoreMessages.Acquiring_ArtifactEdit_For_Write_Exception, e);
}
- } catch (IllegalArgumentException e) {
- // Ignore exceptions that come from ProjectFacetsManager
- continue;
- } catch (Exception e) {
- ModulecorePlugin.logError(Status.ERROR, ModuleCoreMessages.Acquiring_ArtifactEdit_For_Write_Exception, e);
}
}
} catch (Exception e){
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleCoreValidator.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleCoreValidator.java
index b6767ba..556f612 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleCoreValidator.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleCoreValidator.java
@@ -5,14 +5,12 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.internal.impl.WTPModulesResource;
import org.eclipse.wst.common.internal.emf.resource.TranslatorResource;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
import org.eclipse.wst.common.project.facet.core.internal.FacetedProjectNature;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.core.ValidationException;
@@ -31,24 +29,23 @@
}
public Resource getPrimaryResource(IProject project) {
- // Overriden to handle loading the .component resource in new and old forms
- // First will try to load from .settings/org.eclipse.wst.common.component
- // Second will try to load from the old location(s) .settings/.component or .component
-
- URI uri = (URI) URI.createURI(StructureEdit.MODULE_META_FILE_NAME);
- WTPModulesResource res = (WTPModulesResource)WorkbenchResourceHelper.getOrCreateResource(uri, getResourceSet(project));
- if (res == null || !res.isLoaded()) {
- uri = (URI) URI.createURI(".settings/.component");
- res = (WTPModulesResource)WorkbenchResourceHelper.getOrCreateResource(uri, getResourceSet(project));
- if (res == null || !res.isLoaded()) {
- uri = (URI) URI.createURI(".wtpmodules");
- res = (WTPModulesResource)WorkbenchResourceHelper.getOrCreateResource(uri, getResourceSet(project));
- if (res == null || !res.isLoaded()) {
- res = null;
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=181334; Changing this method to call ModuleStructuralModel.getPrimaryResource() method instead.
+ // This does two things:
+ // 1. Reorders the locks to prevent deadlock between locking the resource (Bugzilla 181334),
+ // then the edit model and
+ // 2. Reuses code. (The code between this method and MSM.getPrimaryResource() is identical.
+ StructureEdit structureEdit = StructureEdit.getStructureEditForRead(project);
+ if (structureEdit != null) {
+ ModuleStructuralModel structuralModel = structureEdit.getModuleStructuralModel();
+ if (structuralModel != null) {
+ // acquiring the ModuleStructuralModel lock here first because the call to getPrimaryResource()
+ // will cause this lock to be acquired later resulting in a potential deadlock
+ synchronized (structuralModel) {
+ return structuralModel.getPrimaryResource();
}
}
}
- return res;
+ return null;
}
private ResourceSet getResourceSet(IProject proj) {
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleMigratorManager.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleMigratorManager.java
index 8f74f93..51558ab 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleMigratorManager.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleMigratorManager.java
@@ -38,7 +38,6 @@
private static HashMap managerCache = new HashMap();
private static HashSet migrated = new HashSet();
private boolean migrating;
- private HashSet moved = new HashSet();
public ModuleMigratorManager() {
super();
}
@@ -74,9 +73,8 @@
try {
if (aProj.isAccessible() && ModuleCoreNature.isFlexibleProject(aProj)) {
if (aProj.findMember(".wtpmodules") != null) {
- if (!moved.contains(aProj))
- moveOldMetaDataFile(aProj);
- } else moved.add(aProj);
+ moveOldMetaDataFile(aProj);
+ }
if (needsComponentMigration(aProj,multiComps))
migrateComponentsIfNecessary(aProj,multiComps);
}
@@ -119,13 +117,11 @@
private void moveOldMetaDataFile(IProject project) {
try {
- if (!moved.contains(project))
- moveMetaDataFile(project);
+ moveMetaDataFile(project);
IFolder depFolder = project.getFolder(".deployables");
if (depFolder.exists())
depFolder.delete(true, null);
project.refreshLocal(IResource.DEPTH_INFINITE, null);
- moved.add(project);
} catch (Exception e) {
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleStructuralModel.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleStructuralModel.java
index ba98703..75b0fdd 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleStructuralModel.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModuleStructuralModel.java
@@ -18,15 +18,21 @@
import java.util.List;
import java.util.Map;
+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.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
@@ -73,6 +79,8 @@
*/
public class ModuleStructuralModel extends EditModel implements IAdaptable {
+ private static final String R0_7_MODULE_META_FILE_NAME = ".component";
+ private static final String R1_MODULE_META_FILE_NAME = ".settings/.component";
public static final String MODULE_CORE_ID = "moduleCoreId"; //$NON-NLS-1$
private static final String PROJECT_VERSION_1_5 = "1.5.0";
private boolean useOldFormat = false;
@@ -140,23 +148,68 @@
* @param wbComp
*/
public void cleanupWTPModules(WorkbenchComponent wbComp) {
- ModuleStructuralModel model = new ModuleStructuralModel(getEditModelID(),getEmfContext(),false);
- if (wbComp == null || model == null)
+ if (wbComp == null)
return;
- try {
- model.access(this);
- ResourceTreeRoot root = ResourceTreeRoot.getSourceResourceTreeRoot(wbComp);
- List rootResources = getModuleResources(root);
- // Only if we need to do a clean, do we clear, add all required root resource mappings, and save
- if (!(wbComp.getResources().containsAll(rootResources) && wbComp.getResources().size()==rootResources.size())) {
+ ResourceTreeRoot root = ResourceTreeRoot.getSourceResourceTreeRoot(wbComp);
+ List rootResources = getModuleResources(root);
+ // Only if we need to do a clean, do we clear, add all required root resource mappings, and save
+ if (!(wbComp.getResources().containsAll(rootResources) && wbComp.getResources().size()==rootResources.size())) {
+ final ModuleStructuralModel model = new ModuleStructuralModel(getEditModelID(),getEmfContext(),false);
+ if(model == null){
+ return;
+ }
+ boolean jobScheduled = false;
+ try {
+ final Object key = new Object();
+ model.access(key);
+
wbComp.getResources().clear();
wbComp.getResources().addAll(rootResources);
- model.save(this);
+ URI uri = wbComp.eResource().getURI();
+ //need to get this resource into the model
+ Resource resource = model.getResource(uri);
+ //need to manually dirty this resource in order for it to save.
+ resource.setModified(true);
+ //this job is necessary to avoid the deadlock in
+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=181253
+ class SaveJob extends Job {
+
+ public SaveJob() {
+ super("Save ModuleStructuralModel Job");
+ }
+
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ model.save(key);
+ return OK_STATUS;
+ } finally {
+ disposeOnce();
+ }
+ }
+
+ private boolean disposedAlready = false;
+
+ public void disposeOnce(){
+ if(!disposedAlready){
+ disposedAlready = true;
+ model.dispose();
+ }
+ }
+ };
+ final SaveJob saveJob = new SaveJob();
+ saveJob.addJobChangeListener(new JobChangeAdapter(){
+ public void done(IJobChangeEvent event) {
+ saveJob.disposeOnce();
+ }
+ });
+ saveJob.setSystem(true);
+ saveJob.schedule();
+ jobScheduled = true;
+ } finally {
+ if (!jobScheduled && model != null)
+ model.dispose();
}
- } finally {
- if (model != null)
- model.dispose();
- }
+ }
}
/**
@@ -182,6 +235,10 @@
}
public Resource prepareProjectModulesIfNecessary() throws CoreException {
XMIResource res;
+ if (!isComponentSynchronizedOrNull()) {
+ //Return if component file is out of sync from workspace
+ return null;
+ }
res = (XMIResource) getPrimaryResource();
if (res != null && resNeedsMigrating(res) && !useOldFormat)
return null;
@@ -195,6 +252,27 @@
return res;
}
+ /**
+ * This methods checks the status of the component file, and first checks for existance, then if its locally synchronized
+ * @return boolean
+ */
+ private boolean isComponentSynchronizedOrNull() {
+ IFile componentFile = getProject().getFile(StructureEdit.MODULE_META_FILE_NAME);
+ IPath componentFileLocation = componentFile.getLocation();
+ if (componentFileLocation != null && !componentFileLocation.toFile().exists()) {
+ componentFile = getProject().getFile(R1_MODULE_META_FILE_NAME);
+ componentFileLocation = componentFile.getLocation();
+ if (componentFileLocation != null && !componentFileLocation.toFile().exists()) {
+ componentFile = getProject().getFile(R0_7_MODULE_META_FILE_NAME);
+ componentFileLocation = componentFile.getLocation();
+ if (componentFileLocation != null && !componentFileLocation.toFile().exists())
+ return true;
+ }
+ }
+ if (componentFileLocation == null)
+ return true;
+ else return componentFile.isSynchronized(IResource.DEPTH_ZERO);
+ }
public WTPModulesResource makeWTPModulesResource() {
return (WTPModulesResource) createResource(WTPModulesResourceFactory.WTP_MODULES_URI_OBJ);
}
@@ -221,16 +299,16 @@
// Overriden to handle loading the .component resource in new and old forms
// First will try to load from .settings/org.eclipse.wst.common.component
// Second will try to load from the old location(s) .settings/.component or .component
-
+
URI uri = (URI) URI.createURI(StructureEdit.MODULE_META_FILE_NAME);
WTPModulesResource res = (WTPModulesResource)getResource(uri);
if (res == null || !res.isLoaded()) {
removeResource(res);
- uri = (URI) URI.createURI(".settings/.component");
+ uri = (URI) URI.createURI(R1_MODULE_META_FILE_NAME);
res = (WTPModulesResource)getResource(uri);
if (res == null || !res.isLoaded()) {
removeResource(res);
- uri = (URI) URI.createURI(".component");
+ uri = (URI) URI.createURI(R0_7_MODULE_META_FILE_NAME);
res = (WTPModulesResource)getResource(uri);
if (res == null || !res.isLoaded()) {
removeResource(res);
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/StructureEdit.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/StructureEdit.java
index daf6ab0..27586f6 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/StructureEdit.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/StructureEdit.java
@@ -26,6 +26,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jem.util.UIContextDetermination;
@@ -42,6 +43,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
import org.eclipse.wst.common.internal.emf.utilities.ExtendedEcoreUtil;
+import org.eclipse.wst.common.internal.emfworkbench.edit.EMFWorkbenchEditContextFactory;
import org.eclipse.wst.common.internal.emfworkbench.validateedit.IValidateEditContext;
/**
@@ -438,8 +440,21 @@
*/
public ProjectComponents getComponentModelRoot() {
ProjectComponents comps = null;
- if (!structuralModel.isDisposed())
- comps = (ProjectComponents) structuralModel.getPrimaryRootObject();
+ ILock lock = EMFWorkbenchEditContextFactory.getProjectLockObject(structuralModel.getProject());
+ try{
+ if(null != lock){
+ lock.acquire();
+ }
+ synchronized(structuralModel){
+ if (!structuralModel.isDisposed())
+ comps = (ProjectComponents) structuralModel.getPrimaryRootObject();
+ }
+ } finally{
+ if(null != lock){
+ lock.release();
+ }
+ }
+
return comps;
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/builder/DependencyGraphManager.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/builder/DependencyGraphManager.java
index 42e498a..3d95164 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/builder/DependencyGraphManager.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/builder/DependencyGraphManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -46,6 +47,7 @@
private static final String MANIFEST_URI = "META-INF/MANIFEST.MF";
private HashMap wtpModuleTimeStamps = null;
private HashMap manifestTimeStamps = null;
+ private long modStamp = System.currentTimeMillis();
private DependencyGraphManager() {
super();
@@ -58,26 +60,39 @@
}
public void construct(IProject project) {
- if (project!=null && project.isAccessible() && project.findMember(IModuleConstants.COMPONENT_FILE_PATH) !=null) //$NON-NLS-1$
+ if (project!=null && project.isAccessible() && getComponentFile(project) !=null) //$NON-NLS-1$
constructIfNecessary();
}
+
+ private IResource getComponentFile(IProject project) {
+ IResource componentFile = project.findMember(IModuleConstants.COMPONENT_FILE_PATH);
+ if (componentFile == null)
+ componentFile = project.findMember(IModuleConstants.R1_MODULE_META_FILE_PATH);
+ return componentFile;
+
+ }
private void constructIfNecessary() {
- if (moduleTimeStampsChanged() || manifestTimeStampsChanged())
+ if (metadataChanged()) {
buildDependencyGraph();
+ }
+ }
+
+ private boolean metadataChanged() {
+ return moduleTimeStampsChanged() || manifestTimeStampsChanged();
}
private boolean manifestTimeStampsChanged() {
HashMap workspaceTimeStamps = collectManifestTimeStamps();
- if (getManifestTimeStamps().equals(workspaceTimeStamps))
+ if (timestampsMatch(getManifestTimeStamps(),workspaceTimeStamps))
return false;
return true;
}
private HashMap getManifestTimeStamps() {
- if (wtpModuleTimeStamps == null)
- wtpModuleTimeStamps = new HashMap();
- return wtpModuleTimeStamps;
+ if (manifestTimeStamps == null)
+ manifestTimeStamps = new HashMap();
+ return manifestTimeStamps;
}
private HashMap collectManifestTimeStamps() {
@@ -88,8 +103,8 @@
if (projects[i]==null || !projects[i].isAccessible())
continue;
manifestFile = getTimeStampFile(projects[i]);
- if (manifestFile != null) {
- Long currentTimeStamp = new Long(manifestFile.getLocalTimeStamp());
+ if (manifestFile != null && manifestFile.exists() && ComponentCore.createComponent(projects[i]) != null) {
+ Long currentTimeStamp = new Long(manifestFile.getModificationStamp());
timeStamps.put(projects[i],currentTimeStamp);
}
}
@@ -122,10 +137,15 @@
private boolean moduleTimeStampsChanged() {
HashMap workspaceTimeStamps = collectModuleTimeStamps();
- if (getWtpModuleTimeStamps().equals(workspaceTimeStamps))
+ if (timestampsMatch(getWtpModuleTimeStamps(),workspaceTimeStamps))
return false;
return true;
}
+
+ private boolean timestampsMatch(HashMap savedTimeStamps, HashMap workspaceTimeStamps) {
+ return savedTimeStamps.equals(workspaceTimeStamps);
+
+ }
private HashMap collectModuleTimeStamps() {
HashMap timeStamps = new HashMap();
@@ -133,9 +153,9 @@
for (int i=0; i<projects.length; i++) {
if (projects[i]==null || !projects[i].isAccessible())
continue;
- IResource wtpModulesFile = projects[i].findMember(IModuleConstants.COMPONENT_FILE_PATH); //$NON-NLS-1$
- if (wtpModulesFile != null) {
- Long currentTimeStamp = new Long(wtpModulesFile.getLocalTimeStamp());
+ IResource wtpModulesFile = getComponentFile(projects[i]); //$NON-NLS-1$
+ if (wtpModulesFile != null && wtpModulesFile.exists() && ComponentCore.createComponent(projects[i]) != null) {
+ Long currentTimeStamp = new Long(wtpModulesFile.getModificationStamp());
timeStamps.put(projects[i],currentTimeStamp);
}
}
@@ -145,28 +165,31 @@
private void buildDependencyGraph() {
// Process and collect dependency references to add
List referencesToAdd = new ArrayList();
+ List componentProjects = new ArrayList();
IProject[] projects = ProjectUtilities.getAllProjects();
+
for (int k=0; k<projects.length; k++) {
- if (!projects[k].isAccessible() || projects[k].findMember(IModuleConstants.COMPONENT_FILE_PATH)==null)
+ if (!projects[k].isAccessible() || getComponentFile(projects[k])==null)
continue;
IVirtualComponent component= ComponentCore.createComponent(projects[k]);
if (component == null) continue;
referencesToAdd.addAll(getDependencyReferences(component));
+ componentProjects.add(projects[k]);
}
- //Update the actual graph and block other threads here
+ //Update the actual graph/timestamps and block other threads here
synchronized (this) {
- List timeStampsUpdated = new ArrayList();
cleanDependencyGraph();
+ for (Iterator iter = componentProjects.iterator(); iter.hasNext();) {
+ IProject proj = (IProject) iter.next();
+ //For All projects (regardless if involved in references), update timestamps
+ addTimeStamp(proj);
+ }
for (int i=0; i<referencesToAdd.size(); i++) {
DependencyReference ref = (DependencyReference) referencesToAdd.get(i);
if (ref.targetProject == null || ref.componentProject == null || ref.targetProject.equals(ref.componentProject))
continue;
DependencyGraph.getInstance().addReference(ref.targetProject,ref.componentProject);
- if (!timeStampsUpdated.contains(ref.componentProject)) {
- addTimeStamp(ref.componentProject);
- timeStampsUpdated.add(ref.componentProject);
- }
}
}
}
@@ -187,16 +210,17 @@
private boolean addTimeStamp(IProject project) {
// Get the .component file for the given project
- IResource wtpModulesFile = project.findMember(IModuleConstants.COMPONENT_FILE_PATH);
+ IResource wtpModulesFile = getComponentFile(project);
if (wtpModulesFile==null)
return false;
- Long currentTimeStamp = new Long(wtpModulesFile.getLocalTimeStamp());
+ Long currentTimeStamp = new Long(wtpModulesFile.getModificationStamp());
getWtpModuleTimeStamps().put(project,currentTimeStamp);
// Get the MANIFEST file for the given project
IResource manifestFile = getTimeStampFile(project);
if (manifestFile==null)
return false;
+ currentTimeStamp = new Long(manifestFile.getModificationStamp());
getManifestTimeStamps().put(project,currentTimeStamp);
return true;
}
@@ -205,6 +229,7 @@
DependencyGraph.getInstance().clear();
getWtpModuleTimeStamps().clear();
getManifestTimeStamps().clear();
+ setModStamp(System.currentTimeMillis());
}
/**
@@ -231,4 +256,18 @@
public void forceRefresh() {
buildDependencyGraph();
}
+
+
+ public long getModStamp() {
+ return modStamp;
+ }
+
+
+ private void setModStamp(long modStamp) {
+ this.modStamp = modStamp;
+ }
+
+ public boolean checkIfStillValid(long timeStamp) {
+ return (getModStamp() == timeStamp && !metadataChanged());
+ }
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentCoreURIConverter.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentCoreURIConverter.java
index 217de91..f8582be 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentCoreURIConverter.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentCoreURIConverter.java
@@ -11,7 +11,9 @@
package org.eclipse.wst.common.componentcore.internal.impl;
import java.io.IOException;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -122,11 +124,17 @@
if (aFile != null) {
IVirtualComponent component = ComponentCore.createComponent(getContainingProject());
+
if (component != null) {
IProject fileProject = getContainingProject();
- //If it is not in the same project then just return the URI as is.
- if (resourceSetSynchronizer.getProject() == fileProject)
- return getArchiveRelativeURI(aFile,component.getRootFolder().getUnderlyingFolder());
+
+ if (resourceSetSynchronizer.getProject() == fileProject){
+ List list = Arrays.asList(component.getRootFolder().getUnderlyingFolders());
+ IPath path = WorkbenchResourceHelperBase.getPathFromContainers(list, aFile.getFullPath());
+ if (path != null)
+ return URI.createURI(path.toString());
+ return null;
+ }
} else
return super.deNormalize(uri);
}
@@ -148,6 +156,7 @@
}
+
protected IProject getContainingProject() {
return containingProject;
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeNode.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeNode.java
index 3a89977..1baafac 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeNode.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeNode.java
@@ -11,8 +11,8 @@
package org.eclipse.wst.common.componentcore.internal.impl;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -47,9 +47,9 @@
*/
public static final int CREATE_RESOURCE_ALWAYS = 0x2;
- private final Set moduleResources = Collections.synchronizedSet(new HashSet());
- private final Map children = Collections.synchronizedMap(new HashMap());
- private final Map transientChildResources = Collections.synchronizedMap(new HashMap());
+ private final Set moduleResources = Collections.synchronizedSet(new LinkedHashSet());
+ private final Map children = Collections.synchronizedMap(new LinkedHashMap());
+ private final Map transientChildResources = Collections.synchronizedMap(new LinkedHashMap());
private static final ComponentResource[] NO_MODULE_RESOURCES = new ComponentResource[]{};
private IPathProvider pathProvider;
// private ResourceTreeNode parent;
@@ -170,13 +170,13 @@
private Set findModuleResourcesSet(IPath aFullPath, IPath aPath, int creationFlags) {
if (aPath.segmentCount() == 0) {
- Set resources = aggregateResources(new HashSet());
+ Set resources = aggregateResources(new LinkedHashSet());
return resources;
}
ResourceTreeNode child = findChild(aPath.segment(0), creationFlags);
if (child == null)
return findMatchingVirtualPathsSet(aFullPath, aPath, creationFlags);
- Set foundResources = new HashSet();
+ Set foundResources = new LinkedHashSet();
foundResources.addAll(child.findModuleResourcesSet(aFullPath, aPath.removeFirstSegments(1), creationFlags));
foundResources.addAll(findMatchingVirtualPathsSet(aFullPath, aPath, creationFlags));
return foundResources;
@@ -188,7 +188,7 @@
ComponentResource moduleResource = null;
IResource eclipseResource = null;
IContainer eclipseContainer = null;
- Set resultSet = new HashSet();
+ Set resultSet = new LinkedHashSet();
for (Iterator resourceIter = moduleResources.iterator(); resourceIter.hasNext();) {
moduleResource = (ComponentResource) resourceIter.next();
if(moduleResource.getRuntimePath() != null && moduleResource.eResource() != null) {
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeRootAdapter.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeRootAdapter.java
index 1e6dd7d..eee6cce 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeRootAdapter.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ResourceTreeRootAdapter.java
@@ -62,5 +62,10 @@
}
return resourceTreeRoot;
}
+
+ public void setResourceTreeRoot(ResourceTreeRoot r){
+
+ resourceTreeRoot = r;
+ }
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
index 407d303..940ca63 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: WorkbenchComponentImpl.java,v 1.13 2006/07/21 18:36:56 cbridgha Exp $
+ * $Id: WorkbenchComponentImpl.java,v 1.12.2.1 2006/09/28 17:01:20 cbridgha Exp $
*/
package org.eclipse.wst.common.componentcore.internal.impl;
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/FacetProjectCreationOperation.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/FacetProjectCreationOperation.java
index 31e3bb4..5873c52 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/FacetProjectCreationOperation.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/operation/FacetProjectCreationOperation.java
@@ -26,11 +26,9 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationPropertiesNew;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
@@ -115,16 +113,12 @@
return OK_STATUS;
}
- private void addDefaultFacets(IFacetedProject facetProj, Set defaultFacets) {
+ private static void addDefaultFacets(IFacetedProject facetProj, Set defaultFacets) {
Set actions = new HashSet();
for (Iterator iter = defaultFacets.iterator(); iter.hasNext();) {
IProjectFacetVersion facetVersion = (IProjectFacetVersion) iter.next();
if (!facetProj.hasProjectFacet(facetVersion.getProjectFacet())) {
- IDataModel dm = DataModelFactory.createDataModel(new FacetInstallDataModelProvider());
- dm.setProperty(IFacetDataModelProperties.FACET_ID, facetVersion.getProjectFacet().getId());
- dm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, facetProj.getProject().getName());
- dm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, facetVersion.getVersionString());
- actions.add(new IFacetedProject.Action(Action.Type.INSTALL, facetVersion, dm));
+ actions.add(new IFacetedProject.Action(Action.Type.INSTALL, facetVersion, null));
}
}
@@ -154,52 +148,11 @@
}
return facetProj;
}
-
- private static void addDefaultFacetsInProject(IFacetedProject facetProj, Set defaultFacets) {
- Set actions = new HashSet();
- for (Iterator iter = defaultFacets.iterator(); iter.hasNext();) {
- IProjectFacetVersion facetVersion = (IProjectFacetVersion) iter.next();
- if (!facetProj.hasProjectFacet(facetVersion.getProjectFacet())) {
- IDataModel dm = DataModelFactory.createDataModel(new FacetInstallDataModelProvider());
- dm.setProperty(IFacetDataModelProperties.FACET_ID, facetVersion.getProjectFacet().getId());
- dm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, facetProj.getProject().getName());
- dm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, facetVersion.getVersionString());
- actions.add(new IFacetedProject.Action(Action.Type.INSTALL, facetVersion, dm));
- }
- }
-
- try {
- if (!actions.isEmpty())
- facetProj.modify(actions, null);
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
- }
- }
-
+
public static void addDefaultFactets(IFacetedProject facetProj, IRuntime runtime) throws ExecutionException {
-
- Set fixedFacets = new HashSet(), newFacetVersions = facetProj.getProjectFacets(), existingFixedFacets = facetProj.getFixedProjectFacets();
- for (Iterator iter = newFacetVersions.iterator(); iter.hasNext();) {
- IProjectFacetVersion facetVersion = (IProjectFacetVersion) iter.next();
- String facetID = facetVersion.getProjectFacet().getId();
- boolean shouldInstallFacet = true;
- for (Iterator existingFacetsIterator = existingFixedFacets.iterator(); shouldInstallFacet && existingFacetsIterator.hasNext();) {
- IProjectFacet facet = (IProjectFacet) existingFacetsIterator.next();
- if (facet.getId().equals(facetID)) {
- shouldInstallFacet = false;
- }
- }
- if (shouldInstallFacet) {
- fixedFacets.add(facetVersion.getProjectFacet());
- }
- }
-
try {
- fixedFacets.addAll(facetProj.getFixedProjectFacets());
- facetProj.setFixedProjectFacets(fixedFacets);
-
if (runtime != null) {
- addDefaultFacetsInProject(facetProj, runtime.getDefaultFacets(fixedFacets));
+ addDefaultFacets(facetProj, runtime.getDefaultFacets(facetProj.getFixedProjectFacets()));
}
} catch (CoreException e) {
Logger.getLogger().logError(e);
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
index b0008a4..0e5410a 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
@@ -110,9 +110,11 @@
}
public IPath getWorkspaceRelativePath() {
- IFile aFile = ResourcesPlugin.getWorkspace().getRoot().getFile(archivePath);
- if (aFile.exists())
- return aFile.getFullPath();
+ if( archivePath.segmentCount() > 1 ){
+ IFile aFile = ResourcesPlugin.getWorkspace().getRoot().getFile(archivePath);
+ if (aFile.exists())
+ return aFile.getFullPath();
+ }
return null;
}
@@ -239,9 +241,11 @@
if(file.exists())
loc = file.getLocation();
else {
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(archivePath);
- if(file.exists())
- loc = file.getLocation();
+ if( archivePath.segmentCount() >= 2 ){
+ file = ResourcesPlugin.getWorkspace().getRoot().getFile(archivePath);
+ if(file.exists())
+ loc = file.getLocation();
+ }
}
// this is a file on the local filesystem
if(loc != null)
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
index 4ef1934..a196265 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.common.componentcore.ComponentCore;
@@ -27,6 +28,7 @@
import org.eclipse.wst.common.componentcore.internal.ComponentcoreFactory;
import org.eclipse.wst.common.componentcore.internal.ComponentcorePackage;
import org.eclipse.wst.common.componentcore.internal.DependencyType;
+import org.eclipse.wst.common.componentcore.internal.ModulecorePlugin;
import org.eclipse.wst.common.componentcore.internal.Property;
import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
import org.eclipse.wst.common.componentcore.internal.StructureEdit;
@@ -105,7 +107,15 @@
List propList = component.getProperties();
if(propList != null) {
for (int i = 0; i < propList.size(); i++) {
- props.setProperty(((Property)propList.get(i)).getName(), ((Property)propList.get(i)).getValue());
+ Property property = (Property)propList.get(i);
+ String name = property.getName();
+ String value = property.getValue();
+ if(value == null){
+ value = ""; //$NON-NLS-1$
+ String message = "WARNING: The component file in "+getProject().getName()+" has no value defined for the property: "+name; //$NON-NLS-1$//$NON-NLS-2$
+ ModulecorePlugin.getDefault().logError(IStatus.ERROR, message, null);
+ }
+ props.setProperty(name, value);
}
}
return props;
@@ -328,8 +338,9 @@
if (referencedComponent==null)
continue;
IVirtualReference vReference = StructureEdit.createVirtualReference(this, referencedComponent);
- if (vReference == null || vReference.getReferencedComponent() == null || !vReference.getReferencedComponent().exists())
- component.getReferencedComponents().remove(referencedComponent);
+ if (vReference == null || vReference.getReferencedComponent() == null || !vReference.getReferencedComponent().exists()){
+ iter.remove();
+ }
}
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentResolver.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentResolver.java
index 8580398..f480993 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentResolver.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentResolver.java
@@ -13,6 +13,7 @@
import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import org.eclipse.core.resources.IFile;
@@ -144,6 +145,20 @@
// Continue resolving
}
+ /* Check for a URI without a scheme, but with a host */
+ try
+ {
+ URI uri = new URI(systemId);
+ if ((uri.getScheme() == null) && (uri.getHost() != null))
+ {
+ return null;
+ }
+ }
+ catch (URISyntaxException use)
+ {
+ // do nothing- we need to check to see if this is a local file
+ }
+
/* Check for a system file name as the system reference. */
IPath systemPath = new Path(systemId);
if (systemPath.toFile().exists()) {
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/EclipseResourceAdapter.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/EclipseResourceAdapter.java
index 9ca6d48..95f6623 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/EclipseResourceAdapter.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/EclipseResourceAdapter.java
@@ -29,8 +29,7 @@
public class EclipseResourceAdapter extends AdapterImpl implements Adapter {
public static final Class ADAPTER_TYPE = EclipseResourceAdapter.class;
- private IResource resource;
- private boolean hasSearchFailed = false;
+ private IResource resource;
/*
* (non-Javadoc)
@@ -41,17 +40,16 @@
if (aNotification.getFeature() == ComponentcorePackage.eINSTANCE.getComponentResource_SourcePath()) {
if (aNotification.getEventType() == Notification.SET) {
resource = null;
- hasSearchFailed = false;
+
}
}
}
- public IResource getEclipseResource() {
- IProject container = null;
- if (resource != null || hasSearchFailed)
- return resource;
+ public IResource getEclipseResource() {
synchronized (this) {
if (resource == null) {
+
+ IProject container = null;
ComponentResource moduleResource = (ComponentResource) getTarget();
IPath sourcePath = moduleResource.getSourcePath();
if (moduleResource.getOwningProject() != null)
@@ -61,9 +59,7 @@
if (container != null)
resource = container.findMember(sourcePath);
if(resource == null)
- resource = ResourcesPlugin.getWorkspace().getRoot().findMember(sourcePath);
-
- hasSearchFailed = resource == null;
+ resource = ResourcesPlugin.getWorkspace().getRoot().findMember(sourcePath);
}
}
return resource;
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/IModuleConstants.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/IModuleConstants.java
index a124150..e6b2a70 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/IModuleConstants.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/IModuleConstants.java
@@ -25,6 +25,7 @@
public final static String COMPONENT_FILE_NAME = ".component"; //$NON-NLS-1$
public final static Path COMPONENT_FILE_PATH = new Path(StructureEdit.MODULE_META_FILE_NAME);
public final static String WTPMODULE_FILE_NAME = ".wtpmodules"; //$NON-NLS-1$
+ public final static Path R1_MODULE_META_FILE_PATH = new Path(".settings/.component"); //$NON-NLS-1$
public final static Path WTPMODULE_FILE_PATH = new Path(WTPMODULE_FILE_NAME);
public final static String MODULE_PLUG_IN_ID = "org.eclipse.wst.common.modulecore"; //$NON-NLS-1$
public final static String MODULE_NATURE_ID = "org.eclipse.wst.common.modulecore.ModuleCoreNature"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.wst.common.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.ui/META-INF/MANIFEST.MF
index 43d2713..b558bdd 100644
--- a/plugins/org.eclipse.wst.common.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.ui; singleton:=true
-Bundle-Version: 1.1.100.qualifier
+Bundle-Version: 1.1.101.qualifier
Bundle-Activator: org.eclipse.wst.common.ui.internal.UIPlugin
Bundle-Vendor: %pluginProvider
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.common.ui/build.properties b/plugins/org.eclipse.wst.common.ui/build.properties
index 450648e..b56a866 100644
--- a/plugins/org.eclipse.wst.common.ui/build.properties
+++ b/plugins/org.eclipse.wst.common.ui/build.properties
@@ -2,7 +2,8 @@
plugin.xml,\
.,\
META-INF/,\
- about.html
+ about.html,\
+ icons/
jars.compile.order = .
source.. = src/,\
src-search/
diff --git a/plugins/org.eclipse.wst.common.ui/icons/collapseAll.gif b/plugins/org.eclipse.wst.common.ui/icons/collapseAll.gif
new file mode 100644
index 0000000..6fdffe5
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.ui/icons/collapseAll.gif
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.ui/icons/expandAll.gif b/plugins/org.eclipse.wst.common.ui/icons/expandAll.gif
new file mode 100644
index 0000000..1a99431
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.ui/icons/expandAll.gif
Binary files differ
diff --git a/plugins/org.eclipse.wst.common.ui/plugin.properties b/plugins/org.eclipse.wst.common.ui/plugin.properties
index 6a0521d..4b9b6af 100644
--- a/plugins/org.eclipse.wst.common.ui/plugin.properties
+++ b/plugins/org.eclipse.wst.common.ui/plugin.properties
@@ -5,7 +5,9 @@
! SelectSingleFilePage and SelectMultiFilePage
_UI_LABEL_SOURCE_FILES = Workbench Files
_UI_LABEL_SELECTED_FILES = Selected Files
-
+_UI_POPUP_EXPAND_ALL = Expand All
+_UI_POPUP_COLLAPSE_ALL = Collapse All
+
_UI_IMPORT_BUTTON = Import Files...
_UI_IMPORT_BUTTON_TOOL_TIP = Import files from file system
diff --git a/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/Messages.java b/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/Messages.java
index 9bd1eb0..ce13bb8 100644
--- a/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/Messages.java
+++ b/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/Messages.java
@@ -23,10 +23,12 @@
public static String _UI_LABEL_SOURCE_FILES;
public static String _UI_LABEL_SELECTED_FILES;
+ public static String _UI_POPUP_EXPAND_ALL;
+ public static String _UI_POPUP_COLLAPSE_ALL;
+
public static String _UI_IMPORT_BUTTON;
public static String _UI_IMPORT_BUTTON_TOOL_TIP;
-
-
+
// SelectMultiFilePage
public static String _UI_ADD_BUTTON_TOOL_TIP;
public static String _UI_REMOVE_BUTTON_TOOL_TIP;
diff --git a/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/dialogs/SelectSingleFileDialog.java b/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/dialogs/SelectSingleFileDialog.java
index 310b16c..181cebb 100644
--- a/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/dialogs/SelectSingleFileDialog.java
+++ b/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/dialogs/SelectSingleFileDialog.java
@@ -38,7 +38,8 @@
public SelectSingleFileDialog(Shell parentShell, IStructuredSelection selection, boolean isFileMandatory)
{
- super(parentShell);
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
if (selection == null)
{
selection = new StructuredSelection();
diff --git a/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/viewers/SelectSingleFileView.java b/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/viewers/SelectSingleFileView.java
index 62dac10..70533c7 100644
--- a/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/viewers/SelectSingleFileView.java
+++ b/plugins/org.eclipse.wst.common.ui/src/org/eclipse/wst/common/ui/internal/viewers/SelectSingleFileView.java
@@ -22,6 +22,7 @@
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -33,6 +34,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -41,6 +43,8 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.model.WorkbenchContentProvider;
@@ -81,11 +85,56 @@
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- Label label = new Label(composite, SWT.NONE);
- label.setText(Messages._UI_LABEL_SOURCE_FILES);
+
+ Composite smallComposite = new Composite(composite, SWT.NONE);
+ smallComposite.setLayoutData(new GridData(GridData.FILL, GridData.HORIZONTAL_ALIGN_FILL, true, false));
+ GridLayout gridLayout = new GridLayout(2, false);
+ gridLayout.marginHeight = 0;
+ smallComposite.setLayout(gridLayout);
+
+ Label label = new Label(smallComposite, SWT.NONE);
+ label.setText(Messages._UI_LABEL_SOURCE_FILES);
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.END, false, false));
+
+ //Collapse and Expand all buttons
+ ToolBar toolBar = new ToolBar(smallComposite, SWT.FLAT);
+ toolBar.setLayoutData(new GridData(GridData.END, GridData.END, true, false));
+
+ ToolItem toolItem = new ToolItem(toolBar, SWT.NONE);
+ ImageDescriptor imageDescriptor = UIPlugin.getDefault().getImageDescriptor("icons/expandAll.gif");
+ Image image = imageDescriptor.createImage();
+ toolItem.setImage(image);
+ toolItem.setToolTipText(Messages._UI_POPUP_EXPAND_ALL);
+ toolItem.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ sourceFileViewer.expandAll();
+
+ }});
+
+
+ toolItem = new ToolItem(toolBar, SWT.NONE);
+ imageDescriptor = UIPlugin.getDefault().getImageDescriptor("icons/collapseAll.gif");
+ image = imageDescriptor.createImage();
+ toolItem.setImage(image);
+ toolItem.setToolTipText(Messages._UI_POPUP_COLLAPSE_ALL);
+ toolItem.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ sourceFileViewer.collapseAll();
+
+ }});
+
createSourceViewer(composite);
- createFilterControl(composite);
+ createFilterControl(composite);
createImportButton(composite);
+ sourceFileViewer.getTree().setFocus();
return composite;
}
@@ -321,7 +370,7 @@
sourceFileViewer.addFilter((ViewerFilter)i.next());
}
sourceFileViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
- sourceFileViewer.expandToLevel(2);
+ sourceFileViewer.expandToLevel(1);
if (defaultSelection != null)
{
diff --git a/plugins/org.eclipse.wst.common.uriresolver/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.uriresolver/META-INF/MANIFEST.MF
index e0bba88..639b5aa 100644
--- a/plugins/org.eclipse.wst.common.uriresolver/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.uriresolver/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.uriresolver; singleton:=true
-Bundle-Version: 1.1.100.qualifier
+Bundle-Version: 1.1.102.qualifier
Bundle-Activator: org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.common.uriresolver/build.properties b/plugins/org.eclipse.wst.common.uriresolver/build.properties
index afe5fa3..a1aa98a 100644
--- a/plugins/org.eclipse.wst.common.uriresolver/build.properties
+++ b/plugins/org.eclipse.wst.common.uriresolver/build.properties
@@ -4,7 +4,8 @@
META-INF/,\
about.html,\
.,\
- plugin.properties
+ plugin.properties,\
+ schema/
bin.excludes = bin/**,\
@dot/**,\
temp.folder/**
diff --git a/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/URI.java b/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/URI.java
index aa411a9..044d20b 100644
--- a/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/URI.java
+++ b/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/URI.java
@@ -2763,6 +2763,31 @@
return 0;
}
+
+ /**
+ * This method takes two URIs, the first one relative, the second absolute. It
+ * tries to resolve the first URI (making it absolute) by using the second one.
+ * If the URI cannot be resolved, the relative one is returned unmodified.
+ *
+ * @param relativeURI
+ * @param absoluteURI
+ * @return relativeURI resolved (absolute) or relativeURI unmodified if it cannot
+ * be resolved.
+ */
+ public static String resolveRelativeURI(String relativeURI, String absoluteURI) {
+
+ String result = relativeURI;
+
+ try {
+ URI relative = URI.createURI(relativeURI);
+ URI absolute = URI.createURI(absoluteURI);
+ URI resolvedRelative = relative.resolve(absolute);
+ result = resolvedRelative.toString();
+ } catch (Exception e) {}
+ return result;
+ }
+
+
/*
* Returns <code>true</code> if this URI contains non-ASCII characters;
* <code>false</code> otherwise.
diff --git a/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/URIResolverExtensionRegistry.java b/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/URIResolverExtensionRegistry.java
index d081bf1..1403071 100644
--- a/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/URIResolverExtensionRegistry.java
+++ b/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/URIResolverExtensionRegistry.java
@@ -112,24 +112,29 @@
*/
public List getExtensionDescriptors(IProject project)
{
- List result = new ArrayList();
- for (Iterator i = map.keySet().iterator(); i.hasNext();)
- {
- String key = (String) i.next();
- try
- {
- if (key == NULL_PROJECT_NATURE_ID || project == null
- || project.hasNature(key))
- {
- result.addAll((List) ((HashMap) map.get(key)).get(PRIORITY_HIGH));
- result.addAll((List) ((HashMap) map.get(key)).get(PRIORITY_MEDIUM));
- result.addAll((List) ((HashMap) map.get(key)).get(PRIORITY_LOW));
- }
- } catch (CoreException e)
- {
- }
- }
- return result;
+ List result = new ArrayList();
+ List lowPriorityList = new ArrayList();
+ List mediumPriorityList = new ArrayList();
+ List highPriorityList = new ArrayList();
+ for (Iterator i = map.keySet().iterator(); i.hasNext();)
+ {
+ String key = (String) i.next();
+ try
+ {
+ if (key == NULL_PROJECT_NATURE_ID || project == null || project.hasNature(key))
+ {
+ highPriorityList.addAll((List) ((HashMap) map.get(key)).get(PRIORITY_HIGH));
+ mediumPriorityList.addAll((List) ((HashMap) map.get(key)).get(PRIORITY_MEDIUM));
+ lowPriorityList.addAll((List) ((HashMap) map.get(key)).get(PRIORITY_LOW));
+ }
+ } catch (CoreException e)
+ {
+ }
+ }
+ result.addAll(highPriorityList);
+ result.addAll(mediumPriorityList);
+ result.addAll(lowPriorityList);
+ return result;
}
/**
diff --git a/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/util/URIHelper.java b/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/util/URIHelper.java
index b30d4ab..f9540b3 100644
--- a/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/util/URIHelper.java
+++ b/plugins/org.eclipse.wst.common.uriresolver/src/org/eclipse/wst/common/uriresolver/internal/util/URIHelper.java
@@ -32,11 +32,12 @@
public static String ensureURIProtocolFormat(String uri) {
String protocol = getProtocol(uri);
- if (protocol.equals(FILE_PROTOCOL)) {
- return ensureFileURIProtocolFormat(uri);
- } else {
- return uri;
+ if (protocol != null) {
+ if (protocol.equals(FILE_PROTOCOL)) {
+ return ensureFileURIProtocolFormat(uri);
+ }
}
+ return uri;
}
@@ -287,7 +288,7 @@
if (uri != null)
{
int index = uri.indexOf(PROTOCOL_PATTERN);
- if (index != -1 || uri.startsWith("/"))
+ if (index != -1 || uri.startsWith("/") || uri.startsWith("\\"))
{
result = true;
}
@@ -459,7 +460,7 @@
if (isProtocolFileOrNull(uri))
{
uri = removeProtocol(uri);
- File file = new File(uri);
+ File file = new File(org.eclipse.wst.common.uriresolver.internal.URI.decode(uri));
result = file.exists() && file.isFile();
}
else if (isPlatformResourceProtocol(uri))
diff --git a/plugins/org.eclipse.wst.internet.cache/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.internet.cache/META-INF/MANIFEST.MF
index 35f197a..cacdc29 100644
--- a/plugins/org.eclipse.wst.internet.cache/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.internet.cache/META-INF/MANIFEST.MF
@@ -2,14 +2,14 @@
Bundle-ManifestVersion: 2
Bundle-Name: %_PLUGIN_NAME
Bundle-SymbolicName: org.eclipse.wst.internet.cache; singleton:=true
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.0.103.qualifier
Bundle-Activator: org.eclipse.wst.internet.cache.internal.CachePlugin
Bundle-Vendor: %_PLUGIN_PROVIDER
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+Require-Bundle: org.eclipse.ui;bundle-version="[3.2.0,3.3.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,3.3.0)",
org.eclipse.wst.common.uriresolver;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)"
+ org.eclipse.core.resources;bundle-version="[3.2.0,3.3.0)"
Eclipse-LazyStart: true
Export-Package: org.eclipse.wst.internet.cache.internal;x-friends:="org.eclipse.wst.internet.cache.tests",
org.eclipse.wst.internet.cache.internal.preferences;x-internal:=true
diff --git a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java
index 369d7e4..87f48aa 100644
--- a/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java
+++ b/plugins/org.eclipse.wst.internet.cache/src/org/eclipse/wst/internet/cache/internal/LicenseAcceptanceDialog.java
@@ -154,7 +154,12 @@
// Create the browser.
final Browser browser = new Browser(licenseTextComposite, SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- //gd.heightHint = 400;
+
+ // It's important that the license URL is set even if we read
+ // the contents of the license file ourselves (see below) as
+ // otherwise the progress monitor will not be called on certain
+ // linux systems with certain browsers.
+ browser.setUrl(licenseURL);
// The browser widget has problems loading files stored in jars
// so we read from the jar and set the browser text ourselves.
@@ -193,10 +198,7 @@
}
}
}
- else
- {
- browser.setUrl(licenseURL);
- }
+
browser.setLayoutData(gd);
browser.addProgressListener(new ProgressListener(){
diff --git a/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF
index ca924f9..47a42fb 100644
--- a/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Validation Framework UI
Bundle-SymbolicName: org.eclipse.wst.validation.ui; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.3.qualifier
Bundle-Activator: org.eclipse.wst.validation.internal.ui.plugin.ValidationUIPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java
index fea3e93..d2a5d13 100644
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java
+++ b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java
@@ -32,9 +32,12 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jem.util.logger.LogEntry;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
@@ -604,7 +607,7 @@
protected boolean handleFilesToSave(Map projects)
{
List fileList = getIFiles(projects);
- IEditorPart[] dirtyEditors = SaveFilesHelper.getDirtyEditors(fileList);
+ final IEditorPart[] dirtyEditors = SaveFilesHelper.getDirtyEditors(fileList);
if(dirtyEditors == null || dirtyEditors.length == 0)
return true;
boolean saveAutomatically = false;
@@ -622,16 +625,33 @@
sfDialog = new SaveFilesDialog(ValidationUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell());
sfDialog.setInput(Arrays.asList(dirtyEditors));
}
- // Save all open editors.
- if(saveAutomatically || sfDialog.open() == Window.OK)
- {
- int numDirtyEditors = dirtyEditors.length;
- for(int i = 0; i < numDirtyEditors; i++)
- {
- dirtyEditors[i].doSave(null);
- }
- return true;
- }
+
+ if(saveAutomatically || sfDialog.open() == Window.OK){
+ ProgressMonitorDialog ctx = new ProgressMonitorDialog(getShell());
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress(){
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException{
+ try {
+ monitor.beginTask(ValidationUIMessages.SaveFilesDialog_saving, dirtyEditors.length);
+ int numDirtyEditors = dirtyEditors.length;
+ for(int i = 0; i < numDirtyEditors; i++){
+ dirtyEditors[i].doSave(new SubProgressMonitor(monitor, 1));
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+
+ try {
+ ctx.run(false, true, runnable);
+ return true;
+ } catch (InvocationTargetException e) {
+ Logger.getLogger().logError(e);
+ } catch (InterruptedException e) {
+ }
+ }
return false;
}
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPreferencePage.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPreferencePage.java
index 3487d6c..b28a9a5 100644
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPreferencePage.java
+++ b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationPreferencePage.java
@@ -853,7 +853,8 @@
}
public boolean performDefaults() throws InvocationTargetException {
- pagePreferences.resetToDefault();
+ pagePreferences.restoreDefaults();
+ //pagePreferences.resetToDefault();
updateWidgetsForDefaults();
getDefaultsButton().setFocus();
return true;
diff --git a/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
index 7b5a450..03348a6 100644
--- a/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Validation Framework
Bundle-SymbolicName: org.eclipse.wst.validation; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.5.qualifier
Bundle-Activator: org.eclipse.wst.validation.internal.plugin.ValidationPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.validation/property_files/validate_base.properties b/plugins/org.eclipse.wst.validation/property_files/validate_base.properties
index fc9ea8c..0a0955a 100644
--- a/plugins/org.eclipse.wst.validation/property_files/validate_base.properties
+++ b/plugins/org.eclipse.wst.validation/property_files/validate_base.properties
@@ -136,6 +136,7 @@
VBF_TASK_WARN_MESSAGE_LIMIT_ABORT=IWAE0034W IWAD3000I: {1} terminated validation of {0} because the maximum number of messages were reported. Some messages may be missing.
VBF_TASK_WARN_MESSAGE_LIMIT_VAL=IWAE0035W IWAD3000I: Some messages may be missing because the maximum number of messages has been reported. Increase the maximum number of messages and try again.
+VBF_VALIDATION_JOB_MSG=Waiting for build
#
# End Validation Builder Framework Strings
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java
index 2cc1ff8..537d69a 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java
@@ -17,6 +17,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.jem.util.logger.LogEntry;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -130,6 +131,11 @@
gp = (GlobalConfiguration) root.getSessionProperty(USER_PREFERENCE);
if (gp == null) {
gp = new GlobalConfiguration(root);
+ Preferences prefs = ValidationPlugin.getPlugin().getPluginPreferences();
+ if( prefs != null ){
+ prefs.addPropertyChangeListener(gp);
+ }
+
gp.getVersion(); // initialize the configuration's version attribute
gp.load(); // initialize this instance from the stored values
gp.passivate(); // store this instance as a property on the IResource
@@ -273,4 +279,5 @@
}
return false;
}
+
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java
index 3239cb0..3204d26 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java
@@ -17,6 +17,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.jem.util.logger.LogEntry;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -73,16 +74,27 @@
_saveAutomatically = save;
}
- public void resetToDefault() throws InvocationTargetException {
+ public void resetToDefault() throws InvocationTargetException {
setDisableAllValidation(getDisableValidationDefault());
setEnabledValidators(getEnabledValidatorsDefault());
setEnabledManualValidators(getManualEnabledValidators());
setEnabledBuildValidators(getBuildEnabledValidators());
setCanProjectsOverride(getCanProjectsOverrideDefault());
setSaveAutomatically(getSaveAutomaticallyDefault());
- setDefaultDelegates(getValidators());
+ setDefaultDelegates(getValidators());
}
+ public void restoreDefaults() throws InvocationTargetException
+ {
+ ValidationPlugin plugin = ValidationPlugin.getPlugin();
+ Preferences pluginPreferences = plugin.getPluginPreferences();
+ deserialize(pluginPreferences.getDefaultString(USER_PREFERENCE));
+ deserializeManual(pluginPreferences.getDefaultString(USER_MANUAL_PREFERENCE));
+ deserializeBuild(pluginPreferences.getDefaultString(USER_BUILD_PREFERENCE));
+ deserializeDelegates(pluginPreferences.getDefaultString(DELEGATES_PREFERENCE));
+ }
+
+
/**
* This method exists only for migration purposes. The root marker must be deleted after
* migration is complete.
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java
index bb7671f..515768e 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java
@@ -104,7 +104,9 @@
public static final String VBF_STATUS_START_REMOVING_OLD_MESSAGES = "VBF_STATUS_START_REMOVING_OLD_MESSAGES"; //$NON-NLS-1$
public static final String VBF_STATUS_FINISH_REMOVING_OLD_MESSAGES = "VBF_STATUS_FINISH_REMOVING_OLD_MESSAGES"; //$NON-NLS-1$
- public static final String VBF_TASK_WARN_MESSAGE_LIMIT_VAL = "VBF_TASK_WARN_MESSAGE_LIMIT_VAL"; //$NON-NLS-1$
+ public static final String VBF_TASK_WARN_MESSAGE_LIMIT_VAL = "VBF_TASK_WARN_MESSAGE_LIMIT_VAL"; //$NON-NLS-1$
+
+ public static final String VBF_VALIDATION_JOB_MSG = "VBF_VALIDATION_JOB_MSG"; //$NON-NLS-1$
public static final String VBF_EXC_DISABLEV = "VBF_EXC_DISABLEV"; //$NON-NLS-1$
public static final String VBF_EXC_DISABLEH = "VBF_EXC_DISABLEH"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
index 76a2236..a052d95 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
@@ -174,7 +174,7 @@
* false, return the enabled non-incremental validators.
*/
public ValidatorMetaData[] getEnabledIncrementalValidators(boolean incremental) throws InvocationTargetException {
- return getEnabledFullBuildValidators(incremental);
+ return getEnabledFullBuildValidators(!incremental);
}
/**
@@ -764,13 +764,28 @@
Preferences prefs = (Preferences) event.getSource();
if (prefs != null && !event.getOldValue().equals(event.getNewValue())) {
try {
- deserializeAllPrefs(prefs);
+ deserializeAllPrefs(event);
+ passivate();
} catch (InvocationTargetException ie) {
Logger.getLogger().log(ie);
}
}
}
+ private void deserializeAllPrefs(PropertyChangeEvent event) throws InvocationTargetException {
+ String storedConfig = (String)event.getNewValue();
+ if( event.getProperty().equals(USER_PREFERENCE) ){
+ deserialize(storedConfig);
+ }else if(event.getProperty().equals(USER_MANUAL_PREFERENCE)){
+ deserializeManual(storedConfig);
+ }else if(event.getProperty().equals(USER_BUILD_PREFERENCE)){
+ deserializeBuild(storedConfig);
+ }else if(event.getProperty().equals(DELEGATES_PREFERENCE)){
+ deserializeDelegates(storedConfig);
+ }
+ }
+
+
protected void deserializeBuild(String storedConfiguration) throws InvocationTargetException {
if (storedConfiguration == null || storedConfiguration.length() == 0 || storedConfiguration.equals("default_value")) {
// Assume that the configuration has never been set (new workspace).
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
index 67f5668..4d332d1 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
@@ -41,6 +41,7 @@
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.validation.internal.delegates.ValidatorDelegatesRegistry;
import org.eclipse.wst.validation.internal.operations.IRuleGroup;
import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -160,7 +161,7 @@
ValidatorNameFilter[] projNatureIds = vmd.getProjectNatureFilters();
String[] facetFilters = vmd.getFacetFilters();
if (projNatureIds == null) {
- if (facetFilters == null) {
+ if (facetFilters == null && vmd.getEnablementExpresion() == null) {
add(UNKNOWN_PROJECT, vmd);
}
} else {
@@ -885,7 +886,33 @@
Set projVmds = null;
if ((projectNatures == null) || (projectNatures.length == 0)) {
executionMap |= 0x4;
- clone(getValidatorMetaDataUnknownProject(), vmds);
+
+ // Also include the validators which are enabled through enablement
+ // expression for this project.
+ // Note that the API isFacetEnabled(vmd, project) works properly
+ // only when the plugin containing the property tester is activated.
+ // forcePluginActivation="true" may be needed in the declaration of
+ // the enablement in the validator extension point.
+ // <enablement>
+ // <test forcePluginActivation="true" property="foo.testProperty"/>
+ // </enablement>
+
+ Set validatorsWithEnablementExpression = new HashSet();
+ Iterator allValidators = getAllValidators().iterator();
+ while (allValidators.hasNext()) {
+ ValidatorMetaData vmd = (ValidatorMetaData) allValidators.next();
+ if (isFacetEnabled(vmd, project)) {
+ validatorsWithEnablementExpression.add(vmd);
+ }
+ }
+ if(validatorsWithEnablementExpression.size() > 0 ){
+ validatorsWithEnablementExpression.addAll( getValidatorMetaDataUnknownProject());
+ clone(validatorsWithEnablementExpression, vmds);
+ }
+ else
+ clone(getValidatorMetaDataUnknownProject(), vmds);
+
+
} else {
executionMap |= 0x8;
if (logger.isLoggingLevel(Level.FINEST)) {
@@ -978,7 +1005,6 @@
return result == EvaluationResult.TRUE;
}
} catch (CoreException ce) {
- Logger.getLogger().log(ce);
}
return false;
}
@@ -996,7 +1022,6 @@
return projectFacetIds;
}
} catch (CoreException ce) {
- Logger.getLogger().log(ce);
}
return null;
@@ -1475,6 +1500,12 @@
for (int i = 0; i < extensions.length; i++) {
readExtension(extensions[i]);
}
+
+ // Force the delegate validators registry to be read early to avoid
+ // the non-synchronized singleton issue which occurs when two delegating
+ // validators race to load the registry.
+
+ ValidatorDelegatesRegistry.getInstance();
}
public IValidator getValidator(String validatorClassName) throws InstantiationException {
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java
index 063e168..d5a101d 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java
@@ -326,15 +326,20 @@
*/
/* package */boolean isApplicableTo(IResource resource, int resourceDelta, ValidatorFilter[] filters) {
// Are any of the filters satisfied? (i.e., OR them, not AND them.)
- for (int i = 0; i < filters.length; i++) {
- ValidatorFilter filter = filters[i];
- if (checkIfValidSourceFile(resource) && filter.isApplicableType(resource) && filter.isApplicableName(resource) && filter.isApplicableAction(resourceDelta)) {
- return true;
+ if (checkIfValidSourceFile(resource)) {
+ for (int i = 0; i < filters.length; i++) {
+ ValidatorFilter filter = filters[i];
+ if (filter.isApplicableType(resource) &&
+ filter.isApplicableName(resource) &&
+ filter.isApplicableAction(resourceDelta)){
+ return true;
+ }
+
}
}
return false;
}
-
+
private boolean checkIfValidSourceFile(IResource file) {
if (file.getType() == IResource.FILE) {
IProjectValidationHelper helper = ValidationHelperRegistryReader.getInstance().getValidationHelper();
@@ -345,19 +350,23 @@
IContainer[] sourceContainers = helper.getSourceContainers(project);
for (int i=0; i<outputContainers.length; i++) {
String outputPath = outputContainers[i].getProjectRelativePath().makeAbsolute().toString();
- for (int j=0; j<sourceContainers.length; j++) {
- String sourceContainerPath = sourceContainers[j].getProjectRelativePath().makeAbsolute().toString();
- if (outputPath.equals(sourceContainerPath))
- continue;
+ String filePath = file.getProjectRelativePath().makeAbsolute().toString();
+ if (filePath.startsWith(outputPath)) {
+ //The file is in an output container.
+ //If it is a source container return true and false otherwise.
+ for (int j=0;j<sourceContainers.length; j++) {
+ if(outputContainers[i].equals(sourceContainers[j])){
+ return true;
+ }
+ return false;
+ }
}
- String filePath = file.getProjectRelativePath().makeAbsolute().toString();
- if (filePath.startsWith(outputPath))
- return false;
}
}
return true;
}
-
+
+
/**
* If this validator recognizes the project nature, whether included or excluded, return the
* name filter which describes the nature. Otherwise return null.
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/ValidatorDelegateDescriptor.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/ValidatorDelegateDescriptor.java
index 21312cb..d8ba0be 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/ValidatorDelegateDescriptor.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/delegates/ValidatorDelegateDescriptor.java
@@ -30,11 +30,6 @@
public class ValidatorDelegateDescriptor
{
/**
- * The instance of the validator refered to by this descriptor.
- */
- private IValidator delegate;
-
- /**
* The platform configuration element describing this delegate.
*/
private IConfigurationElement delegateConfiguration;
@@ -117,21 +112,15 @@
*/
public IValidator getValidator() throws ValidationException
{
- if (delegate != null)
- {
- return delegate;
- }
-
try
{
- delegate = (IValidator) delegateConfiguration.createExecutableExtension(ValidatorDelegatesRegistryReader.CLASS_ATTRIBUTE);
+ IValidator delegate = (IValidator) delegateConfiguration.createExecutableExtension(ValidatorDelegatesRegistryReader.CLASS_ATTRIBUTE);
+ return delegate;
}
catch (CoreException e)
{
String delegatingValidatorName = ValidationRegistryReader.getReader().getValidatorMetaData(getTargetID()).getValidatorDisplayName();
throw new ValidationException(new LocalizedMessage(IMessage.HIGH_SEVERITY, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_CANNOT_INSTANTIATE_DELEGATE, new String[] { getName(), delegatingValidatorName })));
}
-
- return delegate;
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java
index 30ead11..a7d5a21 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java
@@ -31,9 +31,11 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
@@ -83,8 +85,25 @@
// operation will not
// fork.
protected static final boolean DEFAULT_FORCE = true; // By default, run the
+ protected static final String VALIDATIONLAUNCHERMSG = "Waiting for build"; // By default, run the
// operation whether
// or not it needs to
+
+ class ValidationLauncherJob extends Job {
+ private Job validationJob;
+ public ValidationLauncherJob(Job validationJob) {
+ super(ResourceHandler.getExternalizedMessage("VBF_VALIDATION_JOB_MSG"));
+
+ setSystem(true);
+ setRule(ResourcesPlugin.getWorkspace().getRoot());
+ this.validationJob= validationJob;
+ }
+ protected IStatus run(IProgressMonitor monitor) {
+ validationJob.schedule();
+ return Status.OK_STATUS;
+ }
+ }
+
/**
* @deprecated Will be removed in Milestone 3. Use DEFAULT_ASYNC
*/
@@ -1669,6 +1688,9 @@
}
+
+
+
private void initValidateContext(IFileDelta[] delta, IWorkbenchContext context ) {
if (context instanceof WorkbenchContext) {
((WorkbenchContext)context).setValidationFileURIs(new ArrayList());
@@ -1749,6 +1771,7 @@
}
};
try {
+
ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
} catch (CoreException e) {
e.printStackTrace();
@@ -1759,9 +1782,12 @@
}
);
validatorjob.setPriority(Job.DECORATE);
- validatorjob.schedule();
+
+ ValidationLauncherJob validationLauncherJob = new ValidationLauncherJob(validatorjob);
+ validationLauncherJob.schedule();
+
+ //validatorjob.schedule();
}
-
-
+
}
\ No newline at end of file