Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2010-12-20 15:26:03 -0500
committerpfullbright2010-12-20 15:26:03 -0500
commit38c42e4f9fe9e60f509b69be7386b0c2e446236f (patch)
treeacf877e4bb413371b0c253d9a6075109d6a67cd4
parent7d21493a04eb0dd1327cbf8328a8c85395ee9f30 (diff)
downloadwebtools.dali-38c42e4f9fe9e60f509b69be7386b0c2e446236f.tar.gz
webtools.dali-38c42e4f9fe9e60f509b69be7386b0c2e446236f.tar.xz
webtools.dali-38c42e4f9fe9e60f509b69be7386b0c2e446236f.zip
extracted JaxbProjectModel for use with other properties pages
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java71
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java93
2 files changed, 71 insertions, 93 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java
new file mode 100644
index 0000000000..e5f449ed96
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java
@@ -0,0 +1,71 @@
+package org.eclipse.jpt.jaxb.ui.internal.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.jaxb.core.JaxbProject;
+import org.eclipse.jpt.jaxb.core.JaxbProjectManager;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
+import org.eclipse.jpt.utility.internal.model.value.AspectPropertyValueModelAdapter;
+import org.eclipse.jpt.utility.model.event.CollectionAddEvent;
+import org.eclipse.jpt.utility.model.listener.CollectionChangeAdapter;
+import org.eclipse.jpt.utility.model.listener.CollectionChangeListener;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+
+/**
+ * Treat the JAXB project as an "aspect" of the Eclipse project (IProject);
+ * but the JAXB project is stored in the JAXB model, not the Eclipse project
+ * itself....
+ * We also need to listen for the JAXB project to be rebuilt if the user
+ * changes the Eclipse project's JAXB platform (which is stored in the
+ * Eclipse project's preferences).
+ */
+class JaxbProjectModel
+ extends AspectPropertyValueModelAdapter<IProject, JaxbProject> {
+
+ /**
+ * The JAXB project may also change via another page (notably, the project facets page).
+ * In that case, the preference change occurs before we actually have another project,
+ * so we must listen to the projects manager
+ */
+ private final CollectionChangeListener projectManagerListener;
+
+
+ JaxbProjectModel(PropertyValueModel<IProject> projectModel) {
+ super(projectModel);
+ this.projectManagerListener = buildProjectManagerListener();
+ }
+
+ private CollectionChangeListener buildProjectManagerListener() {
+ return new CollectionChangeAdapter() {
+ // we are only looking for the project rebuild *add* event here so we can
+ // determine if the platform has changed.
+ // the other events are unimportant in this case
+ @Override
+ public void itemsAdded(CollectionAddEvent event) {
+ platformChanged();
+ }
+ };
+ }
+
+ void platformChanged() {
+ this.propertyChanged();
+ }
+
+ @Override
+ protected void engageSubject_() {
+ JptJaxbCorePlugin.getProjectManager().addCollectionChangeListener(
+ JaxbProjectManager.JAXB_PROJECTS_COLLECTION,
+ this.projectManagerListener);
+ }
+
+ @Override
+ protected void disengageSubject_() {
+ JptJaxbCorePlugin.getProjectManager().removeCollectionChangeListener(
+ JaxbProjectManager.JAXB_PROJECTS_COLLECTION,
+ this.projectManagerListener);
+ }
+
+ @Override
+ protected JaxbProject buildValue_() {
+ return JptJaxbCorePlugin.getJaxbProject(this.subject);
+ }
+} \ No newline at end of file
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
index 243476d058..b3a40cfab7 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
@@ -14,11 +14,9 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jpt.jaxb.core.JaxbFacet;
import org.eclipse.jpt.jaxb.core.JaxbProject;
-import org.eclipse.jpt.jaxb.core.JaxbProjectManager;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.internal.libprov.JaxbLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
@@ -35,10 +33,7 @@ import org.eclipse.jpt.utility.internal.model.value.SetCollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.StaticCollectionValueModel;
import org.eclipse.jpt.utility.model.Model;
-import org.eclipse.jpt.utility.model.event.CollectionAddEvent;
import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.CollectionChangeAdapter;
-import org.eclipse.jpt.utility.model.listener.CollectionChangeListener;
import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.model.value.ListValueModel;
@@ -285,94 +280,6 @@ public class JaxbProjectPropertiesPage
// ********** UI model adapters **********
/**
- * Treat the JAXB project as an "aspect" of the Eclipse project (IProject);
- * but the JAXB project is stored in the JAXB model, not the Eclipse project
- * itself....
- * We also need to listen for the JAXB project to be rebuilt if the user
- * changes the Eclipse project's JAXB platform (which is stored in the
- * Eclipse project's preferences).
- */
- static class JaxbProjectModel
- extends AspectPropertyValueModelAdapter<IProject, JaxbProject> {
-
-// /**
-// * The JAXB project's platform is stored as a preference.
-// * If it changes, a new JAXB project is built.
-// */
-// private final IPreferenceChangeListener preferenceChangeListener;
-
- /**
- * The JAXB project may also change via another page (notably, the project facets page).
- * In that case, the preference change occurs before we actually have another project,
- * so we must listen to the projects manager
- */
- private final CollectionChangeListener projectManagerListener;
-
-
- JaxbProjectModel(PropertyValueModel<IProject> projectModel) {
- super(projectModel);
-// this.preferenceChangeListener = buildPreferenceChangeListener();
- this.projectManagerListener = buildProjectManagerListener();
- }
-
-// private IPreferenceChangeListener buildPreferenceChangeListener() {
-// return new IPreferenceChangeListener() {
-// public void preferenceChange(PreferenceChangeEvent event) {
-// if (event.getKey().equals(JptJaxbCorePlugin.JAXB_PLATFORM_PREF_KEY)) {
-// platformChanged();
-// }
-// }
-// @Override
-// public String toString() {
-// return "preference change listener"; //$NON-NLS-1$
-// }
-// };
-// }
-
- private CollectionChangeListener buildProjectManagerListener() {
- return new CollectionChangeAdapter() {
- // we are only looking for the project rebuild *add* event here so we can
- // determine if the platform has changed.
- // the other events are unimportant in this case
- @Override
- public void itemsAdded(CollectionAddEvent event) {
- platformChanged();
- }
- };
- }
-
- void platformChanged() {
- this.propertyChanged();
- }
-
- @Override
- protected void engageSubject_() {
-// getPreferences().addPreferenceChangeListener(this.preferenceChangeListener);
- JptJaxbCorePlugin.getProjectManager().addCollectionChangeListener(
- JaxbProjectManager.JAXB_PROJECTS_COLLECTION,
- this.projectManagerListener);
- }
-
- @Override
- protected void disengageSubject_() {
-// getPreferences().removePreferenceChangeListener(this.preferenceChangeListener);
- JptJaxbCorePlugin.getProjectManager().removeCollectionChangeListener(
- JaxbProjectManager.JAXB_PROJECTS_COLLECTION,
- this.projectManagerListener);
- }
-
- @Override
- protected JaxbProject buildValue_() {
- return JptJaxbCorePlugin.getJaxbProject(this.subject);
- }
-
-// private IEclipsePreferences getPreferences() {
-// return JptCorePlugin.getProjectPreferences(this.subject);
-// }
- }
-
-
- /**
* Treat the JAXB platform as an "aspect" of the JAXB project.
* The platform ID is stored in the project preferences.
* The platform ID does not change for a JAXB project - if the user wants a

Back to the top