Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2010-10-28 13:56:14 -0400
committerpfullbright2010-10-28 13:56:14 -0400
commit3bafaf141669fb0676d4b5ee090c36effee516a6 (patch)
tree4e825a4d7821a4ecf713208cdf857e896fd7be5d
parentd551d796fa064f27fa04b3aa86019d27e6591516 (diff)
downloadwebtools.dali-3bafaf141669fb0676d4b5ee090c36effee516a6.tar.gz
webtools.dali-3bafaf141669fb0676d4b5ee090c36effee516a6.tar.xz
webtools.dali-3bafaf141669fb0676d4b5ee090c36effee516a6.zip
tweaked config/datamodel for karen
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java59
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java82
2 files changed, 83 insertions, 58 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java
index 2f82f62b9e..9a553f6d48 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jaxb.core.internal.facet;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
import org.eclipse.wst.common.project.facet.core.ActionConfig;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
@@ -60,6 +61,11 @@ public class JaxbFacetInstallConfig
IProjectFacetVersion oldFv = getProjectFacetVersion();
super.setProjectFacetVersion(fv);
this.changeSupport.firePropertyChange(PROJECT_FACET_VERSION_PROPERTY, oldFv, fv);
+ adjustLibraryProviders();
+ if (getLibraryInstallDelegate().getProjectFacetVersion().equals(getProjectFacetVersion())) {
+ getLibraryInstallDelegate().dispose();
+ setLibraryInstallDelegate(buildLibraryInstallDelegate());
+ }
}
public JaxbPlatformDescription getPlatform() {
@@ -70,12 +76,65 @@ public class JaxbFacetInstallConfig
JaxbPlatformDescription oldPlatform = this.platform;
this.platform = platform;
this.changeSupport.firePropertyChange(PLATFORM_PROPERTY, oldPlatform, platform);
+ adjustLibraryProviders();
}
public LibraryInstallDelegate getLibraryInstallDelegate() {
+ if (this.libraryInstallDelegate == null) {
+ this.libraryInstallDelegate = buildLibraryInstallDelegate();
+ }
return this.libraryInstallDelegate;
}
+ protected LibraryInstallDelegate buildLibraryInstallDelegate() {
+ IFacetedProjectWorkingCopy fpjwc = this.getFacetedProjectWorkingCopy();
+ if (fpjwc == null) {
+ return null;
+ }
+ IProjectFacetVersion pfv = this.getProjectFacetVersion();
+ if (pfv == null) {
+ return null;
+ }
+ LibraryInstallDelegate lid = new LibraryInstallDelegate(fpjwc, pfv);
+ lid.addListener(buildLibraryInstallDelegateListener());
+ return lid;
+ }
+
+ protected IPropertyChangeListener buildLibraryInstallDelegateListener() {
+ return new IPropertyChangeListener() {
+ public void propertyChanged(String property, Object oldValue, Object newValue ) {
+ if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) {
+ adjustLibraryProviders();
+ }
+ }
+ };
+ }
+
+ protected void adjustLibraryProviders() {
+ LibraryInstallDelegate lid = getLibraryInstallDelegate();
+ if (lid != null) {
+// List<JpaLibraryProviderInstallOperationConfig> jpaConfigs
+// = new ArrayList<JpaLibraryProviderInstallOperationConfig>();
+// // add the currently selected one first
+// JpaLibraryProviderInstallOperationConfig currentJpaConfig = null;
+// LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig();
+// if (config instanceof JpaLibraryProviderInstallOperationConfig) {
+// currentJpaConfig = (JpaLibraryProviderInstallOperationConfig) config;
+// jpaConfigs.add(currentJpaConfig);
+// }
+// for (ILibraryProvider lp : lid.getLibraryProviders()) {
+// config = lid.getLibraryProviderOperationConfig(lp);
+// if (config instanceof JpaLibraryProviderInstallOperationConfig
+// && ! config.equals(currentJpaConfig)) {
+// jpaConfigs.add((JpaLibraryProviderInstallOperationConfig) config);
+// }
+// }
+// for (JpaLibraryProviderInstallOperationConfig jpaConfig : jpaConfigs) {
+// jpaConfig.setJpaPlatformId(getPlatformId());
+// }
+ }
+ }
+
public void setLibraryInstallDelegate(LibraryInstallDelegate libraryInstallDelegate) {
LibraryInstallDelegate oldLibraryInstallDelegate = this.libraryInstallDelegate;
this.libraryInstallDelegate = libraryInstallDelegate;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java
index 8241fa8b3f..e80ad2037c 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java
@@ -61,6 +61,8 @@ public class JaxbFacetInstallDataModelProvider
private PropertyChangeListener configListener;
+ private IPropertyChangeListener libraryInstallDelegateListener;
+
public JaxbFacetInstallDataModelProvider() {
this(new JaxbFacetInstallConfig());
@@ -71,6 +73,7 @@ public class JaxbFacetInstallDataModelProvider
this.config = config;
this.configListener = buildConfigListener();
this.config.addPropertyChangeListener(this.configListener);
+ this.libraryInstallDelegateListener = buildLibraryInstallDelegateListener();
}
@@ -80,10 +83,30 @@ public class JaxbFacetInstallDataModelProvider
if (evt.getPropertyName().equals(JaxbFacetInstallConfig.FACETED_PROJECT_WORKING_COPY_PROPERTY)) {
}
+ else if (evt.getPropertyName().equals(JaxbFacetInstallConfig.LIBRARY_INSTALL_DELEGATE_PROPERTY)) {
+ LibraryInstallDelegate oldLid = (LibraryInstallDelegate) evt.getOldValue();
+ if (oldLid != null) {
+ oldLid.removeListener(JaxbFacetInstallDataModelProvider.this.libraryInstallDelegateListener);
+ }
+ LibraryInstallDelegate newLid = (LibraryInstallDelegate) evt.getNewValue();
+ if (newLid != null) {
+ newLid.addListener(JaxbFacetInstallDataModelProvider.this.libraryInstallDelegateListener);
+ }
+ setLibraryInstallDelegate(newLid);
+ }
}
};
}
+ protected IPropertyChangeListener buildLibraryInstallDelegateListener() {
+ return new IPropertyChangeListener() {
+ public void propertyChanged(String property, Object oldValue, Object newValue ) {
+ JaxbFacetInstallDataModelProvider.this.getDataModel().notifyPropertyChange(
+ LIBRARY_INSTALL_DELEGATE, IDataModel.VALUE_CHG);
+ }
+ };
+ }
+
@Override
public Set getPropertyNames() {
Set names = super.getPropertyNames();
@@ -115,7 +138,7 @@ public class JaxbFacetInstallDataModelProvider
}
else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) {
// means that library install delegate has not been initialized
- LibraryInstallDelegate lid = buildLibraryInstallDelegate();
+ LibraryInstallDelegate lid = this.config.getLibraryInstallDelegate();
setLibraryInstallDelegate(lid);
return lid;
}
@@ -127,43 +150,12 @@ public class JaxbFacetInstallDataModelProvider
return JptJaxbCorePlugin.getDefaultPlatform(getProjectFacetVersion());
}
- protected LibraryInstallDelegate buildLibraryInstallDelegate() {
- IFacetedProjectWorkingCopy fpjwc = this.getFacetedProjectWorkingCopy();
- if (fpjwc == null) {
- return null;
- }
- IProjectFacetVersion pfv = this.getProjectFacetVersion();
- if (pfv == null) {
- return null;
- }
- LibraryInstallDelegate lid = new LibraryInstallDelegate(fpjwc, pfv);
- lid.addListener(buildLibraryInstallDelegateListener());
- return lid;
- }
-
- protected IPropertyChangeListener buildLibraryInstallDelegateListener() {
- return new IPropertyChangeListener() {
- public void propertyChanged(String property, Object oldValue, Object newValue ) {
- if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) {
- adjustLibraryProviders();
- }
- JaxbFacetInstallDataModelProvider.this.getDataModel().notifyPropertyChange(
- LIBRARY_INSTALL_DELEGATE, IDataModel.VALUE_CHG);
- }
- };
- }
-
@Override
public boolean propertySet(String propertyName, Object propertyValue) {
boolean ok = super.propertySet(propertyName, propertyValue);
if (propertyName.equals(FACET_VERSION)) {
- adjustLibraryProviders();
this.model.notifyPropertyChange(PLATFORM, IDataModel.DEFAULT_CHG);
- if (getLibraryInstallDelegate().getProjectFacetVersion().equals(getProjectFacetVersion())) {
- getLibraryInstallDelegate().dispose();
- setLibraryInstallDelegate(buildLibraryInstallDelegate());
- }
}
else if (propertyName.equals(FACETED_PROJECT_WORKING_COPY)) {
getFacetedProjectWorkingCopy().addListener(
@@ -184,7 +176,6 @@ public class JaxbFacetInstallDataModelProvider
}
else if (propertyName.equals(PLATFORM)) {
this.config.setPlatform((JaxbPlatformDescription) propertyValue);
- adjustLibraryProviders();
}
else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) {
this.config.setLibraryInstallDelegate((LibraryInstallDelegate) propertyValue);
@@ -275,31 +266,6 @@ public class JaxbFacetInstallDataModelProvider
getDataModel().setProperty(LIBRARY_INSTALL_DELEGATE, lid);
}
- protected void adjustLibraryProviders() {
- LibraryInstallDelegate lid = getLibraryInstallDelegate();
- if (lid != null) {
-// List<JpaLibraryProviderInstallOperationConfig> jpaConfigs
-// = new ArrayList<JpaLibraryProviderInstallOperationConfig>();
-// // add the currently selected one first
-// JpaLibraryProviderInstallOperationConfig currentJpaConfig = null;
-// LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig();
-// if (config instanceof JpaLibraryProviderInstallOperationConfig) {
-// currentJpaConfig = (JpaLibraryProviderInstallOperationConfig) config;
-// jpaConfigs.add(currentJpaConfig);
-// }
-// for (ILibraryProvider lp : lid.getLibraryProviders()) {
-// config = lid.getLibraryProviderOperationConfig(lp);
-// if (config instanceof JpaLibraryProviderInstallOperationConfig
-// && ! config.equals(currentJpaConfig)) {
-// jpaConfigs.add((JpaLibraryProviderInstallOperationConfig) config);
-// }
-// }
-// for (JpaLibraryProviderInstallOperationConfig jpaConfig : jpaConfigs) {
-// jpaConfig.setJpaPlatformId(getPlatformId());
-// }
- }
- }
-
@Override
public void dispose() {
super.dispose();

Back to the top