Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others. 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 /
  
  package org.eclipse.xtext.ui.editor;
  
 

Author(s):
Sebastian Zarnekow - Initial contribution and API
 
 	
 	private String content;
 	private URI normalizedUri;
 	
 	public void connect(IXtextDocument document) {
 		if (document == null)
 			throw new IllegalArgumentException("document may not be null");
 		if (this. == document)
 			return;
 		if (this. != null)
 			throw new IllegalStateException("Dirty resource was already connected to another document");
 		this. = document;
 		document.readOnly(new IUnitOfWork.Void<XtextResource>() {
 			public void process(XtextResource resource) {
 				if (resource != null) {
 				}
 			}
 		});
 	}
 	
 	protected void initiallyProcessResource(XtextResource resource) {
 		IResourceServiceProvider serviceProvider = resource.getResourceServiceProvider();
 		if (serviceProvider != null) {
 			IResourceDescription.Manager descriptionManager = serviceProvider.getResourceDescriptionManager();
 			if (descriptionManager != null) {
 				final IResourceDescription description = descriptionManager.getResourceDescription(resource);
 				if (description != null)
 					copyState(description);							
 			}
 		}
 	}
 	
 	public void disconnect(IXtextDocument document) {
 		if (document == null)
 			throw new IllegalArgumentException("document may not be null");
 		if (this. != document)
 			throw new IllegalStateException("Cannot disconnect document that is not connected");
 		this. = null;
 		 = null;
 		 = null;
 	}

Callback method for the copied resource description. Is triggered as soon as somebody is interested in the reference descriptions which shall be up to date all the time. This allows for lazy resolution of proxies instead of eager copying.

Returns:
the current resource description of the associated document. May be null.
 
 	public IResourceDescription get() {
 			public IResourceDescription exec(XtextResource resource) {
 				if (resource != null) {
 					IResourceServiceProvider serviceProvider = resource.getResourceServiceProvider();
 					if (serviceProvider != null) {
 						if (manager != null) {
 							return manager.getResourceDescription(resource);
 						}
 					}
 				}
 				return null;
 			}
 		});
 		return result;
 	}
	public void copyState(IResourceDescription original) {
		synchronized(this) {
			 = copy;
		}
	}
		return ;
	}

Since:
2.8
		return ;
	}
	public boolean isInitialized() {
		return  != null;
	}
	public URI getURI() {
		if ( == null)
			throw new IllegalStateException("Cannot use getURI if this dirty resource is not connected to a document");
		IResourceDescription description = this.;
		if (description == null)
			throw new IllegalStateException("Cannot use getURI if this dirty resource is currently not initialized");
		return description.getURI();
	}
	public synchronized IResourceDescription getDescription() {
		if ( == null)
			throw new IllegalStateException("Cannot use getDescription if this dirty resource is not connected to a document");
		IResourceDescription description = this.;
		if (description == null)
			throw new IllegalStateException("Cannot use getDescription if this dirty resource is currently not initialized");
		return description;
	}
	public synchronized String getContents() {
		if ( == null)
			throw new IllegalStateException("Cannot use getContents if this dirty resource is not connected to a document");
		String content = this.;
		if (content == null)
			throw new IllegalStateException("Cannot use getContents if this dirty resource is currently not mementoed");
		return content;
	}

Since:
2.8
		return ;
	}
		IXtextDocument document = this.;
		if (document == null)
			throw new IllegalStateException("Cannot use getActualContents if this dirty resource is not connected to a document");
		return document.get();
	}

Since:
2.8
		IXtextDocument document = this.;
		if (document == null)
			return null;
		return document.get();
	}

Since:
2.4
	public URI getNormalizedURI() {
	}

Since:
2.8
Nooverride:
This method is not intended to be re-implemented or extended by clients.
Noreference:
This method is not intended to be referenced by clients.
		if (provider == null)
			return null;
		return provider.get();
	}

Since:
2.8
	}
New to GrepCode? Check out our FAQ X