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


Java FileEditorProvider类代码示例

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


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

示例1: openFileInPanel

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
/**
 * 打开类文件
 *
 * @param filePath
 * @param project
 */
public static void openFileInPanel(final String filePath, final Project project) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(filePath);
            if (file != null && file.isValid()) {
                FileEditorProvider[] providers = FileEditorProviderManager.getInstance()
                        .getProviders(project, file);
                if (providers.length != 0) {
                    OpenFileDescriptor descriptor = new OpenFileDescriptor(project, file);
                    FileEditorManager.getInstance(project).openTextEditor(descriptor, false);
                }
            }
        }
    });
}
 
开发者ID:pengwei1024,项目名称:AndroidSourceViewer,代码行数:23,代码来源:Utils.java

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

示例3: writeExternal

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
/**
 * @return element that was added to the <code>element</code>.
 * Returned element has tag {@link #TAG}. Never null.
 */
public Element writeExternal(Element element, Project project) {
  Element e = new Element(TAG);
  element.addContent(e);
  e.setAttribute(FILE_ATTR, myFile.getUrl());

  for (final Map.Entry<FileEditorProvider, FileEditorState> entry : myProvider2State.entrySet()) {
    FileEditorProvider provider = entry.getKey();

    Element providerElement = new Element(PROVIDER_ELEMENT);
    if (provider.equals(mySelectedProvider)) {
      providerElement.setAttribute(SELECTED_ATTR_VALUE, Boolean.TRUE.toString());
    }
    providerElement.setAttribute(EDITOR_TYPE_ID_ATTR, provider.getEditorTypeId());
    Element stateElement = new Element(STATE_ELEMENT);
    providerElement.addContent(stateElement);
    provider.writeState(entry.getValue(), project, stateElement);

    e.addContent(providerElement);
  }

  return e;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:HistoryEntry.java

示例4: getSelectedEditorWithProvider

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
@Override
@NotNull
public Pair<FileEditor, FileEditorProvider> getSelectedEditorWithProvider() {
  LOG.assertTrue(myEditors.length > 0, myEditors.length);
  if (myEditors.length == 1) {
    LOG.assertTrue(myTabbedPaneWrapper == null);
    return Pair.create(myEditors[0], myProviders[0]);
  }
  else { // we have to get myEditor from tabbed pane
    LOG.assertTrue(myTabbedPaneWrapper != null);
    int index = myTabbedPaneWrapper.getSelectedIndex();
    if (index == -1) {
      index = 0;
    }
    LOG.assertTrue(index >= 0, index);
    LOG.assertTrue(index < myEditors.length, index);
    return Pair.create(myEditors[index], myProviders[index]);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:EditorWithProviderComposite.java

示例5: createNewDockContainerFor

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
@NotNull
public Pair<FileEditor[], FileEditorProvider[]> createNewDockContainerFor(@NotNull VirtualFile file, @NotNull FileEditorManagerImpl fileEditorManager) {
  DockContainer container = getFactory(DockableEditorContainerFactory.TYPE).createContainer(null);
  register(container);

  final DockWindow window = createWindowFor(null, container);

  window.show(true);
  final EditorWindow editorWindow = ((DockableEditorTabbedContainer)container).getSplitters().getOrCreateCurrentWindow(file);
  final Pair<FileEditor[], FileEditorProvider[]> result = fileEditorManager.openFileImpl2(editorWindow, file, true);
  container.add(EditorTabbedContainer.createDockableEditor(myProject, null, file, new Presentation(file.getName()), editorWindow), null);

  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      window.myUiContainer.setPreferredSize(null);
    }
  });
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DockManagerImpl.java

示例6: getSelectedEditorWithProvider

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
@NotNull
public Pair<FileEditor, FileEditorProvider> getSelectedEditorWithProvider() {
  LOG.assertTrue(myEditors.length > 0, myEditors.length);
  if(myEditors.length==1){
    LOG.assertTrue(myTabbedPaneWrapper==null);
    return Pair.create (myEditors[0], myProviders [0]);
  }
  else{ // we have to get myEditor from tabbed pane
    LOG.assertTrue(myTabbedPaneWrapper!=null);
    int index = myTabbedPaneWrapper.getSelectedIndex();
    if (index == -1) {
      index = 0;
    }
    LOG.assertTrue(index>=0, index);
    LOG.assertTrue(index<myEditors.length, index);
    return Pair.create (myEditors[index], myProviders [index]);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:EditorWithProviderComposite.java

示例7: createNewDockContainerFor

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
public Pair<FileEditor[], FileEditorProvider[]> createNewDockContainerFor(VirtualFile file, FileEditorManagerImpl fileEditorManager) {
  DockContainer container = getFactory(DockableEditorContainerFactory.TYPE).createContainer(null);
  register(container);

  final DockWindow window = createWindowFor(null, container);

  window.show(true);
  final EditorWindow editorWindow = ((DockableEditorTabbedContainer)container).getSplitters().getOrCreateCurrentWindow(file);
  final Pair<FileEditor[], FileEditorProvider[]> result = fileEditorManager.openFileImpl2(editorWindow, file, true);
  container.add(EditorTabbedContainer.createDockableEditor(myProject, null, file, new Presentation(file.getName()), editorWindow), null);

  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      window.myUiContainer.setPreferredSize(null);
    }
  });
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:DockManagerImpl.java

示例8: updateEditorText

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
private void updateEditorText() {
  disposeNonTextEditor();

  final PsiElement elt = myElements[myIndex].getNavigationElement();
  Project project = elt.getProject();
  PsiFile psiFile = getContainingFile(elt);
  final VirtualFile vFile = psiFile.getVirtualFile();
  if (vFile == null) return;
  final FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(project, vFile);
  for (FileEditorProvider provider : providers) {
    if (provider instanceof TextEditorProvider) {
      updateTextElement(elt);
      myBinarySwitch.show(myViewingPanel, TEXT_PAGE_KEY);
      break;
    }
    else if (provider.accept(project, vFile)) {
      myCurrentNonTextEditorProvider = provider;
      myNonTextEditor = myCurrentNonTextEditorProvider.createEditor(project, vFile);
      myBinaryPanel.removeAll();
      myBinaryPanel.add(myNonTextEditor.getComponent());
      myBinarySwitch.show(myViewingPanel, BINARY_PAGE_KEY);
      break;
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:ImplementationViewComponent.java

示例9: doOpen

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
private static boolean doOpen(final String path, final int line, final int column) {
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      Pair<VirtualFile, Project> data = new File(path).isAbsolute() ? findByAbsolutePath(path) : findByRelativePath(path);
      if (data == null) return;

      FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(data.second, data.first);
      if (providers.length == 0) return;

      OpenFileDescriptor descriptor = new OpenFileDescriptor(data.second, data.first, line, column);
      FileEditorManager.getInstance(data.second).openTextEditor(descriptor, true);
    }
  });
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:OpenFileXmlRpcHandler.java

示例10: getBuilderFromEditorProvider

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
@NotNull
private static Builder getBuilderFromEditorProvider(@NotNull final FileEditorProvider provider,
                                                    @NotNull final Project project,
                                                    @NotNull final VirtualFile file) {
  if (provider instanceof AsyncFileEditorProvider) {
    return ((AsyncFileEditorProvider)provider).createEditorAsync(project, file);
  }
  else {
    return new Builder() {
      @Override
      public FileEditor build() {
        return provider.createEditor(project, file);
      }
    };
  }
}
 
开发者ID:asciidoctor,项目名称:asciidoctor-intellij-plugin,代码行数:17,代码来源:SplitTextEditorProvider.java

示例11: createHeavy

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
@Nonnull
public static HistoryEntry createHeavy(@Nonnull Project project,
                                       @Nonnull VirtualFile file,
                                       @Nonnull FileEditorProvider[] providers,
                                       @Nonnull FileEditorState[] states,
                                       @Nonnull FileEditorProvider selectedProvider) {
  if (project.isDisposed()) return createLight(file, providers, states, selectedProvider);

  Disposable disposable = Disposer.newDisposable();
  VirtualFilePointer pointer = VirtualFilePointerManager.getInstance().create(file, disposable, null);

  HistoryEntry entry = new HistoryEntry(pointer, selectedProvider, disposable);
  for (int i = 0; i < providers.length; i++) {
    FileEditorProvider provider = providers[i];
    FileEditorState state = states[i];
    if (provider != null && state != null) {
      entry.putState(provider, state);
    }
  }
  return entry;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:HistoryEntry.java

示例12: writeExternal

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
/**
 * @return element that was added to the <code>element</code>.
 * Returned element has tag {@link #TAG}. Never null.
 */
public Element writeExternal(Element element, Project project) {
  Element e = new Element(TAG);
  element.addContent(e);
  e.setAttribute(FILE_ATTR, myFilePointer.getUrl());

  for (final Map.Entry<FileEditorProvider, FileEditorState> entry : myProvider2State.entrySet()) {
    FileEditorProvider provider = entry.getKey();

    Element providerElement = new Element(PROVIDER_ELEMENT);
    if (provider.equals(mySelectedProvider)) {
      providerElement.setAttribute(SELECTED_ATTR_VALUE, Boolean.TRUE.toString());
    }
    providerElement.setAttribute(EDITOR_TYPE_ID_ATTR, provider.getEditorTypeId());
    Element stateElement = new Element(STATE_ELEMENT);
    providerElement.addContent(stateElement);
    provider.writeState(entry.getValue(), project, stateElement);

    e.addContent(providerElement);
  }

  return e;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:HistoryEntry.java

示例13: getSelectedEditorWithProvider

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
@Override
@Nonnull
public Pair<FileEditor, FileEditorProvider> getSelectedEditorWithProvider() {
  LOG.assertTrue(myEditors.length > 0, myEditors.length);
  if (myEditors.length == 1) {
    LOG.assertTrue(myTabbedPaneWrapper == null);
    return Pair.create(myEditors[0], myProviders[0]);
  }
  else { // we have to get myEditor from tabbed pane
    LOG.assertTrue(myTabbedPaneWrapper != null);
    int index = myTabbedPaneWrapper.getSelectedIndex();
    if (index == -1) {
      index = 0;
    }
    LOG.assertTrue(index >= 0, index);
    LOG.assertTrue(index < myEditors.length, index);
    return Pair.create(myEditors[index], myProviders[index]);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:EditorWithProviderComposite.java

示例14: getProvider

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
@Override
@Nullable
public FileEditorProvider getProvider(@NotNull String editorTypeId) {
  for (FileEditorProvider provider : myProviders) {
    if (provider.getEditorTypeId().equals(editorTypeId)) {
      return provider;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FileEditorProviderManagerImpl.java

示例15: registerProvider

import com.intellij.openapi.fileEditor.FileEditorProvider; //导入依赖的package包/类
private void registerProvider(@NotNull FileEditorProvider provider) {
  String editorTypeId = provider.getEditorTypeId();
  if (getProvider(editorTypeId) != null) {
    throw new IllegalArgumentException("attempt to register provider with non unique editorTypeId: " + editorTypeId);
  }
  myProviders.add(provider);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:FileEditorProviderManagerImpl.java


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