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


Java IStructuredModel类代码示例

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


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

示例1: fromIFile

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入依赖的package包/类
private DataflowMavenModel fromIFile(IFile file) throws CoreException {
  try {
    IStructuredModel structuredModel =
        StructuredModelManager.getModelManager().getModelForEdit(file);
    if (structuredModel instanceof IDOMModel) {
      XPath xpath = XPathFactory.newInstance().newXPath();
      xpath.setNamespaceContext(POM_NS_CONTEXT);
      return new DataflowMavenModel(
          dependencyManager, xpath, file.getProject(), (IDOMModel) structuredModel);
    } else {
      throw new CoreException(new Status(Status.ERROR, DataflowCorePlugin.PLUGIN_ID,
          String.format("File %s wasn't a DOM model", file)));
    }
  } catch (IOException e) {
    throw new CoreException(new Status(Status.ERROR, DataflowCorePlugin.PLUGIN_ID,
        String.format("Couldn't get a DOM Model for file %s", file), e));
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:19,代码来源:DataflowMavenModel.java

示例2: getNodeByOffset

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入依赖的package包/类
/**
 * Returns the SSE DOM Node {@link IDOMNode} by offset from the
 * {@link IStructuredModel} SSE mode and null if not found.
 * 
 * @param model
 *            the SSE model.
 * @param offset
 *            the offset.
 * @return
 */
public static final IDOMNode getNodeByOffset(IStructuredModel model, int offset) {
	IndexedRegion node = null;
	if (model != null) {
		node = model.getIndexedRegion(offset);
		if (node instanceof IDOMNode) {
			return (IDOMNode) node;
		}

		if (model != null) {
			int lastOffset = offset;
			node = model.getIndexedRegion(offset);
			while (node == null && lastOffset >= 0) {
				lastOffset--;
				node = model.getIndexedRegion(lastOffset);
			}
		}
	}
	return (IDOMNode) node;
}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:30,代码来源:DOMUtils.java

示例3: 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

示例4: 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

示例5: smartInsertCloseEndEL

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入依赖的package包/类
private void smartInsertCloseEndEL(DocumentCommand command, IDocument document, IStructuredModel model) {
	try {
		if (isPreferenceEnabled(AngularUIPreferenceNames.TYPING_COMPLETE_END_EL) && command.text.equals("{") //$NON-NLS-1$
				&& document.getLength() > 0 && document.getChar(command.offset - 1) == '{') {
			IDOMNode node = (IDOMNode) model.getIndexedRegion(command.offset - 1);

			command.text += "}}";
			command.shiftsCaret = false;
			command.caretOffset = command.offset + 1;
			command.doit = false;
		}
	} catch (BadLocationException e) {

	}

}
 
开发者ID:angelozerr,项目名称:angular-eclipse,代码行数:17,代码来源:StructuredAutoEditStrategyAngular.java

示例6: 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

示例7: cleanupModel

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入依赖的package包/类
public void cleanupModel(IStructuredModel structuredModel, int start,
		int length) {
	JSONFormatUtil formatUtil = JSONFormatUtil.getInstance();
	if (structuredModel instanceof IJSONModel) {
		IJSONDocument doc = ((IJSONModel) structuredModel).getDocument();
		IJSONSourceFormatter formatter = JSONSourceFormatterFactory
				.getInstance().getSourceFormatter((INodeNotifier) doc);
		StringBuilder buf = formatter.cleanup(doc);
		if (buf != null) {
			int startOffset = ((IndexedRegion) doc).getStartOffset();
			int endOffset = ((IndexedRegion) doc).getEndOffset();
			formatUtil.replaceSource(doc.getModel(), startOffset, endOffset
					- startOffset, buf.toString());
		}
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:17,代码来源:CleanupProcessorJSON.java

示例8: 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

示例9: 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

示例10: validateImage

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入依赖的package包/类
/**
 * Validate img/@src
 * 
 * @param documentRegion
 * @param reporter
 * @param model
 * @param file
 * @param factory
 * @param attrValueRegion
 * @param resourceType
 */
private void validateImage(IStructuredDocumentRegion documentRegion,
		IReporter reporter, IStructuredModel model, IFile file,
		MessageFactory factory, WebResourcesTextRegion attrValueRegion,
		WebResourcesFinderType resourceType) {
	IDOMAttr attr = DOMHelper.getAttrByOffset(model,
			documentRegion.getStartOffset()
					+ attrValueRegion.getRegion().getStart());
	if (attr != null) {
		String attrValue = DOMHelper.getAttrValue(documentRegion
				.getText(attrValueRegion.getRegion()));
		if (URIHelper.isDataURIScheme(attrValue)) {
			// see https://en.wikipedia.org/wiki/Data_URI_scheme
			// ex : <img
			// src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
			// alt="Red dot" />
			// TODO : validate format of data uri scheme.
		} else {
			// ex : <img src="path/to/image.png" />
			validateFile(documentRegion, reporter, model, file, factory,
					attrValueRegion, resourceType);
		}
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:35,代码来源:WebResourcesValidator.java

示例11: 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

示例12: getModel

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入依赖的package包/类
public static ICSSModel getModel(File file) {
	IStructuredModel model = null;
	try {
		model = StructuredModelManager.getModelManager()
				.getExistingModelForRead(file);
		if (model == null) {
			model = StructuredModelManager.getModelManager()
					.getModelForRead(file.getPath(),
							new FileInputStream(file), null);
		}
		return (ICSSModel) model;
	} catch (Exception e) {

	}
	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:17,代码来源:DOMHelper.java

示例13: getNodeByOffset

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入依赖的package包/类
/**
 * Returns the SSE DOM Node {@link IDOMNode} by offset from the
 * {@link IStructuredModel} SSE mode and null if not found.
 * 
 * @param model
 *            the SSE model.
 * @param offset
 *            the offset.
 * @return
 */
public static final IDOMNode getNodeByOffset(IStructuredModel model,
		int offset) {
	IndexedRegion node = null;
	if (model != null) {
		node = model.getIndexedRegion(offset);
		if (node instanceof IDOMNode) {
			return (IDOMNode) node;
		}

		int lastOffset = offset;
		node = model.getIndexedRegion(offset);
		while (node == null && lastOffset >= 0) {
			lastOffset--;
			node = model.getIndexedRegion(lastOffset);
		}
	}
	return (IDOMNode) node;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:29,代码来源:DOMHelper.java

示例14: 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

示例15: smartInsertCloseEndEL

import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; //导入依赖的package包/类
private void smartInsertCloseEndEL(DocumentCommand command,
		IDocument document, IStructuredModel model) {
	try {
		if (isPreferenceEnabled(AngularUIPreferenceNames.TYPING_COMPLETE_END_EL)
				&& command.text.equals("{") && document.getLength() > 0 && document.getChar(command.offset - 1) == '{') { //$NON-NLS-1$
			IDOMNode node = (IDOMNode) model
					.getIndexedRegion(command.offset - 1);

			command.text += "}}";
			command.shiftsCaret = false;
			command.caretOffset = command.offset + 1;
			command.doit = false;
		}
	} catch (BadLocationException e) {

	}

}
 
开发者ID:angelozerr,项目名称:angularjs-eclipse,代码行数:19,代码来源:StructuredAutoEditStrategyAngular.java


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