本文整理汇总了Java中org.netbeans.modules.xml.xam.ModelSource.isEditable方法的典型用法代码示例。如果您正苦于以下问题:Java ModelSource.isEditable方法的具体用法?Java ModelSource.isEditable怎么用?Java ModelSource.isEditable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.modules.xml.xam.ModelSource
的用法示例。
在下文中一共展示了ModelSource.isEditable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runTaskWithinContext
import org.netbeans.modules.xml.xam.ModelSource; //导入方法依赖的package包/类
@Override
public void runTaskWithinContext(Lookup context, Task task) {
JTextComponent component = context.lookup(JTextComponent.class);
if (component != null) {
DataObject dobj = NbEditorUtilities.getDataObject(component.getDocument());
if (dobj != null) {
FileObject fo = dobj.getPrimaryFile();
ModelSource ms = Utilities.createModelSource(fo);
if (ms.isEditable()) {
POMModel model = POMModelFactory.getDefault().getModel(ms);
if (model != null) {
Lookup newContext = new ProxyLookup(context, Lookups.fixed(model));
task.run(newContext);
return;
}
}
}
}
task.run(context);
}
示例2: validate
import org.netbeans.modules.xml.xam.ModelSource; //导入方法依赖的package包/类
private void validate(URI uri, int expectedErrorCount)
throws Exception {
Validation v = new Validation();
ModelSource ms = TestCatalogModel.getDefault().getModelSource(uri);
MyModelSource source = new MyModelSource(ms.getLookup(), ms.isEditable(), uri);
WSDLModel model = WSDLModelFactory.getDefault().getModel(source);
WSDLSchemaValidator instance = new WSDLSchemaValidator();
ValidationResult vr = instance.validate(model, v, Validation.ValidationType.COMPLETE);
assertNotNull(vr.getValidationResult());
ValidationHelper.dumpErrors(vr);
assertTrue("expect error " + expectedErrorCount, vr.getValidationResult().size() == expectedErrorCount);
}
示例3: isReadOnly
import org.netbeans.modules.xml.xam.ModelSource; //导入方法依赖的package包/类
/**
* Returns true if the underlying document is read-only, false otherwise.
*/
public boolean isReadOnly() {
ModelSource ms = getModelSource();
assert(ms != null);
if (ms.isEditable()) {
FileObject fo = (FileObject) ms.getLookup().lookup(FileObject.class);
assert(fo != null);
return !fo.canWrite();
}
return true;
}