Fix modelManager API usage

Our testing team found a weird issue where the contents of an XML was re-appearing even after the file had been deleted, the old contents of the file were being loaded from memory.  We I've seen the problem before it can always be traced back to where a call to modelManger getModelForRead/Edit() but the cooresponding model.releaseFromRead/Write() wasn't called.

I debugged it and traced it down to LineStyleProviderForXMLReferences class.  This pull fixes that issue.
Is there a way that for most all instances the getModelForRead is used and
then only for jar resources getModelForEditi is called?

Either way should be ok as long as the release() is also called.

On Thu, Sep 18, 2014 at 5:16 PM, Angelo <notifications@github.com> wrote:

> In
> core/org.eclipse.wst.xml.search.core/src/main/java/org/eclipse/wst/xml/search/core/internal/storage/StorageModelManager.java:
>
> > @@ -81,7 +81,7 @@ public IStructuredModel loadModel(IStorage storage) {
> >  		IStructuredModel model = null;
> >  		try {
> >  			// first parameter must be unique
> > -			model = StructuredModelManager.getModelManager().getModelForEdit(
> > +			model = StructuredModelManager.getModelManager().getModelForRead(
> >  					id, contents, null);
>
> @gamerson <https://github.com/gamerson> since you have changes
> getModelForEdit to getModelForRead, search resources from JARs doesn't
> work. StorageModelManager is used for JARs resources. Those resources
> should never changed. No?
>
> Can I reuse getModelForEdit ?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/angelozerr/eclipse-wtp-xml-search/pull/19/files#r17716588>
> .
>



-- 
Greg Amerson
Liferay Developer Tools
Liferay, Inc. www.liferay.com