本文整理汇总了Java中com.intellij.openapi.fileEditor.FileEditorProvider.readState方法的典型用法代码示例。如果您正苦于以下问题:Java FileEditorProvider.readState方法的具体用法?Java FileEditorProvider.readState怎么用?Java FileEditorProvider.readState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.fileEditor.FileEditorProvider
的用法示例。
在下文中一共展示了FileEditorProvider.readState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HistoryEntry
import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
public HistoryEntry(@NotNull Project project, @NotNull Element e) throws InvalidDataException {
myFile = getVirtualFile(e);
myProvider2State = new HashMap<FileEditorProvider, FileEditorState>();
List providers = e.getChildren(PROVIDER_ELEMENT);
for (final Object provider1 : providers) {
Element _e = (Element)provider1;
String typeId = _e.getAttributeValue(EDITOR_TYPE_ID_ATTR);
FileEditorProvider provider = FileEditorProviderManager.getInstance().getProvider(typeId);
if (provider == null) {
continue;
}
if (Boolean.valueOf(_e.getAttributeValue(SELECTED_ATTR_VALUE))) {
mySelectedProvider = provider;
}
Element stateElement = _e.getChild(STATE_ELEMENT);
if (stateElement == null) {
throw new InvalidDataException();
}
FileEditorState state = provider.readState(stateElement, project, myFile);
putState(provider, state);
}
}
示例2: parseEntry
import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
@Nonnull
private static EntryData parseEntry(@Nonnull Project project, @Nonnull Element e) throws InvalidDataException {
if (!e.getName().equals(TAG)) {
throw new IllegalArgumentException("unexpected tag: " + e);
}
String url = e.getAttributeValue(FILE_ATTR);
List<Pair<FileEditorProvider, FileEditorState>> providerStates = new ArrayList<>();
FileEditorProvider selectedProvider = null;
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
for (Element _e : e.getChildren(PROVIDER_ELEMENT)) {
String typeId = _e.getAttributeValue(EDITOR_TYPE_ID_ATTR);
FileEditorProvider provider = FileEditorProviderManager.getInstance().getProvider(typeId);
if (provider == null) {
continue;
}
if (Boolean.valueOf(_e.getAttributeValue(SELECTED_ATTR_VALUE))) {
selectedProvider = provider;
}
Element stateElement = _e.getChild(STATE_ELEMENT);
if (stateElement == null) {
throw new InvalidDataException();
}
if (file != null) {
FileEditorState state = provider.readState(stateElement, project, file);
providerStates.add(Pair.create(provider, state));
}
}
return new EntryData(url, providerStates, selectedProvider);
}
示例3: HistoryEntry
import com.intellij.openapi.fileEditor.FileEditorProvider; //导入方法依赖的package包/类
public HistoryEntry(Project project, Element e, boolean ensureDocumentCreated) throws InvalidDataException{
if (!e.getName().equals(TAG)) {
throw new IllegalArgumentException("unexpected tag: " + e);
}
String url = e.getAttributeValue(FILE_ATTR);
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
if (file == null){
throw new InvalidDataException("No file exists: " + url);
}
myFile = file;
myProvider2State = new HashMap<FileEditorProvider, FileEditorState>();
if (ensureDocumentCreated) {
// May be necessary for correct initialisation. For example, stored fold regions info is not applied if target document
// hasn't been initialised yet.
FileDocumentManager.getInstance().getDocument(myFile);
}
List providers = e.getChildren(PROVIDER_ELEMENT);
for (final Object provider1 : providers) {
Element _e = (Element)provider1;
String typeId = _e.getAttributeValue(EDITOR_TYPE_ID_ATTR);
FileEditorProvider provider = FileEditorProviderManager.getInstance().getProvider(typeId);
if (provider == null) {
continue;
}
if (Boolean.valueOf(_e.getAttributeValue(SELECTED_ATTR_VALUE))) {
mySelectedProvider = provider;
}
Element stateElement = _e.getChild(STATE_ELEMENT);
if (stateElement == null) {
throw new InvalidDataException();
}
FileEditorState state = provider.readState(stateElement, project, file);
putState(provider, state);
}
}