本文整理汇总了Java中org.eclipse.wst.sse.core.internal.provisional.IModelManager类的典型用法代码示例。如果您正苦于以下问题:Java IModelManager类的具体用法?Java IModelManager怎么用?Java IModelManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IModelManager类属于org.eclipse.wst.sse.core.internal.provisional包,在下文中一共展示了IModelManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getModelForResource
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的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
示例2: doGetModelForRead
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的package包/类
@Override
protected IDOMModel doGetModelForRead() throws IOException, CoreException {
IModelManager modelManager = StructuredModelManager.getModelManager();
IFile storageFile = ResourcesPlugin.getWorkspace().getRoot().getFile(storage.getFullPath());
IDOMModel model = (IDOMModel) modelManager.getModelForRead(storageFile);
return model;
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:8,代码来源:ModuleJarResource.java
示例3: clone
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的package包/类
public IStructuredDocument clone(IDocument original) {
IModelManager modelManager = StructuredModelManager.getModelManager();
String modelId = getModelId(original);
if (modelId == null) {
GWTPluginLog.logError("Could not get a model ID for the document to be formatted.");
return null;
}
/*
* The XML formatter requires a managed model (discovered by it crashing
* when given an unmanaged model.) Unfortunately, we cannot create a managed
* in-memory (i.e. non-file backed) model via IModelManager API (there is
* one method that may work, but it is deprecated.) Instead, we copy the
* existing model into a temp model with ID "temp".
*/
try {
IStructuredModel modelClone = modelManager.copyModelForEdit(modelId,
"structuredDocumentClonerModel" + nextId.getAndIncrement());
modelClone.setBaseLocation(getModelBaseLocation(original));
IStructuredDocument documentClone = modelClone.getStructuredDocument();
documentClone.set(original.get());
// Create and connect the partitioner to the document
IDocumentPartitioner tempPartitioner = documentPartitionerFactory.createDocumentPartitioner();
((IDocumentExtension3) documentClone).setDocumentPartitioner(
partitioning, tempPartitioner);
tempPartitioner.connect(documentClone);
// Save the cloned model so we can release it later
modelClones.put(documentClone, modelClone);
return documentClone;
} catch (ResourceInUse e1) {
GWTPluginLog.logError(e1,
"Could not copy the original model to be formatted.");
return null;
}
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:40,代码来源:StructuredDocumentCloner.java
示例4: getModelBaseLocation
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的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
示例5: getModelId
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的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
示例6: getWidgetForEdit
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的package包/类
public Widget getWidgetForEdit() throws CoreException {
long enter = System.currentTimeMillis();
if (editableWidget == null) {
synchronized (this) {
IFile configXml = configXMLtoIFile();
if (configXml == null) {
return null;
}
IModelManager manager = StructuredModelManager.getModelManager();
try {
underLyingModel = manager.getModelForEdit(configXml);
if ((underLyingModel != null) && (underLyingModel instanceof IDOMModel)) {
underLyingModel.addModelStateListener(this);
IDOMModel domModel = (IDOMModel) underLyingModel;
editableWidget = load(domModel.getDocument());
lastWidget = load(domModel.getDocument());
}
} catch (IOException e) {
throw new CoreException(
new Status(IStatus.ERROR, HybridCore.PLUGIN_ID, "Error creating widget model", e));
}
}
}
HybridCore.trace("Completed WidgetModel.getWidgetForEdit it "
+ Long.toString(System.currentTimeMillis() - enter) + "ms");
return editableWidget;
}
开发者ID:eclipse,项目名称:thym,代码行数:28,代码来源:WidgetModel.java
示例7: getFileName
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的package包/类
public static String getFileName(ICSSNode cssNode, IDOMNode node) {
String fileName = cssNode.getOwnerDocument().getModel()
.getBaseLocation();
if (IModelManager.UNMANAGED_MODEL.equals(fileName)) {
if (node != null) {
return node.getModel().getBaseLocation();
}
return null;
}
return fileName;
}
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:12,代码来源:DOMHelper.java
示例8: getModelForEdit
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的package包/类
private IDOMModel getModelForEdit() throws IOException, CoreException {
IModelManager modelManager = StructuredModelManager.getModelManager();
return (IDOMModel) modelManager.getModelForEdit(getFile());
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:5,代码来源:ModuleFile.java
示例9: doGetModelForRead
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的package包/类
@Override
protected IDOMModel doGetModelForRead() throws IOException, CoreException {
IModelManager modelManager = StructuredModelManager.getModelManager();
return (IDOMModel) modelManager.getModelForRead(getFile());
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:6,代码来源:ModuleFile.java
示例10: createModel
import org.eclipse.wst.sse.core.internal.provisional.IModelManager; //导入依赖的package包/类
public static IStructuredModel createModel() {
IModelManager manager = StructuredModelManager.getModelManager();
return manager
.createUnManagedStructuredModelFor(ContentTypeIdForJSON.ContentTypeID_JSON);
}
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:7,代码来源:TestUtil.java
注:本文中的org.eclipse.wst.sse.core.internal.provisional.IModelManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论