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


Java FileEditorProvider.readState方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:HistoryEntry.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:36,代码来源:HistoryEntry.java

示例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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:42,代码来源:HistoryEntry.java


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