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; }
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; }
@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() { } }; }
@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; }
private void onClose() { if (isModified()) { for (HectorComponentPanel panel : myAdditionalPanels) { try { panel.apply(); } catch (ConfigurationException e) { //shouldn't be } } forceDaemonRestart(); DaemonListeners.getInstance(myFile.getProject()).updateStatusBar(); } }
@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; }
@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; }
@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() { } }; }
@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; }
@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; } }; }
public HectorComponentPanel createConfigurable(@NotNull final PsiFile file) { if (file instanceof XmlFile && AntDomFileDescription.isAntFile(((XmlFile)file))) { return new AntHectorConfigurable(((XmlFile)file)); } return null; }
@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; } }; }