Bug 477831 - IBuildpathContainer must be extended
Change-Id: I757d2cf88f2d87721a597a46b251c92f899d67c3
Signed-off-by: Dariusz Michura <dariusz.m@zend.com>
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/IBuildpathContainerExtension3.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/IBuildpathContainerExtension3.java
new file mode 100644
index 0000000..6f32172
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/IBuildpathContainerExtension3.java
@@ -0,0 +1,17 @@
+package org.eclipse.dltk.core;
+
+import java.util.Map;
+
+public interface IBuildpathContainerExtension3 {
+
+ /**
+ * Answers container'a additional attributes. May be used to store various
+ * container data e.g. version identifier.
+ * <p>
+ * Should not return <code>null</code>.
+ * </p>
+ *
+ * @return Map<String, String> - collection of attributes
+ */
+ public Map<String, String> getAttributes();
+}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
index 3736086..ee7e62d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
@@ -18,12 +18,14 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IBuildpathContainer;
+import org.eclipse.dltk.core.IBuildpathContainerExtension3;
import org.eclipse.dltk.core.IBuildpathEntry;
import org.eclipse.dltk.core.IScriptProject;
public class BPUserLibraryElement {
- private class UpdatedBuildpathContainer implements IBuildpathContainer {
+ private class UpdatedBuildpathContainer
+ implements IBuildpathContainer, IBuildpathContainerExtension3 {
public IBuildpathEntry[] getBuildpathEntries() {
BPListElement[] children = getChildren();
IBuildpathEntry[] entries = new IBuildpathEntry[children.length];
@@ -46,6 +48,11 @@
return BPUserLibraryElement.this.getPath();
}
+ public Map<String, String> getAttributes() {
+ return fAttributes != null
+ ? Collections.<String, String>unmodifiableMap(fAttributes)
+ : Collections.<String, String> emptyMap();
+ }
}
private String fName;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/UserLibraryPreferencePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/UserLibraryPreferencePage.java
index 8a6dc74..5cf6fe3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/UserLibraryPreferencePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/UserLibraryPreferencePage.java
@@ -62,7 +62,6 @@
import org.eclipse.dltk.internal.core.UserLibraryManager;
import org.eclipse.dltk.internal.corext.util.Messages;
import org.eclipse.dltk.internal.ui.IUIConstants;
-import org.eclipse.dltk.ui.dialogs.StatusInfo;
import org.eclipse.dltk.internal.ui.wizards.BuildpathAttributeConfiguration;
import org.eclipse.dltk.internal.ui.wizards.buildpath.AccessRulesDialog;
import org.eclipse.dltk.internal.ui.wizards.buildpath.BPListElement;
@@ -84,6 +83,7 @@
import org.eclipse.dltk.internal.ui.wizards.dialogfields.StringDialogField;
import org.eclipse.dltk.internal.ui.wizards.dialogfields.TreeListDialogField;
import org.eclipse.dltk.ui.DLTKUIPlugin;
+import org.eclipse.dltk.ui.dialogs.StatusInfo;
import org.eclipse.dltk.ui.util.ExceptionHandler;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -1127,10 +1127,6 @@
IBuildpathContainer updatedContainer = element
.getUpdatedContainer();
try {
- if (initializer instanceof UserLibraryBuildpathContainerInitializer) {
- ((UserLibraryBuildpathContainerInitializer) initializer)
- .setToolkit(getLanguageToolkit());
- }
initializer.requestBuildpathContainerUpdate(path, project,
updatedContainer);
} catch (CoreException e) {