Java 类com.intellij.openapi.editor.HectorComponentPanel 实例源码

项目:intellij-ce-playground    文件:HectorComponent.java   
private boolean isModified() {
  final FileViewProvider viewProvider = myFile.getViewProvider();
  for (Language language : mySliders.keySet()) {
    JSlider slider = mySliders.get(language);
    final PsiFile root = viewProvider.getPsi(language);
    HighlightingLevelManager highlightingLevelManager = HighlightingLevelManager.getInstance(myFile.getProject());
    if (root != null && getValue(highlightingLevelManager.shouldHighlight(root), highlightingLevelManager.shouldInspect(root)) != slider.getValue()) {
      return true;
    }
  }
  for (HectorComponentPanel panel : myAdditionalPanels) {
    if (panel.isModified()) {
      return true;
    }
  }

  return false;
}
项目:tools-idea    文件:HectorComponent.java   
private boolean isModified() {
  final FileViewProvider viewProvider = myFile.getViewProvider();
  for (Language language : mySliders.keySet()) {
    JSlider slider = mySliders.get(language);
    final PsiFile root = viewProvider.getPsi(language);
    if (root != null && getValue(HighlightLevelUtil.shouldHighlight(root), HighlightLevelUtil.shouldInspect(root)) != slider.getValue()) {
      return true;
    }
  }
  for (HectorComponentPanel panel : myAdditionalPanels) {
    if (panel.isModified()) {
      return true;
    }
  }

  return false;
}
项目:consulo    文件:HectorComponent.java   
private boolean isModified() {
  final FileViewProvider viewProvider = myFile.getViewProvider();
  for (Language language : mySliders.keySet()) {
    JSlider slider = mySliders.get(language);
    final PsiFile root = viewProvider.getPsi(language);
    HighlightingLevelManager highlightingLevelManager = HighlightingLevelManager.getInstance(myFile.getProject());
    if (root != null && getValue(highlightingLevelManager.shouldHighlight(root), highlightingLevelManager.shouldInspect(root)) != slider.getValue()) {
      return true;
    }
  }
  for (HectorComponentPanel panel : myAdditionalPanels) {
    if (panel.isModified()) {
      return true;
    }
  }

  return false;
}
项目:intellij-ce-playground    文件:PowerSaveHectorProvider.java   
@Override
public HectorComponentPanel createConfigurable(@NotNull PsiFile file) {
  return new HectorComponentPanel() {
    private final JCheckBox myCheckBox = new JCheckBox("Power Save Mode");

    @Override
    public JComponent createComponent() {
      return myCheckBox;
    }

    @Override
    public boolean isModified() {
      return myCheckBox.isSelected() != PowerSaveMode.isEnabled();
    }

    @Override
    public void apply() throws ConfigurationException {
      PowerSaveMode.setEnabled(myCheckBox.isSelected());
    }

    @Override
    public void reset() {
      myCheckBox.setSelected(PowerSaveMode.isEnabled());
    }

    @Override
    public void disposeUIResources() {
    }
  };
}
项目:intellij-ce-playground    文件:FileIncludeContextHectorProvider.java   
@Override
@Nullable
public HectorComponentPanel createConfigurable(@NotNull final PsiFile file) {
  if (DumbService.getInstance(file.getProject()).isDumb()) {
    return null;
  }
  if (myIncludeManager.getIncludingFiles(file.getVirtualFile(), false).length > 0) {
    return new FileIncludeContextHectorPanel(file, myIncludeManager);
  }
  return null;
}
项目:intellij-ce-playground    文件:HectorComponent.java   
private void onClose() {
  if (isModified()) {
    for (HectorComponentPanel panel : myAdditionalPanels) {
      try {
        panel.apply();
      }
      catch (ConfigurationException e) {
        //shouldn't be
      }
    }
    forceDaemonRestart();
    DaemonListeners.getInstance(myFile.getProject()).updateStatusBar();
  }
}
项目:intellij-ce-playground    文件:NoNamespaceConfigImpl.java   
@Override
@Nullable
public HectorComponentPanel createConfigurable(@NotNull PsiFile file) {
  if (file instanceof XmlFile) {
    try {
      final XmlTag rootTag = ((XmlFile)file).getDocument().getRootTag();
      if (rootTag.getNamespace().length() == 0) {
        return new NoNamespaceConfigPanel(NoNamespaceConfig.getInstance(file.getProject()), file);
      }
    } catch (NullPointerException e) {
      return null;
    }
  }
  return null;
}
项目:tools-idea    文件:PowerSaveHectorProvider.java   
@Override
public HectorComponentPanel createConfigurable(@NotNull PsiFile file) {
  return new HectorComponentPanel() {
    private final JCheckBox myCheckBox = new JCheckBox("Power Save Mode");

    @Override
    public JComponent createComponent() {
      return myCheckBox;
    }

    @Override
    public boolean isModified() {
      return myCheckBox.isSelected() != PowerSaveMode.isEnabled();
    }

    @Override
    public void apply() throws ConfigurationException {
      PowerSaveMode.setEnabled(myCheckBox.isSelected());
    }

    @Override
    public void reset() {
      myCheckBox.setSelected(PowerSaveMode.isEnabled());
    }

    @Override
    public void disposeUIResources() {
    }
  };
}
项目:tools-idea    文件:FileIncludeContextHectorProvider.java   
@Override
@Nullable
public HectorComponentPanel createConfigurable(@NotNull final PsiFile file) {
  if (DumbService.getInstance(file.getProject()).isDumb()) {
    return null;
  }
  if (myIncludeManager.getIncludingFiles(file.getVirtualFile(), false).length > 0) {
    return new FileIncludeContextHectorPanel(file, myIncludeManager);
  }
  return null;
}
项目:tools-idea    文件:HectorComponent.java   
private void onClose() {
  if (isModified()) {
    for (HectorComponentPanel panel : myAdditionalPanels) {
      try {
        panel.apply();
      }
      catch (ConfigurationException e) {
        //shouldn't be
      }
    }
    forceDaemonRestart();
    DaemonListeners.getInstance(myFile.getProject()).updateStatusBar();
  }
}
项目:tools-idea    文件:NoNamespaceConfigImpl.java   
@Nullable
public HectorComponentPanel createConfigurable(@NotNull PsiFile file) {
  if (file instanceof XmlFile) {
    try {
      final XmlTag rootTag = ((XmlFile)file).getDocument().getRootTag();
      if (rootTag.getNamespace().length() == 0) {
        return new NoNamespaceConfigPanel(NoNamespaceConfig.getInstance(file.getProject()), file);
      }
    } catch (NullPointerException e) {
      return null;
    }
  }
  return null;
}
项目:consulo    文件:PowerSaveHectorProvider.java   
@Override
public HectorComponentPanel createConfigurable(@Nonnull PsiFile file) {
  return new HectorComponentPanel() {
    private JCheckBox myCheckBox = new JCheckBox("Power Save Mode");

    @Override
    public JComponent createComponent() {
      return myCheckBox;
    }

    @Override
    public boolean isModified() {
      return myCheckBox.isSelected() != PowerSaveMode.isEnabled();
    }

    @Override
    public void apply() throws ConfigurationException {
      PowerSaveMode.setEnabled(myCheckBox.isSelected());
    }

    @Override
    public void reset() {
      myCheckBox.setSelected(PowerSaveMode.isEnabled());
    }

    @Override
    public void disposeUIResources() {
    }
  };
}
项目:consulo    文件:FileIncludeContextHectorProvider.java   
@Override
@Nullable
public HectorComponentPanel createConfigurable(@Nonnull final PsiFile file) {
  if (DumbService.getInstance(file.getProject()).isDumb()) {
    return null;
  }
  if (myIncludeManager.getIncludingFiles(file.getVirtualFile(), false).length > 0) {
    return new FileIncludeContextHectorPanel(file, myIncludeManager);
  }
  return null;
}
项目:consulo    文件:HectorComponent.java   
private void onClose() {
  if (isModified()) {
    for (HectorComponentPanel panel : myAdditionalPanels) {
      try {
        panel.apply();
      }
      catch (ConfigurationException e) {
        //shouldn't be
      }
    }
    forceDaemonRestart();
    DaemonListeners.getInstance(myFile.getProject()).updateStatusBar();
  }
}
项目:consulo-xml    文件:NoNamespaceConfigImpl.java   
@Override
@Nullable
public HectorComponentPanel createConfigurable(@NotNull PsiFile file) {
  if (file instanceof XmlFile) {
    try {
      final XmlTag rootTag = ((XmlFile)file).getDocument().getRootTag();
      if (rootTag.getNamespace().length() == 0) {
        return new NoNamespaceConfigPanel(NoNamespaceConfig.getInstance(file.getProject()), file);
      }
    } catch (NullPointerException e) {
      return null;
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:ImportPopupHectorComponentProvider.java   
@Override
public HectorComponentPanel createConfigurable(@NotNull final PsiFile file) {
  final Project project = file.getProject();
  final DaemonCodeAnalyzer analyzer = DaemonCodeAnalyzer.getInstance(project);
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final VirtualFile virtualFile = file.getVirtualFile();
  assert virtualFile != null;
  final boolean notInLibrary =
    !fileIndex.isInLibrarySource(virtualFile) && !fileIndex.isInLibraryClasses(virtualFile) || fileIndex.isInContent(virtualFile);

  return new HectorComponentPanel() {
    private JCheckBox myImportPopupCheckBox = new JCheckBox(EditorBundle.message("hector.import.popup.checkbox"));
    @Override
    public JComponent createComponent() {
      DialogUtil.registerMnemonic(myImportPopupCheckBox);
      return myImportPopupCheckBox;
    }

    @Override
    public boolean isModified() {
      return myImportPopupCheckBox.isSelected() != analyzer.isImportHintsEnabled(file);
    }

    @Override
    public void apply() throws ConfigurationException {
      analyzer.setImportHintsEnabled(file, myImportPopupCheckBox.isSelected());
    }

    @Override
    public void reset() {
      myImportPopupCheckBox.setSelected(analyzer.isImportHintsEnabled(file));
      myImportPopupCheckBox.setEnabled(analyzer.isAutohintsAvailable(file));
      myImportPopupCheckBox.setVisible(notInLibrary);
    }

    @Override
    public void disposeUIResources() {
      myImportPopupCheckBox = null;
    }
  };
}
项目:intellij-ce-playground    文件:AntHectorPanelProvider.java   
public HectorComponentPanel createConfigurable(@NotNull final PsiFile file) {
  if (file instanceof XmlFile && AntDomFileDescription.isAntFile(((XmlFile)file))) {
    return new AntHectorConfigurable(((XmlFile)file));
  }
  return null;
}
项目:tools-idea    文件:ImportPopupHectorComponentProvider.java   
@Override
public HectorComponentPanel createConfigurable(@NotNull final PsiFile file) {
  final Project project = file.getProject();
  final DaemonCodeAnalyzer analyzer = DaemonCodeAnalyzer.getInstance(project);
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final VirtualFile virtualFile = file.getVirtualFile();
  assert virtualFile != null;
  final boolean notInLibrary =
    !fileIndex.isInLibrarySource(virtualFile) && !fileIndex.isInLibraryClasses(virtualFile) || fileIndex.isInContent(virtualFile);

  return new HectorComponentPanel() {
    private JCheckBox myImportPopupCheckBox = new JCheckBox(EditorBundle.message("hector.import.popup.checkbox"));
    @Override
    public JComponent createComponent() {
      DialogUtil.registerMnemonic(myImportPopupCheckBox);
      return myImportPopupCheckBox;
    }

    @Override
    public boolean isModified() {
      return myImportPopupCheckBox.isSelected() != analyzer.isImportHintsEnabled(file);
    }

    @Override
    public void apply() throws ConfigurationException {
      analyzer.setImportHintsEnabled(file, myImportPopupCheckBox.isSelected());
    }

    @Override
    public void reset() {
      myImportPopupCheckBox.setSelected(analyzer.isImportHintsEnabled(file));
      myImportPopupCheckBox.setEnabled(analyzer.isAutohintsAvailable(file));
      myImportPopupCheckBox.setVisible(notInLibrary);
    }

    @Override
    public void disposeUIResources() {
      myImportPopupCheckBox = null;
    }
  };
}
项目:tools-idea    文件:AntHectorPanelProvider.java   
public HectorComponentPanel createConfigurable(@NotNull final PsiFile file) {
  if (file instanceof XmlFile && AntDomFileDescription.isAntFile(((XmlFile)file))) {
    return new AntHectorConfigurable(((XmlFile)file));
  }
  return null;
}
项目:consulo-apache-ant    文件:AntHectorPanelProvider.java   
public HectorComponentPanel createConfigurable(@NotNull final PsiFile file) {
  if (file instanceof XmlFile && AntDomFileDescription.isAntFile(((XmlFile)file))) {
    return new AntHectorConfigurable(((XmlFile)file));
  }
  return null;
}
项目:consulo    文件:ImportPopupHectorComponentProvider.java   
@Override
public HectorComponentPanel createConfigurable(@Nonnull final PsiFile file) {
  final Project project = file.getProject();
  final DaemonCodeAnalyzer analyzer = DaemonCodeAnalyzer.getInstance(project);
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final VirtualFile virtualFile = file.getVirtualFile();
  assert virtualFile != null;
  final boolean notInLibrary =
    !fileIndex.isInLibrarySource(virtualFile) && !fileIndex.isInLibraryClasses(virtualFile) || fileIndex.isInContent(virtualFile);

  return new HectorComponentPanel() {
    private JCheckBox myImportPopupCheckBox = new JCheckBox(EditorBundle.message("hector.import.popup.checkbox"));
    @Override
    public JComponent createComponent() {
      DialogUtil.registerMnemonic(myImportPopupCheckBox);
      return myImportPopupCheckBox;
    }

    @Override
    public boolean isModified() {
      return myImportPopupCheckBox.isSelected() != analyzer.isImportHintsEnabled(file);
    }

    @Override
    public void apply() throws ConfigurationException {
      analyzer.setImportHintsEnabled(file, myImportPopupCheckBox.isSelected());
    }

    @Override
    public void reset() {
      myImportPopupCheckBox.setSelected(analyzer.isImportHintsEnabled(file));
      myImportPopupCheckBox.setEnabled(analyzer.isAutohintsAvailable(file));
      myImportPopupCheckBox.setVisible(notInLibrary);
    }

    @Override
    public void disposeUIResources() {
      myImportPopupCheckBox = null;
    }
  };
}