Do some checks before casting to IEditableArtifactManagerSession

This needs to be sorted out so that in the right case the Imple *does*
implement this
diff --git a/plugins/org.eclipse.tigerstripe.workbench.base.edit/META-INF/MANIFEST.MF b/plugins/org.eclipse.tigerstripe.workbench.base.edit/META-INF/MANIFEST.MF
index aab2e93..d26b6c1 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.base.edit/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.tigerstripe.workbench.base.edit/META-INF/MANIFEST.MF
@@ -28,3 +28,4 @@
  org.eclipse.tigerstripe.workbench.internal.tools,
  org.eclipse.tigerstripe.workbench.refactor,
  org.eclipse.tigerstripe.workbench.refactor.diagrams
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.tigerstripe.workbench.base/plugin.xml b/plugins/org.eclipse.tigerstripe.workbench.base/plugin.xml
index 145f8a4..255d580 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.base/plugin.xml
+++ b/plugins/org.eclipse.tigerstripe.workbench.base/plugin.xml
@@ -230,6 +230,7 @@
                type="org.eclipse.tigerstripe.workbench.model.deprecated_.IRelationship">
          </adapter>
       </factory>
+      
       <factory
             adaptableType="org.eclipse.tigerstripe.workbench.model.deprecated_.IModelComponent"
             class="org.eclipse.tigerstripe.workbench.internal.adapt.ModelToJavaAdapterFactory">
diff --git a/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/core/model/BaseArtifactManagerImpl.java b/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/core/model/BaseArtifactManagerImpl.java
index f15ab59..ba5c569 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/core/model/BaseArtifactManagerImpl.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/core/model/BaseArtifactManagerImpl.java
@@ -666,7 +666,7 @@
 
                     if (context.addToCycle(Cycles.PHANTOM, phantomArtifactMgrSession)) {
 
-                        IArtifactManagerInternal phantomMgr = (IArtifactManagerInternal) ((IArtifactManagerSession) phantomArtifactMgrSession)
+                        ArtifactManager phantomMgr = ((IArtifactManagerSession) phantomArtifactMgrSession)
                                 .getArtifactManager();
 
                         result.addAll(
diff --git a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/DescriptorEditor.java b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/DescriptorEditor.java
index c8d42e5..68f29a5 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/DescriptorEditor.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/DescriptorEditor.java
@@ -1 +1 @@
-/*******************************************************************************
 * Copyright (c) 2007 Cisco Systems, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    E. Dillon (Cisco Systems, Inc.) - reformat for Code Open-Sourcing
 *******************************************************************************/
package org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.tigerstripe.workbench.TigerstripeException;
import org.eclipse.tigerstripe.workbench.internal.api.impl.TigerstripeProjectHandle;
import org.eclipse.tigerstripe.workbench.internal.core.project.TigerstripeProject;
import org.eclipse.tigerstripe.workbench.project.ITigerstripeModelProject;
import org.eclipse.tigerstripe.workbench.ui.EclipsePlugin;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.TigerstripeFormEditor;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.TigerstripeFormPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.advanced.AdvancedConfigurationPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.dependencies.DescriptorDependenciesPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.depsdiagram.ITigerstripeProjectProvider;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.depsdiagram.TigerstripeDependenciesDiagram;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.facetRefs.FacetReferencesPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.header.OverviewPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.plugins.PluginConfigurationPage;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.FileEditorInput;

/**
 * Main editor for module project descriptor file (tigersripe.xml file) <br/>
 * <br/>
 * 
 * <b>History of changes</b> (Name: Modification): <br/>
 * Eric Dillon : Initial Creation <br/>
 * Navid Mehregani: Bugzilla 319768: Switch to dependencies tab, if there are
 * related issues. <br/>
 * Navid Mehregani: Bugzilla 323860 - [Form Editor] In some cases Tigerstripe
 * files cannot be saved <br/>
 * Navid Mehregani: Bugzilla 313726 - Tigerstripe.XML Editor doesn't save <br/>
 */
public class DescriptorEditor extends TigerstripeFormEditor {

	private int sourcePageIndex;

	private boolean previousPageWasModel = true;

	private Collection<TigerstripeFormPage> modelPages = new ArrayList<TigerstripeFormPage>();

	private DescriptorSourcePage sourcePage;

	private ITigerstripeModelProject workingHandle;

	private void updateTitle() {
		IEditorInput input = getEditorInput();
		if (input instanceof IFileEditorInput) {
			setPartName(((IResource) input.getAdapter(IResource.class))
					.getProject().getName() + "/" + input.getName());
		} else {
			setPartName(input.getName());
		}
	}

	@Override
	public Object getViewPartInput() {
		IJavaProject jProject = null;

		IResource res = (IResource) getEditorInput()
				.getAdapter(IResource.class);
		if (res != null) {
			IProject project = res.getProject();
			jProject = JavaCore.create(project);
		}
		return jProject;
	}

	@Override
	public void addPages() {
		int headerIndex = -1;
		IFile file = null;
		int dependencyPageIndex = -1;

		try {
			PluginConfigurationPage pluginPage = new PluginConfigurationPage(
					this);

			OverviewPage overPage = new OverviewPage(this);
			headerIndex = addPage(overPage);
			addModelPage(overPage);

			addPage(pluginPage);
			addModelPage(pluginPage);

			if (getEditorInput() instanceof IFileEditorInput) {

				IFileEditorInput fileEditorInput = (IFileEditorInput) getEditorInput();
				file = fileEditorInput.getFile();

				DescriptorDependenciesPage depPage = new DescriptorDependenciesPage(
						this);
				dependencyPageIndex = addPage(depPage);
				addDependencyDiagramPage();
				addModelPage(depPage);

				AdvancedConfigurationPage advPage = new AdvancedConfigurationPage(
						this);
				addPage(advPage);
				addModelPage(advPage);

				FacetReferencesPage facetPage = new FacetReferencesPage(this);
				addPage(facetPage);
				addModelPage(facetPage);

				addSourcePage();
			}

		} catch (PartInitException e) {
			EclipsePlugin.log(e);
		}

		// N.M: Bugzilla 319768: Switch to dependencies tab, if there are
		// related issues.
		if (areThereDependencyProblems(file) && dependencyPageIndex != -1)
			setActivePage(dependencyPageIndex);
		else
			setActivePage(headerIndex);

		updateTitle();
	}

	private void addDependencyDiagramPage() {
		diagramEditor = new TigerstripeDependenciesDiagram();
		diagramEditor.setProjectProvider(new ITigerstripeProjectProvider() {

			public ITigerstripeModelProject getProject() {
				return getTSProject();
			}
		});

		try {
			setPageText(addPage(diagramEditor, getEditorInput()),
					"Dependency Diagram");
		} catch (PartInitException e) {
			EclipsePlugin.log(e);
		}
	}

	// N.M: Bugzilla 319768: Switch to dependencies tab, if there are related
	// issues.
	private boolean areThereDependencyProblems(IFile file) {

		try {
			if (file != null) {
				final String DEPENDENCY_ERROR = "Unresolved model reference";
				IMarker[] markers = file.findMarkers(IMarker.PROBLEM, true,
						IResource.DEPTH_INFINITE);

				if (markers != null) {
					for (int i = 0; i < markers.length; i++) {
						if (IMarker.SEVERITY_ERROR == markers[i].getAttribute(
								IMarker.SEVERITY, IMarker.SEVERITY_INFO)) {
							final Object errorMessage = markers[i]
									.getAttribute(IMarker.MESSAGE);
							if ((errorMessage instanceof String)
									&& (((String) errorMessage)
											.contains(DEPENDENCY_ERROR))) {
								return true;
							}
						}
					}
				}
			}
		} catch (CoreException e) {
			EclipsePlugin
					.logErrorMessage(
							"An error occurred while looking for dependency errors.  Exception Message (if any): "
									+ e.getMessage(), e);
		}

		return false;
	}

	protected void addSourcePage() throws PartInitException {
		sourcePage = new DescriptorSourcePage(this, "id", "Source");
		sourcePageIndex = addPage(sourcePage, getEditorInput());
		setPageText(sourcePageIndex, "Source");
	}

	@Override
	public void doSave(IProgressMonitor monitor) {
		// N.M: Bugzilla 323860 - [Form Editor] In some cases Tigerstripe files
		// cannot be saved
		if ((sourcePage.isDirty()) || (getActivePage() == sourcePageIndex)) {
			try {
				updateModelFromTextEditor();

			} catch (TigerstripeException ee) {
				Status status = new Status(IStatus.WARNING,
						EclipsePlugin.getPluginId(), 111,
						"Unexpected Exception", ee);
				EclipsePlugin.log(status);
			}
			sourcePage.doSave(monitor);

		} else {

			try {
				getTSProject().commit(monitor);
			} catch (TigerstripeException ee) {
				EclipsePlugin.log(ee);
			}
		}
		diagramEditor.doSave(monitor);
		if (getActivePage() != sourcePageIndex) {
			((DescriptorSourcePage) getEditor(sourcePageIndex))
					.firePropertyChange(IEditorPart.PROP_DIRTY);
		}
		firePropertyChange(IEditorPart.PROP_DIRTY);
	}

	@Override
	public void pageChange(int newPageIndex) {
		if (newPageIndex == sourcePageIndex) {
			if (isPageModified)
				updateTextEditorFromModel();
			previousPageWasModel = false;
		} else {
			if (!previousPageWasModel && isDirty()) {
				try {
					updateModelFromTextEditor();
				} catch (TigerstripeException ee) {
					Status status = new Status(IStatus.WARNING,
							EclipsePlugin.getPluginId(), 111,
							"Unexpected Exception", ee);
					EclipsePlugin.log(status);
				}
			}
			previousPageWasModel = true;
		}
		super.pageChange(newPageIndex);
	}

	private boolean isPageModified;

	private TigerstripeDependenciesDiagram diagramEditor;

	private final Set<ITigerstripeModelProject> toCleanUp = new HashSet<ITigerstripeModelProject>();

	public void pageModified() {
		isPageModified = true;
		if (!super.isDirty())
			firePropertyChange(IEditorPart.PROP_DIRTY);
	}

	@Override
	protected void handlePropertyChange(int propertyId) {
		super.handlePropertyChange(propertyId);
		if (propertyId == IEditorPart.PROP_DIRTY)
			isPageModified = super.isDirty();
	}

	@Override
	public boolean isDirty() {

		// N.M: Bugzilla 323860 - [Form Editor] In some cases Tigerstripe files
		// cannot be saved
		if (getActivePage() == sourcePageIndex) {
			if (sourcePage == null)
				return false;
			return sourcePage.isDirty();
		}

		return isPageModified || super.isDirty();
	}

	protected void addModelPage(TigerstripeFormPage page) {
		modelPages.add(page);
	}

	private void refreshModelPages() {
		for (TigerstripeFormPage page : modelPages) {
			page.refresh();
		}
	}

	private void updateTextEditorFromModel() {
		try {
			if (getEditorInput() instanceof FileEditorInput) {
				TigerstripeProjectHandle projectHandle = (TigerstripeProjectHandle) getTSProject();
				TigerstripeProject project = projectHandle.getTSProject();

				sourcePage.getDocumentProvider().getDocument(getEditorInput())
						.set(project.asText());
			}
		} catch (TigerstripeException e) {
			Status status = new Status(IStatus.ERROR,
					EclipsePlugin.getPluginId(), 222,
					"Error refreshing source page for Tigerstripe descriptor",
					e);
			EclipsePlugin.log(status);
		}
	}

	private void updateModelFromTextEditor() throws TigerstripeException {
		if (getEditorInput() instanceof FileEditorInput) {
			TigerstripeProjectHandle projectHandle = (TigerstripeProjectHandle) getTSProject();
			TigerstripeProject originalProject = projectHandle.getTSProject();

			String text = sourcePage.getDocumentProvider()
					.getDocument(getEditorInput()).get();
			StringReader reader = new StringReader(text);
			try {
				originalProject.parse(reader);
				refreshModelPages();
			} catch (TigerstripeException e) {
				Status status = new Status(
						IStatus.ERROR,
						EclipsePlugin.getPluginId(),
						222,
						"Error refreshing model pages for Tigerstripe descriptor",
						e);
				EclipsePlugin.log(status);
			}
		}
	}

	@Override
	protected void setInput(IEditorInput input) {
		IEditorInput oldinput = getEditorInput();
		if (oldinput instanceof ReadOnlyDescriptorEditorInput) {
			((ReadOnlyDescriptorEditorInput) oldinput).dispose();
		}
		super.setInput(input);
	}
	
	public ITigerstripeModelProject getTSProject() {
		if (workingHandle == null) {
			IEditorInput input = getEditorInput();
			ITigerstripeModelProject handle = null;
			if (input instanceof IFileEditorInput) {
				IFileEditorInput fileInput = (IFileEditorInput) input;
				handle = (ITigerstripeModelProject) fileInput.getFile()
						.getAdapter(ITigerstripeModelProject.class);
				if (handle != null) {
					// Create a working Copy where we substitute a new object
					// for the underlying TigerstripeProject
					try {
						workingHandle = (ITigerstripeModelProject) handle
								.makeWorkingCopy(null);
						toCleanUp.add(workingHandle);

					} catch (TigerstripeException e) {
						return null;
					}
				}
			} else if (input instanceof ReadOnlyDescriptorEditorInput) {
				ReadOnlyDescriptorEditorInput descInput = (ReadOnlyDescriptorEditorInput) input;
				workingHandle = descInput.getTSProject();
			}
		}
		return workingHandle;
	}

	@Override
	public void dispose() {
		super.dispose();
		cleanUp();
		IEditorInput oldinput = getEditorInput();
		if (oldinput instanceof ReadOnlyDescriptorEditorInput) {
			((ReadOnlyDescriptorEditorInput) oldinput).dispose();
		}
	}

	private void cleanUp() {
		final Iterator<ITigerstripeModelProject> it = toCleanUp.iterator();
		while (it.hasNext()) {
			ITigerstripeModelProject next = it.next();
			try {
				next.dispose();
			} catch (Exception e) {
				EclipsePlugin.log(e);
			}
			it.remove();
		}
	}

	@Override
	public void resourceChanged(IResourceChangeEvent event) {
		super.resourceChanged(event);

		if (getEditorInput() instanceof IFileEditorInput) {
			IResourceDelta selfDelta = lookforSelf(event.getDelta());

			if (selfDelta != null) {
				if (selfDelta.getKind() != IResourceDelta.REMOVED) {
					workingHandle = null;
					cleanUp();
					refreshModelPages();
				}
			}
		}

	}

}
\ No newline at end of file
+/*******************************************************************************
 * Copyright (c) 2007 Cisco Systems, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    E. Dillon (Cisco Systems, Inc.) - reformat for Code Open-Sourcing
 *******************************************************************************/
package org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.tigerstripe.workbench.TigerstripeException;
import org.eclipse.tigerstripe.workbench.internal.api.impl.TigerstripeProjectHandle;
import org.eclipse.tigerstripe.workbench.internal.core.project.TigerstripeProject;
import org.eclipse.tigerstripe.workbench.project.ITigerstripeModelProject;
import org.eclipse.tigerstripe.workbench.ui.EclipsePlugin;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.TigerstripeFormEditor;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.TigerstripeFormPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.advanced.AdvancedConfigurationPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.dependencies.DescriptorDependenciesPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.depsdiagram.ITigerstripeProjectProvider;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.depsdiagram.TigerstripeDependenciesDiagram;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.facetRefs.FacetReferencesPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.header.OverviewPage;
import org.eclipse.tigerstripe.workbench.ui.internal.editors.descriptor.plugins.PluginConfigurationPage;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.FileEditorInput;

/**
 * Main editor for module project descriptor file (tigersripe.xml file) <br/>
 * <br/>
 * 
 * <b>History of changes</b> (Name: Modification): <br/>
 * Eric Dillon : Initial Creation <br/>
 * Navid Mehregani: Bugzilla 319768: Switch to dependencies tab, if there are
 * related issues. <br/>
 * Navid Mehregani: Bugzilla 323860 - [Form Editor] In some cases Tigerstripe
 * files cannot be saved <br/>
 * Navid Mehregani: Bugzilla 313726 - Tigerstripe.XML Editor doesn't save <br/>
 */
public class DescriptorEditor extends TigerstripeFormEditor {

	private int sourcePageIndex;

	private boolean previousPageWasModel = true;

	private Collection<TigerstripeFormPage> modelPages = new ArrayList<TigerstripeFormPage>();

	private DescriptorSourcePage sourcePage;

	private ITigerstripeModelProject workingHandle;

	private void updateTitle() {
		IEditorInput input = getEditorInput();
		if (input instanceof IFileEditorInput) {
			setPartName(((IResource) input.getAdapter(IResource.class))
					.getProject().getName() + "/" + input.getName());
		} else {
			setPartName(input.getName());
		}
	}

	@Override
	public Object getViewPartInput() {
		IJavaProject jProject = null;

		IResource res = (IResource) getEditorInput()
				.getAdapter(IResource.class);
		if (res != null) {
			IProject project = res.getProject();
			jProject = JavaCore.create(project);
		}
		return jProject;
	}

	@Override
	public void addPages() {
		int headerIndex = -1;
		IFile file = null;
		int dependencyPageIndex = -1;

		try {
			PluginConfigurationPage pluginPage = new PluginConfigurationPage(
					this);

			OverviewPage overPage = new OverviewPage(this);
			headerIndex = addPage(overPage);
			addModelPage(overPage);

			addPage(pluginPage);
			addModelPage(pluginPage);

			if (getEditorInput() instanceof IFileEditorInput) {

				IFileEditorInput fileEditorInput = (IFileEditorInput) getEditorInput();
				file = fileEditorInput.getFile();

				DescriptorDependenciesPage depPage = new DescriptorDependenciesPage(
						this);
				dependencyPageIndex = addPage(depPage);
				addDependencyDiagramPage();
				addModelPage(depPage);

				AdvancedConfigurationPage advPage = new AdvancedConfigurationPage(
						this);
				addPage(advPage);
				addModelPage(advPage);

				FacetReferencesPage facetPage = new FacetReferencesPage(this);
				addPage(facetPage);
				addModelPage(facetPage);

				addSourcePage();
			}

		} catch (PartInitException e) {
			EclipsePlugin.log(e);
		}

		// N.M: Bugzilla 319768: Switch to dependencies tab, if there are
		// related issues.
		if (areThereDependencyProblems(file) && dependencyPageIndex != -1)
			setActivePage(dependencyPageIndex);
		else
			setActivePage(headerIndex);

		updateTitle();
	}

	private void addDependencyDiagramPage() {
		diagramEditor = new TigerstripeDependenciesDiagram();
		diagramEditor.setProjectProvider(new ITigerstripeProjectProvider() {

			public ITigerstripeModelProject getProject() {
				return getTSProject();
			}
		});

		try {
			setPageText(addPage(diagramEditor, getEditorInput()),
					"Dependency Diagram");
		} catch (PartInitException e) {
			EclipsePlugin.log(e);
		}
	}

	// N.M: Bugzilla 319768: Switch to dependencies tab, if there are related
	// issues.
	private boolean areThereDependencyProblems(IFile file) {

		try {
			if (file != null) {
				final String DEPENDENCY_ERROR = "Unresolved model reference";
				IMarker[] markers = file.findMarkers(IMarker.PROBLEM, true,
						IResource.DEPTH_INFINITE);

				if (markers != null) {
					for (int i = 0; i < markers.length; i++) {
						if (IMarker.SEVERITY_ERROR == markers[i].getAttribute(
								IMarker.SEVERITY, IMarker.SEVERITY_INFO)) {
							final Object errorMessage = markers[i]
									.getAttribute(IMarker.MESSAGE);
							if ((errorMessage instanceof String)
									&& (((String) errorMessage)
											.contains(DEPENDENCY_ERROR))) {
								return true;
							}
						}
					}
				}
			}
		} catch (CoreException e) {
			EclipsePlugin
					.logErrorMessage(
							"An error occurred while looking for dependency errors.  Exception Message (if any): "
									+ e.getMessage(), e);
		}

		return false;
	}

	protected void addSourcePage() throws PartInitException {
		sourcePage = new DescriptorSourcePage(this, "id", "Source");
		sourcePageIndex = addPage(sourcePage, getEditorInput());
		setPageText(sourcePageIndex, "Source");
	}

	@Override
	public void doSave(IProgressMonitor monitor) {
		// N.M: Bugzilla 323860 - [Form Editor] In some cases Tigerstripe files
		// cannot be saved
		if ((sourcePage.isDirty()) || (getActivePage() == sourcePageIndex)) {
			try {
				updateModelFromTextEditor();

			} catch (TigerstripeException ee) {
				Status status = new Status(IStatus.WARNING,
						EclipsePlugin.getPluginId(), 111,
						"Unexpected Exception", ee);
				EclipsePlugin.log(status);
			}
			sourcePage.doSave(monitor);

		} else {

			try {
				getTSProject().commit(monitor);
			} catch (TigerstripeException ee) {
				EclipsePlugin.log(ee);
			}
		}
		diagramEditor.doSave(monitor);
		if (getActivePage() != sourcePageIndex) {
			((DescriptorSourcePage) getEditor(sourcePageIndex))
					.firePropertyChange(IEditorPart.PROP_DIRTY);
		}
		firePropertyChange(IEditorPart.PROP_DIRTY);
	}

	@Override
	public void pageChange(int newPageIndex) {
		if (newPageIndex == sourcePageIndex) {
			if (isPageModified)
				updateTextEditorFromModel();
			previousPageWasModel = false;
		} else {
			if (!previousPageWasModel && isDirty()) {
				try {
					updateModelFromTextEditor();
				} catch (TigerstripeException ee) {
					Status status = new Status(IStatus.WARNING,
							EclipsePlugin.getPluginId(), 111,
							"Unexpected Exception", ee);
					EclipsePlugin.log(status);
				}
			}
			previousPageWasModel = true;
		}
		super.pageChange(newPageIndex);
	}

	private boolean isPageModified;

	private TigerstripeDependenciesDiagram diagramEditor;

	private final Set<ITigerstripeModelProject> toCleanUp = new HashSet<ITigerstripeModelProject>();

	public void pageModified() {
		isPageModified = true;
		if (!super.isDirty())
			firePropertyChange(IEditorPart.PROP_DIRTY);
	}

	@Override
	protected void handlePropertyChange(int propertyId) {
		super.handlePropertyChange(propertyId);
		if (propertyId == IEditorPart.PROP_DIRTY)
			isPageModified = super.isDirty();
	}

	@Override
	public boolean isDirty() {

		// N.M: Bugzilla 323860 - [Form Editor] In some cases Tigerstripe files
		// cannot be saved
		if (getActivePage() == sourcePageIndex) {
			if (sourcePage == null)
				return false;
			return sourcePage.isDirty();
		}

		return isPageModified || super.isDirty();
	}

	protected void addModelPage(TigerstripeFormPage page) {
		modelPages.add(page);
	}

	private void refreshModelPages() {
		for (TigerstripeFormPage page : modelPages) {
			page.refresh();
		}
	}

	private void updateTextEditorFromModel() {
		try {
			if (getEditorInput() instanceof FileEditorInput) {
				TigerstripeProjectHandle projectHandle = (TigerstripeProjectHandle) getTSProject();
				TigerstripeProject project = projectHandle.getTSProject();

				sourcePage.getDocumentProvider().getDocument(getEditorInput())
						.set(project.asText());
			}
		} catch (TigerstripeException e) {
			Status status = new Status(IStatus.ERROR,
					EclipsePlugin.getPluginId(), 222,
					"Error refreshing source page for Tigerstripe descriptor",
					e);
			EclipsePlugin.log(status);
		}
	}

	private void updateModelFromTextEditor() throws TigerstripeException {
		if (getEditorInput() instanceof FileEditorInput) {
			TigerstripeProjectHandle projectHandle = (TigerstripeProjectHandle) getTSProject();
			TigerstripeProject originalProject = projectHandle.getTSProject();

			String text = sourcePage.getDocumentProvider()
					.getDocument(getEditorInput()).get();
			StringReader reader = new StringReader(text);
			try {
				originalProject.parse(reader);
				refreshModelPages();
			} catch (TigerstripeException e) {
				Status status = new Status(
						IStatus.ERROR,
						EclipsePlugin.getPluginId(),
						222,
						"Error refreshing model pages for Tigerstripe descriptor",
						e);
				EclipsePlugin.log(status);
			}
		}
	}

	@Override
	protected void setInput(IEditorInput input) {
		IEditorInput oldinput = getEditorInput();
		if (oldinput instanceof ReadOnlyDescriptorEditorInput) {
			((ReadOnlyDescriptorEditorInput) oldinput).dispose();
		}
		super.setInput(input);
	}
	
	public ITigerstripeModelProject getTSProject() {
		if (workingHandle == null) {
			IEditorInput input = getEditorInput();
			ITigerstripeModelProject handle = null;
			if (input instanceof IFileEditorInput) {
				IFileEditorInput fileInput = (IFileEditorInput) input;
				handle = fileInput.getFile()
						.getAdapter(ITigerstripeModelProject.class);
				if (handle != null) {
					// Create a working Copy where we substitute a new object
					// for the underlying TigerstripeProject
					try {
						workingHandle = (ITigerstripeModelProject) handle
								.makeWorkingCopy(null);
						toCleanUp.add(workingHandle);

					} catch (TigerstripeException e) {
						return null;
					}
				}
			} else if (input instanceof ReadOnlyDescriptorEditorInput) {
				ReadOnlyDescriptorEditorInput descInput = (ReadOnlyDescriptorEditorInput) input;
				workingHandle = descInput.getTSProject();
			}
		}
		return workingHandle;
	}

	@Override
	public void dispose() {
		super.dispose();
		cleanUp();
		IEditorInput oldinput = getEditorInput();
		if (oldinput instanceof ReadOnlyDescriptorEditorInput) {
			((ReadOnlyDescriptorEditorInput) oldinput).dispose();
		}
	}

	private void cleanUp() {
		final Iterator<ITigerstripeModelProject> it = toCleanUp.iterator();
		while (it.hasNext()) {
			ITigerstripeModelProject next = it.next();
			try {
				next.dispose();
			} catch (Exception e) {
				EclipsePlugin.log(e);
			}
			it.remove();
		}
	}

	@Override
	public void resourceChanged(IResourceChangeEvent event) {
		super.resourceChanged(event);

		if (getEditorInput() instanceof IFileEditorInput) {
			IResourceDelta selfDelta = lookforSelf(event.getDelta());

			if (selfDelta != null) {
				if (selfDelta.getKind() != IResourceDelta.REMOVED) {
					workingHandle = null;
					cleanUp();
					refreshModelPages();
				}
			}
		}

	}

}
\ No newline at end of file
diff --git a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/depsdiagram/TigerstripeDependenciesDiagram.java b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/depsdiagram/TigerstripeDependenciesDiagram.java
index fea4dcd..55c2f54 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/depsdiagram/TigerstripeDependenciesDiagram.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/depsdiagram/TigerstripeDependenciesDiagram.java
@@ -25,7 +25,7 @@
 	@Override
 	protected ITigerstripeModelProject getTSProject(IEditorInput input) {
 		if (projectProvider == null) {
-			return (ITigerstripeModelProject) ((IFileEditorInput) input)
+			return ((IFileEditorInput) input)
 					.getFile().getAdapter(ITigerstripeModelProject.class);
 		} else {
 			return projectProvider.getProject();
diff --git a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/depsdiagram/TigerstripeSubjectsFactory.java b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/depsdiagram/TigerstripeSubjectsFactory.java
index c321457..e95da6e 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/depsdiagram/TigerstripeSubjectsFactory.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/editors/descriptor/depsdiagram/TigerstripeSubjectsFactory.java
@@ -66,6 +66,9 @@
 
 	public IDependencySubject getSubject(ITigerstripeModelProject project)
 			throws TigerstripeException {
+//	    if (project == null) {
+//	        return null;
+//	    }
 		if (project.isWorkingCopy()) {
 			project = (ITigerstripeModelProject) project.getOriginal();
 		}
diff --git a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/gmf/synchronization/ProjectDiagramsSynchronizer.java b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/gmf/synchronization/ProjectDiagramsSynchronizer.java
index 0f07efb..1609ea0 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/gmf/synchronization/ProjectDiagramsSynchronizer.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.ui.base/src/java/org/eclipse/tigerstripe/workbench/ui/internal/gmf/synchronization/ProjectDiagramsSynchronizer.java
@@ -64,586 +64,593 @@
  * @since Bug 936
  */
 public class ProjectDiagramsSynchronizer implements IArtifactChangeListener,
-		IResourceChangeListener {
+IResourceChangeListener {
 
-	protected Queue requestQueue = new Queue();
-	private Comparer comp = new Comparer();
+    protected Queue requestQueue = new Queue();
+    private Comparer comp = new Comparer();
 
-	// Each time a change occurs, this synchronizer gets notified and queues
-	// queues up the corresponding synchronization request to be executed.
-	// The requests are being picked up in a single separate job for this
-	// synchronizer.
-	abstract class SynchronizationRequest {
-		protected DiagramHandle[] affectedDiagrams;
+    // Each time a change occurs, this synchronizer gets notified and queues
+    // queues up the corresponding synchronization request to be executed.
+    // The requests are being picked up in a single separate job for this
+    // synchronizer.
+    abstract class SynchronizationRequest {
+        protected DiagramHandle[] affectedDiagrams;
 
-		protected SynchronizationRequest(DiagramHandle[] affectedDiagrams) {
-			this.affectedDiagrams = affectedDiagrams;
-		}
+        protected SynchronizationRequest(DiagramHandle[] affectedDiagrams) {
+            this.affectedDiagrams = affectedDiagrams;
+        }
 
-		public abstract IStatus run(IProgressMonitor monitor)
-				throws TigerstripeException;
-	}
+        public abstract IStatus run(IProgressMonitor monitor)
+                throws TigerstripeException;
+    }
 
-	class SynchronizationForArtifactChangedRequest extends
-			SynchronizationRequest {
-		private IAbstractArtifact artifact;
+    class SynchronizationForArtifactChangedRequest extends
+    SynchronizationRequest {
+        private IAbstractArtifact artifact;
 
-		public SynchronizationForArtifactChangedRequest(
-				IAbstractArtifact artifact, DiagramHandle[] affectedDiagrams) {
-			super(affectedDiagrams);
-			this.artifact = artifact;
-		}
+        public SynchronizationForArtifactChangedRequest(
+                IAbstractArtifact artifact, DiagramHandle[] affectedDiagrams) {
+            super(affectedDiagrams);
+            this.artifact = artifact;
+        }
 
-		public IStatus run(IProgressMonitor monitor)
-				throws TigerstripeException {
-			List<IStatus> statuses = new ArrayList<IStatus>();
-			for (DiagramHandle handle : affectedDiagrams) {
-				try {
-					handle.updateForChange(artifact);
-				} catch (TigerstripeException e) {
-					statuses.add(new Status(IStatus.ERROR, EclipsePlugin
-							.getPluginId(), 222, e.getMessage(), e));
-				}
-			}
-			if (statuses.size() == 0)
-				return Status.OK_STATUS;
-			else {
-				MultiStatus mStatus = new MultiStatus(
-						EclipsePlugin.getPluginId(), 222,
-						statuses.toArray(new IStatus[statuses.size()]),
-						"Error occurred while synchronizing diagrams", null);
-				return mStatus;
-			}
-		}
-	}
+        public IStatus run(IProgressMonitor monitor)
+                throws TigerstripeException {
+            List<IStatus> statuses = new ArrayList<IStatus>();
+            for (DiagramHandle handle : affectedDiagrams) {
+                try {
+                    handle.updateForChange(artifact);
+                } catch (TigerstripeException e) {
+                    statuses.add(new Status(IStatus.ERROR, EclipsePlugin
+                            .getPluginId(), 222, e.getMessage(), e));
+                }
+            }
+            if (statuses.size() == 0)
+                return Status.OK_STATUS;
+            else {
+                MultiStatus mStatus = new MultiStatus(
+                        EclipsePlugin.getPluginId(), 222,
+                        statuses.toArray(new IStatus[statuses.size()]),
+                        "Error occurred while synchronizing diagrams", null);
+                return mStatus;
+            }
+        }
+    }
 
-	class SynchronizationForArtifactRemovedRequest extends
-			SynchronizationRequest {
-		protected String removedFQN;
+    class SynchronizationForArtifactRemovedRequest extends
+    SynchronizationRequest {
+        protected String removedFQN;
 
-		public SynchronizationForArtifactRemovedRequest(String removedFQN,
-				DiagramHandle[] affectedDiagrams) {
-			super(affectedDiagrams);
-			this.removedFQN = removedFQN;
-		}
+        public SynchronizationForArtifactRemovedRequest(String removedFQN,
+                DiagramHandle[] affectedDiagrams) {
+            super(affectedDiagrams);
+            this.removedFQN = removedFQN;
+        }
 
-		public IStatus run(IProgressMonitor monitor) {
-			List<IStatus> statuses = new ArrayList<IStatus>();
-			for (DiagramHandle handle : affectedDiagrams) {
-				try {
-					handle.updateForRemove(removedFQN);
-				} catch (TigerstripeException e) {
-					statuses.add(new Status(IStatus.ERROR, EclipsePlugin
-							.getPluginId(), 222, e.getMessage(), e));
-				}
-			}
-			if (statuses.size() == 0)
-				return Status.OK_STATUS;
-			else {
-				MultiStatus mStatus = new MultiStatus(
-						EclipsePlugin.getPluginId(), 222,
-						statuses.toArray(new IStatus[statuses.size()]),
-						"Error occurred while synchronizing diagrams", null);
-				return mStatus;
-			}
-		}
+        public IStatus run(IProgressMonitor monitor) {
+            List<IStatus> statuses = new ArrayList<IStatus>();
+            for (DiagramHandle handle : affectedDiagrams) {
+                try {
+                    handle.updateForRemove(removedFQN);
+                } catch (TigerstripeException e) {
+                    statuses.add(new Status(IStatus.ERROR, EclipsePlugin
+                            .getPluginId(), 222, e.getMessage(), e));
+                }
+            }
+            if (statuses.size() == 0)
+                return Status.OK_STATUS;
+            else {
+                MultiStatus mStatus = new MultiStatus(
+                        EclipsePlugin.getPluginId(), 222,
+                        statuses.toArray(new IStatus[statuses.size()]),
+                        "Error occurred while synchronizing diagrams", null);
+                return mStatus;
+            }
+        }
 
-	}
+    }
 
-	class SynchronizationForArtifactRenamedRequest extends
-			SynchronizationRequest {
-		protected String oldFQN;
-		protected String newFQN;
+    class SynchronizationForArtifactRenamedRequest extends
+    SynchronizationRequest {
+        protected String oldFQN;
+        protected String newFQN;
 
-		public SynchronizationForArtifactRenamedRequest(String oldFQN,
-				String newFQN, DiagramHandle[] affectedDiagrams) {
-			super(affectedDiagrams);
-			this.oldFQN = oldFQN;
-			this.newFQN = newFQN;
-		}
+        public SynchronizationForArtifactRenamedRequest(String oldFQN,
+                String newFQN, DiagramHandle[] affectedDiagrams) {
+            super(affectedDiagrams);
+            this.oldFQN = oldFQN;
+            this.newFQN = newFQN;
+        }
 
-		public IStatus run(IProgressMonitor monitor) {
-			List<IStatus> statuses = new ArrayList<IStatus>();
-			for (DiagramHandle handle : affectedDiagrams) {
-				try {
-					handle.updateForRename(oldFQN, newFQN);
-				} catch (TigerstripeException e) {
-					statuses.add(new Status(IStatus.ERROR, EclipsePlugin
-							.getPluginId(), 222, e.getMessage(), e));
-				}
-			}
-			if (statuses.size() == 0)
-				return Status.OK_STATUS;
-			else {
-				MultiStatus mStatus = new MultiStatus(
-						EclipsePlugin.getPluginId(), 222,
-						statuses.toArray(new IStatus[statuses.size()]),
-						"Error occurred while synchronizing diagrams", null);
-				return mStatus;
-			}
-		}
+        public IStatus run(IProgressMonitor monitor) {
+            List<IStatus> statuses = new ArrayList<IStatus>();
+            for (DiagramHandle handle : affectedDiagrams) {
+                try {
+                    handle.updateForRename(oldFQN, newFQN);
+                } catch (TigerstripeException e) {
+                    statuses.add(new Status(IStatus.ERROR, EclipsePlugin
+                            .getPluginId(), 222, e.getMessage(), e));
+                }
+            }
+            if (statuses.size() == 0)
+                return Status.OK_STATUS;
+            else {
+                MultiStatus mStatus = new MultiStatus(
+                        EclipsePlugin.getPluginId(), 222,
+                        statuses.toArray(new IStatus[statuses.size()]),
+                        "Error occurred while synchronizing diagrams", null);
+                return mStatus;
+            }
+        }
 
-	}
+    }
 
-	private ITigerstripeModelProject project;
+    private ITigerstripeModelProject project;
 
-	private DiagramHandleIndex diagramIndex = new DiagramHandleIndex(this);
+    private DiagramHandleIndex diagramIndex = new DiagramHandleIndex(this);
 
-	private HashMap<IResource, DiagramHandle> handlesByDiagram = new HashMap<IResource, DiagramHandle>();
+    private HashMap<IResource, DiagramHandle> handlesByDiagram = new HashMap<IResource, DiagramHandle>();
 
-	private final String[] diagramFileExtensions = {
-			ClassDiagramLogicalNode.DIAG_EXT,
-			InstanceDiagramLogicalNode.DIAG_EXT }; // FIXME: use extension
+    private final String[] diagramFileExtensions = {
+            ClassDiagramLogicalNode.DIAG_EXT,
+            InstanceDiagramLogicalNode.DIAG_EXT }; // FIXME: use extension
 
-	private final String[] modelFileExtensions = {
-			ClassDiagramLogicalNode.MODEL_EXT,
-			InstanceDiagramLogicalNode.MODEL_EXT }; // FIXME: use extension
+    private final String[] modelFileExtensions = {
+            ClassDiagramLogicalNode.MODEL_EXT,
+            InstanceDiagramLogicalNode.MODEL_EXT }; // FIXME: use extension
 
-	private Job batchSyncJob;
-	private boolean enabled = true;
+    private Job batchSyncJob;
+    private boolean enabled = true;
 
-	ProjectDiagramsSynchronizer(ITigerstripeModelProject project) {
-		this.project = project;
-	}
+    ProjectDiagramsSynchronizer(ITigerstripeModelProject project) {
+        this.project = project;
+    }
 
-	public void initialize() {
-		// Create batch synchronization job
-		batchSyncJob = new Job("Diagram Synchronization (" + project.getName()
-				+ ")") {
-			protected IStatus run(IProgressMonitor monitor) {
-				if (monitor.isCanceled()) {
-					return Status.CANCEL_STATUS;
-				}
-				try {
-					if (!DiagramSynchronizationManager.getInstance()
-							.isSynchronizationHeld())
-						return flushRequestQueue(true, monitor);
-					return Status.OK_STATUS;
-				} finally {
-					schedule(1000); // start again...
-				}
-			}
-		};
-		batchSyncJob.setSystem(true);
-		batchSyncJob.schedule(); // start as soon as possible
+    public void initialize() {
+        // Create batch synchronization job
+        batchSyncJob = new Job("Diagram Synchronization (" + project.getName()
+        + ")") {
+            protected IStatus run(IProgressMonitor monitor) {
+                if (monitor.isCanceled()) {
+                    return Status.CANCEL_STATUS;
+                }
+                try {
+                    if (!DiagramSynchronizationManager.getInstance()
+                            .isSynchronizationHeld())
+                        return flushRequestQueue(true, monitor);
+                    return Status.OK_STATUS;
+                } finally {
+                    schedule(1000); // start again...
+                }
+            }
+        };
+        batchSyncJob.setSystem(true);
+        batchSyncJob.schedule(); // start as soon as possible
 
-		registerSelfForChanges();
-		try {
-			Job initialIndexing = new Job("Indexing diagrams in "
-					+ getProject().getName()) {
-				@Override
-				protected IStatus run(IProgressMonitor monitor) {
-					initialize(monitor);
-					return Status.OK_STATUS;
-				}
-			};
+        registerSelfForChanges();
+        try {
+            Job initialIndexing = new Job("Indexing diagrams in "
+                    + getProject().getName()) {
+                @Override
+                protected IStatus run(IProgressMonitor monitor) {
+                    initialize(monitor);
+                    return Status.OK_STATUS;
+                }
+            };
 
-			initialIndexing.setRule(createInitialRule());
-			initialIndexing.schedule();
-		} catch (TigerstripeException e) {
-			EclipsePlugin.log(e);
-		}
-	}
+            initialIndexing.setRule(createInitialRule());
+            initialIndexing.schedule();
+        } catch (TigerstripeException e) {
+            EclipsePlugin.log(e);
+        }
+    }
 
-	public synchronized IStatus flushRequestQueue(boolean applyRequests,
-			IProgressMonitor monitor) {
+    public synchronized IStatus flushRequestQueue(boolean applyRequests,
+            IProgressMonitor monitor) {
 
-		Set<DiagramHandle> affectedDiagrams = new HashSet<DiagramHandle>();
-		while (!requestQueue.isEmpty()) {
-			try {
-				SynchronizationRequest request = (SynchronizationRequest) requestQueue
-						.dequeue();
-				request.run(new NullProgressMonitor());
-				if (request.affectedDiagrams.length != 0) {
-					affectedDiagrams.addAll(Arrays
-							.asList(request.affectedDiagrams));
-				}
-			} catch (TigerstripeException e) {
-				EclipsePlugin.log(e);
-			}
-			if (monitor.isCanceled()) {
-				return Status.CANCEL_STATUS;
-			}
-		}
+        Set<DiagramHandle> affectedDiagrams = new HashSet<DiagramHandle>();
+        while (!requestQueue.isEmpty()) {
+            try {
+                SynchronizationRequest request = (SynchronizationRequest) requestQueue
+                        .dequeue();
+                request.run(new NullProgressMonitor());
+                if (request.affectedDiagrams.length != 0) {
+                    affectedDiagrams.addAll(Arrays
+                            .asList(request.affectedDiagrams));
+                }
+            } catch (TigerstripeException e) {
+                EclipsePlugin.log(e);
+            }
+            if (monitor.isCanceled()) {
+                return Status.CANCEL_STATUS;
+            }
+        }
 
-		if (affectedDiagrams.size() != 0) {
-			for (DiagramHandle handle : affectedDiagrams)
-				try {
-					diagramIndex.diagramSaved(handle);
-				} catch (TigerstripeException e) {
-					EclipsePlugin.log(e);
-				}
-		}
-		return Status.OK_STATUS;
-	}
+        if (affectedDiagrams.size() != 0) {
+            for (DiagramHandle handle : affectedDiagrams)
+                try {
+                    diagramIndex.diagramSaved(handle);
+                } catch (TigerstripeException e) {
+                    EclipsePlugin.log(e);
+                }
+        }
+        return Status.OK_STATUS;
+    }
 
-	private ISchedulingRule createInitialRule() throws TigerstripeException {
-		List<IResource> modelFiles = getAllModelFiles();
-		ISchedulingRule combinedRule = null;
-		IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace()
-				.getRuleFactory();
-		for (IResource modelFile : modelFiles) {
-			ISchedulingRule rule = ruleFactory.createRule(modelFile);
-			combinedRule = MultiRule.combine(rule, combinedRule);
-		}
-		return combinedRule;
-	}
+    private ISchedulingRule createInitialRule() throws TigerstripeException {
+        List<IResource> modelFiles = getAllModelFiles();
+        ISchedulingRule combinedRule = null;
+        IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace()
+                .getRuleFactory();
+        for (IResource modelFile : modelFiles) {
+            ISchedulingRule rule = ruleFactory.createRule(modelFile);
+            combinedRule = MultiRule.combine(rule, combinedRule);
+        }
+        return combinedRule;
+    }
 
-	/**
-	 * Go thru all diagrams and create the DiagramHandles and synchronizer as
-	 * requried
-	 * 
-	 */
-	private void initialize(IProgressMonitor monitor) {
-		try {
-			createAllDiagramHandles(monitor);
-		} catch (TigerstripeException e) {
-			EclipsePlugin.log(e);
-		}
-	}
+    /**
+     * Go thru all diagrams and create the DiagramHandles and synchronizer as
+     * requried
+     * 
+     */
+    private void initialize(IProgressMonitor monitor) {
+        try {
+            createAllDiagramHandles(monitor);
+        } catch (TigerstripeException e) {
+            EclipsePlugin.log(e);
+        }
+    }
 
-	/**
-	 * A hook to allow for any clean up needed.
-	 * 
-	 */
-	public void dispose() throws TigerstripeException {
-		deregisterSelfForChanges();
-		batchSyncJob.cancel();
-	}
+    /**
+     * A hook to allow for any clean up needed.
+     * 
+     */
+    public void dispose() throws TigerstripeException {
+        deregisterSelfForChanges();
+        batchSyncJob.cancel();
+    }
 
-	public ITigerstripeModelProject getProject() {
-		return this.project;
-	}
+    public ITigerstripeModelProject getProject() {
+        return this.project;
+    }
 
-	// ==============================
+    // ==============================
 
-	/**
-	 * Ideally we should only register if we have any diagrams. ie If my project
-	 * has no diagrams then I don't really care about changes!
-	 * 
-	 * Not clear how this would ever get updated for changes in
-	 * ProjectReferences. Should we be implement
-	 * ProjectDependencyChangeListener?
-	 * 
-	 * Register self as a listener for model changes both as a
-	 * {@link IModelChangeListener} and an {@link IArtifactChangeListener}.
-	 * 
-	 */
-	private void registerSelfForChanges() {
-		ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+    /**
+     * Ideally we should only register if we have any diagrams. ie If my project
+     * has no diagrams then I don't really care about changes!
+     * 
+     * Not clear how this would ever get updated for changes in
+     * ProjectReferences. Should we be implement
+     * ProjectDependencyChangeListener?
+     * 
+     * Register self as a listener for model changes both as a
+     * {@link IModelChangeListener} and an {@link IArtifactChangeListener}.
+     * 
+     */
+    private void registerSelfForChanges() {
+        ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
 
-		try {
-		    IEditableArtifactManagerSession session = (IEditableArtifactManagerSession) getProject()
-					.getArtifactManagerSession();
-			session.addArtifactChangeListener(this);
+        try {
+            if ( getProject()
+                    .getArtifactManagerSession() instanceof IEditableArtifactManagerSession ) {
+                IEditableArtifactManagerSession session = (IEditableArtifactManagerSession) getProject()
+                        .getArtifactManagerSession();
+                session.addArtifactChangeListener(this);
 
-			// register for changes in all parent projects
-			for (ITigerstripeModelProject proj : getProject()
-					.getReferencedProjects()) {
-				((IEditableArtifactManagerSession) proj.getArtifactManagerSession())
-						.addArtifactChangeListener(this);
-			}
+                // register for changes in all parent projects
+                for (ITigerstripeModelProject proj : getProject()
+                        .getReferencedProjects()) {
+                    if (  proj.getArtifactManagerSession() instanceof IEditableArtifactManagerSession) {
+                        ((IEditableArtifactManagerSession) proj.getArtifactManagerSession())
+                        .addArtifactChangeListener(this);
+                    }
+                }
+            }
 
-		} catch (TigerstripeException e) {
-			IStatus status = new Status(
-					IStatus.ERROR,
-					EclipsePlugin.getPluginId(),
-					222,
-					"An error occured while trying to register ProjectDiagramSynchronizer. Diagrams may not be synchronized properly for project: "
-							+ getProject().getName(), e);
-			EclipsePlugin.log(status);
-		}
-	}
+        } catch (TigerstripeException e) {
+            IStatus status = new Status(
+                    IStatus.ERROR,
+                    EclipsePlugin.getPluginId(),
+                    222,
+                    "An error occured while trying to register ProjectDiagramSynchronizer. Diagrams may not be synchronized properly for project: "
+                            + getProject().getName(), e);
+            EclipsePlugin.log(status);
+        }
+    }
 
-	private void deregisterSelfForChanges() throws TigerstripeException {
-	    IEditableArtifactManagerSession session = (IEditableArtifactManagerSession) getProject()
-				.getArtifactManagerSession();
-		session.removeArtifactChangeListener(this);
-		ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
-	}
+    private void deregisterSelfForChanges() throws TigerstripeException {
+        if (  getProject().getArtifactManagerSession() instanceof IEditableArtifactManagerSession) {
+            IEditableArtifactManagerSession session = (IEditableArtifactManagerSession) getProject()
+                    .getArtifactManagerSession();
+            session.removeArtifactChangeListener(this);
+            ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+        }
+    }
 
-	protected void queueUpSynchronizationRequest(SynchronizationRequest request) {
-		requestQueue.enqueue(request);
-	}
+    protected void queueUpSynchronizationRequest(SynchronizationRequest request) {
+        requestQueue.enqueue(request);
+    }
 
-	// Artifact Change listener
-	public void artifactAdded(IAbstractArtifact artifact) {
-		// Artifacts can't be on any diagrams if they never existed before!
+    // Artifact Change listener
+    public void artifactAdded(IAbstractArtifact artifact) {
+        // Artifacts can't be on any diagrams if they never existed before!
 
-	}
+    }
 
-	public void artifactChanged(IAbstractArtifact artifact,
-			IAbstractArtifact oldArtifact) {
-		if (!enabled) {
-			return;
-		}
-		// compare the old and new first
-		// This moight be better done in the client, so that they will only
-		// bother with
-		// changes that interest them
-		if (handlesByDiagram.size() == 0) {
-			return;
-		}
-		try {
-			DiagramHandle[] affectedDiagrams = getAffectedDiagrams(artifact
-					.getFullyQualifiedName());
-			if (affectedDiagrams.length > 0) {
-				ArrayList<Difference> diffs = comp.compareArtifacts(
-						oldArtifact, artifact, true);
-				if (diffs.size() > 0) {
-					SynchronizationForArtifactChangedRequest request = new SynchronizationForArtifactChangedRequest(
-							artifact, affectedDiagrams);
-					queueUpSynchronizationRequest(request);
-				}
-			}
-		} catch (TigerstripeException e) {
-			EclipsePlugin.log(e);
-		}
-	}
+    public void artifactChanged(IAbstractArtifact artifact,
+            IAbstractArtifact oldArtifact) {
+        if (!enabled) {
+            return;
+        }
+        // compare the old and new first
+        // This moight be better done in the client, so that they will only
+        // bother with
+        // changes that interest them
+        if (handlesByDiagram.size() == 0) {
+            return;
+        }
+        try {
+            DiagramHandle[] affectedDiagrams = getAffectedDiagrams(artifact
+                    .getFullyQualifiedName());
+            if (affectedDiagrams.length > 0) {
+                ArrayList<Difference> diffs = comp.compareArtifacts(
+                        oldArtifact, artifact, true);
+                if (diffs.size() > 0) {
+                    SynchronizationForArtifactChangedRequest request = new SynchronizationForArtifactChangedRequest(
+                            artifact, affectedDiagrams);
+                    queueUpSynchronizationRequest(request);
+                }
+            }
+        } catch (TigerstripeException e) {
+            EclipsePlugin.log(e);
+        }
+    }
 
-	public void artifactRemoved(IAbstractArtifact artifact) {
-		if (!enabled) {
-			return;
-		}
-		try {
-			DiagramHandle[] affectedDiagrams = getAffectedDiagrams(artifact
-					.getFullyQualifiedName());
-			if (affectedDiagrams.length > 0) {
-				SynchronizationForArtifactRemovedRequest request = new SynchronizationForArtifactRemovedRequest(
-						artifact.getFullyQualifiedName(), affectedDiagrams);
-				queueUpSynchronizationRequest(request);
-			}
-		} catch (TigerstripeException e) {
-			EclipsePlugin.log(e);
-		}
-	}
+    public void artifactRemoved(IAbstractArtifact artifact) {
+        if (!enabled) {
+            return;
+        }
+        try {
+            DiagramHandle[] affectedDiagrams = getAffectedDiagrams(artifact
+                    .getFullyQualifiedName());
+            if (affectedDiagrams.length > 0) {
+                SynchronizationForArtifactRemovedRequest request = new SynchronizationForArtifactRemovedRequest(
+                        artifact.getFullyQualifiedName(), affectedDiagrams);
+                queueUpSynchronizationRequest(request);
+            }
+        } catch (TigerstripeException e) {
+            EclipsePlugin.log(e);
+        }
+    }
 
-	public void artifactRenamed(IAbstractArtifact artifact, String fromFQN) {
-		if (!enabled) {
-			return;
-		}
-		try {
-			DiagramHandle[] affectedDiagrams = getAffectedDiagrams(fromFQN);
-			if (affectedDiagrams.length > 0) {
-				SynchronizationForArtifactRenamedRequest request = new SynchronizationForArtifactRenamedRequest(
-						fromFQN, artifact.getFullyQualifiedName(),
-						affectedDiagrams);
-				queueUpSynchronizationRequest(request);
-				// Bug 327698 - Need to make sure any internal references in the
-				// artifact to itself gets updated
-				SynchronizationForArtifactChangedRequest changeRequest = new SynchronizationForArtifactChangedRequest(
-						artifact, affectedDiagrams);
-				queueUpSynchronizationRequest(changeRequest);
-			}
-		} catch (TigerstripeException e) {
-			EclipsePlugin.log(e);
-		}
-	}
+    public void artifactRenamed(IAbstractArtifact artifact, String fromFQN) {
+        if (!enabled) {
+            return;
+        }
+        try {
+            DiagramHandle[] affectedDiagrams = getAffectedDiagrams(fromFQN);
+            if (affectedDiagrams.length > 0) {
+                SynchronizationForArtifactRenamedRequest request = new SynchronizationForArtifactRenamedRequest(
+                        fromFQN, artifact.getFullyQualifiedName(),
+                        affectedDiagrams);
+                queueUpSynchronizationRequest(request);
+                // Bug 327698 - Need to make sure any internal references in the
+                // artifact to itself gets updated
+                SynchronizationForArtifactChangedRequest changeRequest = new SynchronizationForArtifactChangedRequest(
+                        artifact, affectedDiagrams);
+                queueUpSynchronizationRequest(changeRequest);
+            }
+        } catch (TigerstripeException e) {
+            EclipsePlugin.log(e);
+        }
+    }
 
-	public void managerReloaded() {
-		// TODO Auto-generated method stub
+    public void managerReloaded() {
+        // TODO Auto-generated method stub
 
-	}
+    }
 
-	/**
-	 * Returns an array of DiagramHandle that are affected by a change on
-	 * targetFQN
-	 * 
-	 * @param targetFQN
-	 * @return
-	 */
-	public DiagramHandle[] getAffectedDiagrams(String targetFQN)
-			throws TigerstripeException {
-		List<DiagramHandle> result = new ArrayList<DiagramHandle>();
-		Set<DiagramHandle> candidates = diagramIndex.get(targetFQN);
+    /**
+     * Returns an array of DiagramHandle that are affected by a change on
+     * targetFQN
+     * 
+     * @param targetFQN
+     * @return
+     */
+    public DiagramHandle[] getAffectedDiagrams(String targetFQN)
+            throws TigerstripeException {
+        List<DiagramHandle> result = new ArrayList<DiagramHandle>();
+        Set<DiagramHandle> candidates = diagramIndex.get(targetFQN);
 
-		for (DiagramHandle handle : candidates) {
-			IResource resource = handle.getDiagramResource();
-			if (isBinResource(resource)) {
-				// ignore whatever is in "bin"
-				continue;
-			} else {
-				IEditorPart[] parts = EclipsePlugin
-						.getEditorPartsForResource(resource);
-				if (parts.length != 0) {
-					continue;
-				}
-			}
-			result.add(handle);
-		}
+        for (DiagramHandle handle : candidates) {
+            IResource resource = handle.getDiagramResource();
+            if (isBinResource(resource)) {
+                // ignore whatever is in "bin"
+                continue;
+            } else {
+                IEditorPart[] parts = EclipsePlugin
+                        .getEditorPartsForResource(resource);
+                if (parts.length != 0) {
+                    continue;
+                }
+            }
+            result.add(handle);
+        }
 
-		return result.toArray(new DiagramHandle[result.size()]);
-	}
+        return result.toArray(new DiagramHandle[result.size()]);
+    }
 
-	public Set<IEditorPart> getOpenedDiagrams(String targetFQN) {
-		Set<IEditorPart> result = new HashSet<IEditorPart>();
+    public Set<IEditorPart> getOpenedDiagrams(String targetFQN) {
+        Set<IEditorPart> result = new HashSet<IEditorPart>();
 
-		for (DiagramHandle handle : diagramIndex.get(targetFQN)) {
-			IResource resource = handle.getDiagramResource();
-			if (isBinResource(resource)) {
-				continue;
-			}
-			IEditorPart[] parts = EclipsePlugin
-					.getEditorPartsForResource(resource);
-			for (IEditorPart part : parts) {
-				result.add(part);
-			}
-		}
-		return result;
-	}
+        for (DiagramHandle handle : diagramIndex.get(targetFQN)) {
+            IResource resource = handle.getDiagramResource();
+            if (isBinResource(resource)) {
+                continue;
+            }
+            IEditorPart[] parts = EclipsePlugin
+                    .getEditorPartsForResource(resource);
+            for (IEditorPart part : parts) {
+                result.add(part);
+            }
+        }
+        return result;
+    }
 
-	private boolean isBinResource(IResource resource) {
-		return resource.getProjectRelativePath().matchingFirstSegments(
-				new Path("bin")) == 1;
-	}
+    private boolean isBinResource(IResource resource) {
+        return resource.getProjectRelativePath().matchingFirstSegments(
+                new Path("bin")) == 1;
+    }
 
-	private List<IResource> getAllModelFiles() throws TigerstripeException {
-		List<IResource> allResources = new ArrayList<IResource>();
-		IProject iProject = (IProject) getProject().getAdapter(IProject.class);
-		for (String extension : modelFileExtensions) {
-			allResources.addAll(TigerstripeResourceUtils.findAll(iProject,
-					extension));
-		}
-		return allResources;
-	}
+    private List<IResource> getAllModelFiles() throws TigerstripeException {
+        List<IResource> allResources = new ArrayList<IResource>();
+        IProject iProject = (IProject) getProject().getAdapter(IProject.class);
+        for (String extension : modelFileExtensions) {
+            allResources.addAll(TigerstripeResourceUtils.findAll(iProject,
+                    extension));
+        }
+        return allResources;
+    }
 
-	private void createAllDiagramHandles(IProgressMonitor monitor)
-			throws TigerstripeException {
-		// For now, find all diagrams and remove those that are open
-		List<IResource> allResources = new ArrayList<IResource>();
-		IProject iProject = (IProject) getProject().getAdapter(IProject.class);
-		for (String extension : diagramFileExtensions) {
-			allResources.addAll(TigerstripeResourceUtils.findAll(iProject,
-					extension));
-		}
+    private void createAllDiagramHandles(IProgressMonitor monitor)
+            throws TigerstripeException {
+        // For now, find all diagrams and remove those that are open
+        List<IResource> allResources = new ArrayList<IResource>();
+        IProject iProject = (IProject) getProject().getAdapter(IProject.class);
+        for (String extension : diagramFileExtensions) {
+            allResources.addAll(TigerstripeResourceUtils.findAll(iProject,
+                    extension));
+        }
 
-		monitor.beginTask("Indexing", allResources.size());
-		for (IResource diagramResource : allResources) {
-			monitor.subTask(diagramResource.getName());
-			IResource modelResource = getModelResource(diagramResource);
-			DiagramHandle handle = new DiagramHandle(diagramResource,
-					modelResource, project);
-			handlesByDiagram.put(diagramResource, handle);
-			try {
-				diagramIndex.diagramSaved(handle);
-			} catch (TigerstripeException e) {
-				EclipsePlugin.log(e);// log and keep going
-			}
-			monitor.worked(1);
-		}
-		monitor.done();
-	}
+        monitor.beginTask("Indexing", allResources.size());
+        for (IResource diagramResource : allResources) {
+            monitor.subTask(diagramResource.getName());
+            IResource modelResource = getModelResource(diagramResource);
+            DiagramHandle handle = new DiagramHandle(diagramResource,
+                    modelResource, project);
+            handlesByDiagram.put(diagramResource, handle);
+            try {
+                diagramIndex.diagramSaved(handle);
+            } catch (TigerstripeException e) {
+                EclipsePlugin.log(e);// log and keep going
+            }
+            monitor.worked(1);
+        }
+        monitor.done();
+    }
 
-	private IResource getModelResource(IResource diagramResource)
-			throws TigerstripeException {
-		for (int i = 0; i < diagramFileExtensions.length; i++) {
-			if (diagramFileExtensions[i].equals(diagramResource
-					.getFileExtension())) {
-				IPath path = diagramResource.getProjectRelativePath();
-				path = path.removeFileExtension();
-				path = path.addFileExtension(modelFileExtensions[i]);
-				IResource res = diagramResource.getProject().findMember(path);
-				if (res != null)
-					return res;
-			}
-		}
-		throw new TigerstripeException("Can't find model resource for "
-				+ diagramResource.getFullPath());
-	}
+    private IResource getModelResource(IResource diagramResource)
+            throws TigerstripeException {
+        for (int i = 0; i < diagramFileExtensions.length; i++) {
+            if (diagramFileExtensions[i].equals(diagramResource
+                    .getFileExtension())) {
+                IPath path = diagramResource.getProjectRelativePath();
+                path = path.removeFileExtension();
+                path = path.addFileExtension(modelFileExtensions[i]);
+                IResource res = diagramResource.getProject().findMember(path);
+                if (res != null)
+                    return res;
+            }
+        }
+        throw new TigerstripeException("Can't find model resource for "
+                + diagramResource.getFullPath());
+    }
 
-	public void resourceChanged(IResourceChangeEvent event) {
-		if (!enabled) {
-			return;
-		}
-		final IProject project = (IProject) getProject().getAdapter(
-				IProject.class);
-		if (project == null) {
-			return;
-			// this means the project has been deleted and the hash is being
-			// updated. This avoids problem with the race condition between
-			// the time this is notified and this has removed itself from
-			// the list of ResourceChange listeners.
-		}
+    public void resourceChanged(IResourceChangeEvent event) {
+        if (!enabled) {
+            return;
+        }
+        final IProject project = (IProject) getProject().getAdapter(
+                IProject.class);
+        if (project == null) {
+            return;
+            // this means the project has been deleted and the hash is being
+            // updated. This avoids problem with the race condition between
+            // the time this is notified and this has removed itself from
+            // the list of ResourceChange listeners.
+        }
 
-		// Get the list of removed resources
-		Collection<IResource> removedResources = new HashSet<IResource>();
-		Collection<IResource> changedResources = new HashSet<IResource>();
-		Collection<IResource> addedResources = new HashSet<IResource>();
-		// We only care about diagram files
-		IResourceFilter diagramFilesFilter = new IResourceFilter() {
-			public boolean select(IResource resource) {
-				if (!project.equals(resource.getProject()) || !(resource instanceof IFile)) {
-					return false;
-				}
+        // Get the list of removed resources
+        Collection<IResource> removedResources = new HashSet<IResource>();
+        Collection<IResource> changedResources = new HashSet<IResource>();
+        Collection<IResource> addedResources = new HashSet<IResource>();
+        // We only care about diagram files
+        IResourceFilter diagramFilesFilter = new IResourceFilter() {
+            public boolean select(IResource resource) {
+                if (!project.equals(resource.getProject()) || !(resource instanceof IFile)) {
+                    return false;
+                }
 
-				try {
-					IJavaProject javaProject = (IJavaProject) getProject().getAdapter(IJavaProject.class);
-					IPath output = javaProject.getOutputLocation();
-					IPath resPath = resource.getFullPath();
-					if(resPath.toString().startsWith(output.toString())) {
-						return false;
-					}
-				} catch (JavaModelException ex) {
-					// Ignore
-				}
+                try {
+                    IJavaProject javaProject = (IJavaProject) getProject().getAdapter(IJavaProject.class);
+                    IPath output = javaProject.getOutputLocation();
+                    IPath resPath = resource.getFullPath();
+                    if(resPath.toString().startsWith(output.toString())) {
+                        return false;
+                    }
+                } catch (JavaModelException ex) {
+                    // Ignore
+                }
 
-				return Arrays.asList(diagramFileExtensions).contains(
-						resource.getFileExtension());
-			}
-		};
+                return Arrays.asList(diagramFileExtensions).contains(
+                        resource.getFileExtension());
+            }
+        };
 
-		WorkspaceHelper.buildResourcesLists(event.getDelta(), removedResources,
-				changedResources, addedResources, diagramFilesFilter);
+        WorkspaceHelper.buildResourcesLists(event.getDelta(), removedResources,
+                changedResources, addedResources, diagramFilesFilter);
 
-		try {
-			checkForAddedDiagrams(addedResources);
-			checkForRemovedDiagrams(removedResources);
-			checkForChangedDiagrams(changedResources);
-		} catch (TigerstripeException e) {
-			EclipsePlugin.log(e);
-		}
-	}
+        try {
+            checkForAddedDiagrams(addedResources);
+            checkForRemovedDiagrams(removedResources);
+            checkForChangedDiagrams(changedResources);
+        } catch (TigerstripeException e) {
+            EclipsePlugin.log(e);
+        }
+    }
 
-	private void checkForAddedDiagrams(Collection<IResource> addedResources)
-			throws TigerstripeException {
-		IProject proj = (IProject) getProject().getAdapter(IProject.class);
-		for (IResource resource : addedResources) {
-			// System.out.println("Ad "+resource.getName());
-			for (String ext : diagramFileExtensions) {
-				if (ext.equals(resource.getFileExtension())
-						&& resource.getProject().equals(proj)
-						&& !(isBinResource(resource))) {
-					IResource modelResource = getModelResource(resource);
-					DiagramHandle handle = new DiagramHandle(resource,
-							modelResource, project);
-					handlesByDiagram.put(resource, handle);
-					diagramIndex.diagramSaved(handle);
-				}
-			}
-		}
-	}
+    private void checkForAddedDiagrams(Collection<IResource> addedResources)
+            throws TigerstripeException {
+        IProject proj = (IProject) getProject().getAdapter(IProject.class);
+        for (IResource resource : addedResources) {
+            // System.out.println("Ad "+resource.getName());
+            for (String ext : diagramFileExtensions) {
+                if (ext.equals(resource.getFileExtension())
+                        && resource.getProject().equals(proj)
+                        && !(isBinResource(resource))) {
+                    IResource modelResource = getModelResource(resource);
+                    DiagramHandle handle = new DiagramHandle(resource,
+                            modelResource, project);
+                    handlesByDiagram.put(resource, handle);
+                    diagramIndex.diagramSaved(handle);
+                }
+            }
+        }
+    }
 
-	private void checkForRemovedDiagrams(Collection<IResource> removedResources)
-			throws TigerstripeException {
-		for (IResource resource : removedResources) {
-			if (handlesByDiagram.get(resource) != null) {
-				DiagramHandle handle = handlesByDiagram.remove(resource);
-				diagramIndex.diagramDeleted(handle);
-			}
-		}
-	}
+    private void checkForRemovedDiagrams(Collection<IResource> removedResources)
+            throws TigerstripeException {
+        for (IResource resource : removedResources) {
+            if (handlesByDiagram.get(resource) != null) {
+                DiagramHandle handle = handlesByDiagram.remove(resource);
+                diagramIndex.diagramDeleted(handle);
+            }
+        }
+    }
 
-	private void checkForChangedDiagrams(Collection<IResource> changedResources)
-			throws TigerstripeException {
-		for (IResource resource : changedResources) {
-			if (handlesByDiagram.get(resource) != null) {
-				diagramIndex.diagramSaved(handlesByDiagram.get(resource));
-			}
-		}
-	}
+    private void checkForChangedDiagrams(Collection<IResource> changedResources)
+            throws TigerstripeException {
+        for (IResource resource : changedResources) {
+            if (handlesByDiagram.get(resource) != null) {
+                diagramIndex.diagramSaved(handlesByDiagram.get(resource));
+            }
+        }
+    }
 
-	public void setEnabled(boolean value) {
-		this.enabled = value;
+    public void setEnabled(boolean value) {
+        this.enabled = value;
 
-	}
+    }
 }
\ No newline at end of file