当前位置: 首页>>代码示例>>Java>>正文


Java IStructuredModel.releaseFromRead方法代码示例

本文整理汇总了Java中org.eclipse.wst.sse.core.internal.provisional.IStructuredModel.releaseFromRead方法的典型用法代码示例。如果您正苦于以下问题:Java IStructuredModel.releaseFromRead方法的具体用法?Java IStructuredModel.releaseFromRead怎么用?Java IStructuredModel.releaseFromRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.wst.sse.core.internal.provisional.IStructuredModel的用法示例。


在下文中一共展示了IStructuredModel.releaseFromRead方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFile

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
/**
 * Returns the owner file of the JFace document {@link IDocument}.
 * 
 * @param document
 * @return
 */
public static final IFile getFile(IDocument document) {
	if (document == null) {
		return null;
	}
	IStructuredModel model = null;
	try {
		model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
		if (model != null) {
			return getFile(model);
		}
	} finally {
		if (model != null)
			model.releaseFromRead();
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:23,代码来源:DOMUtils.java

示例2: customizeDocumentCommand

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
@Override
public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
	if (!supportsSmartInsert(document)) {
		return;
	}
	IStructuredModel model = null;
	try {
		model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
		if (model != null) {
			if (command.text != null) {
				smartInsertCloseEndEL(command, document, model);
			}
		}
	} finally {
		if (model != null)
			model.releaseFromRead();
	}
}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:19,代码来源:StructuredAutoEditStrategyAngular.java

示例3: getModelForResource

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
/**
 * 
 * @param file
 *            the file to get the model for
 * @return the file's JSONModel or null
 */
protected IJSONModel getModelForResource(IFile file) {
	IStructuredModel model = null;
	IModelManager manager = StructuredModelManager.getModelManager();

	try {
		model = manager.getModelForRead(file);
		// TODO.. HTML validator tries again to get a model a 2nd way
	}
	catch (Exception e) {
		Logger.log(Logger.ERROR_DEBUG, file.getFullPath().toString(), e);
	}

	if (model instanceof IJSONModel)
		return (IJSONModel) model;
	if (model != null)
		model.releaseFromRead();
	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:25,代码来源:DelegatingSourceValidator.java

示例4: extractNamespace

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
private String extractNamespace(IFile file)
{
	IStructuredModel model = null;
	try
	{
		model = StructuredModelManager.getModelManager().getModelForRead(file);
		IDOMModel domModel = (IDOMModel)model;
		IDOMDocument domDoc = domModel.getDocument();

		Node node = XpathUtil.xpathNode(domDoc, "//mapper/@namespace");
		return node == null ? null : node.getNodeValue();
	}
	catch (Exception e)
	{
		Activator.log(Status.ERROR, "Error occurred during parsing mapper:" + file.getFullPath(),
			e);
	}
	finally
	{
		if (model != null)
		{
			model.releaseFromRead();
		}
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:27,代码来源:MapperNamespaceCache.java

示例5: getMapperDocument

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
public static IDOMDocument getMapperDocument(IFile mapperXmlFile)
{
	if (mapperXmlFile == null)
		return null;
	IStructuredModel model = null;
	try
	{
		model = StructuredModelManager.getModelManager().getModelForRead(mapperXmlFile);
		IDOMModel domModel = (IDOMModel)model;
		IDOMDocument mapperDocument = domModel.getDocument();
		return mapperDocument;
	}
	catch (Exception e)
	{
		Activator.log(Status.ERROR, e.getMessage(), e);
	}
	finally
	{
		if (model != null)
		{
			model.releaseFromRead();
		}
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:26,代码来源:MybatipseXmlUtil.java

示例6: getFile

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
/**
 * Returns the owner file of the JFace document {@link IDocument}.
 * 
 * @param document
 * @return
 */
public static final IFile getFile(IDocument document) {
	if (document == null) {
		return null;
	}
	IStructuredModel model = null;
	try {
		model = StructuredModelManager.getModelManager()
				.getExistingModelForRead(document);
		if (model != null) {
			return getFile(model);
		}
	} finally {
		if (model != null)
			model.releaseFromRead();
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:24,代码来源:DOMHelper.java

示例7: customizeDocumentCommand

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
@Override
public void customizeDocumentCommand(IDocument document,
		DocumentCommand command) {
	if (!supportsSmartInsert(document)) {
		return;
	}
	IStructuredModel model = null;
	try {
		model = StructuredModelManager.getModelManager()
				.getExistingModelForRead(document);
		if (model != null) {
			if (command.text != null) {
				smartInsertCloseEndEL(command, document, model);
			}
		}
	} finally {
		if (model != null)
			model.releaseFromRead();
	}
}
 
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:21,代码来源:StructuredAutoEditStrategyAngular.java

示例8: getNodeByOffset

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
/**
 * Returns the SSE DOM Node {@link IDOMNode} by offset from the
 * {@link IDocument} document and null if not found.
 * 
 * @param document
 *            the document.
 * @param offset
 *            the offset.
 * @return
 */
public static final IDOMNode getNodeByOffset(IDocument document, int offset) {
	IStructuredModel model = null;
	try {
		model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
		return getNodeByOffset(model, offset);
	} finally {
		if (model != null)
			model.releaseFromRead();
	}
}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:21,代码来源:DOMUtils.java

示例9: resolveFile

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
/**
 * Resolves the file that is associated with the given document.
 * 
 * @return an IFile pointing to the file in the workspace, or null if one
 *         could not be resolved.
 */
public static IFile resolveFile(IDocument document) {
  IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(
      document);
  try {
    return resolveFile(model);
  } finally {
    model.releaseFromRead();
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:16,代码来源:SseUtilities.java

示例10: getModelBaseLocation

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
private String getModelBaseLocation(IDocument document) {
  IModelManager modelManager = StructuredModelManager.getModelManager();
  IStructuredModel model = null;
  try {
    model = modelManager.getExistingModelForRead(document);
    return model.getBaseLocation();
  } finally {
    if (model != null) {
      model.releaseFromRead();
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:13,代码来源:StructuredDocumentCloner.java

示例11: getModelId

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
private String getModelId(IDocument document) {
  IModelManager modelManager = StructuredModelManager.getModelManager();
  IStructuredModel model = null;
  try {
    model = modelManager.getExistingModelForRead(document);
    return model.getId();
  } finally {
    if (model != null) {
      model.releaseFromRead();
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:13,代码来源:StructuredDocumentCloner.java

示例12: resolveUiBinderNamespacePrefix

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
/**
 * Returns the namespace prefix bound to the UiBinder namespace.
 * 
 * @return the namespace prefix (e.g. "ui"), or null
 */
public static String resolveUiBinderNamespacePrefix(
    IStructuredDocument xmlDocument) {
  IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(
      xmlDocument);
  if (model == null || !(model instanceof IDOMModel)) {
    return null;
  }

  try {
    return resolveUiBinderNamespacePrefix((IDOMModel) model);
  } finally {
    model.releaseFromRead();
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:20,代码来源:UiBinderXmlModelUtilities.java

示例13: getJavaProject

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
public static IJavaProject getJavaProject(IDocument document)
{
	IStructuredModel model = null;
	String baseLocation = null;
	IJavaProject result = null;

	// try to locate the file in the workspace
	try
	{
		model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
		if (model != null)
		{
			baseLocation = model.getBaseLocation();
		}
	}
	finally
	{
		if (model != null)
			model.releaseFromRead();
	}
	if (baseLocation != null)
	{
		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		IPath filePath = new Path(baseLocation);
		IFile file = null;

		if (filePath.segmentCount() > 1)
		{
			file = root.getFile(filePath);
		}
		if (file != null)
		{
			IProject project = file.getProject();
			result = JavaCore.create(project);
		}
	}
	return result;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:39,代码来源:MybatipseXmlUtil.java

示例14: validateFile

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
private void validateFile(IFile file, IReporter reporter, ValidationResult result)
{
	if ((reporter != null) && (reporter.isCancelled() == true))
	{
		throw new OperationCanceledException();
	}
	IStructuredModel model = null;
	try
	{
		file.deleteMarkers(MARKER_ID, false, IResource.DEPTH_ZERO);
		model = StructuredModelManager.getModelManager().getModelForRead(file);
		IDOMModel domModel = (IDOMModel)model;
		IDOMDocument domDoc = domModel.getDocument();
		NodeList nodes = domDoc.getChildNodes();

		IJavaProject project = JavaCore.create(file.getProject());

		for (int k = 0; k < nodes.getLength(); k++)
		{
			Node child = nodes.item(k);
			if (child instanceof IDOMElement)
			{
				validateElement(project, (IDOMElement)child, file, domDoc, reporter, result);
			}
		}
	}
	catch (Exception e)
	{
		Activator.log(Status.WARNING, "Error occurred during validation.", e);
	}
	finally
	{
		if (model != null)
		{
			model.releaseFromRead();
		}
	}
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:39,代码来源:XmlValidator.java

示例15: getCurrentNode

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入方法依赖的package包/类
/**
 * Returns the node the cursor is currently on in the document. null if no node is selected
 * 
 * @param offset
 * @return Node either element, doctype, text, or null
 */
private Node getCurrentNode(IDocument document, int offset)
{
	// get the current node at the offset (returns either: element,
	// doctype, text)
	IndexedRegion inode = null;
	IStructuredModel sModel = null;
	try
	{
		sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document);
		if (sModel != null)
		{
			inode = sModel.getIndexedRegion(offset);
			if (inode == null)
			{
				inode = sModel.getIndexedRegion(offset - 1);
			}
		}
	}
	finally
	{
		if (sModel != null)
			sModel.releaseFromRead();
	}

	if (inode instanceof Node)
	{
		return (Node)inode;
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:37,代码来源:XmlHyperlinkDetector.java


注:本文中的org.eclipse.wst.sse.core.internal.provisional.IStructuredModel.releaseFromRead方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。