diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java index 639004bf4586..2d41d411d3e8 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java @@ -70,6 +70,7 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.net.URL; import java.util.*; +import java.util.function.Predicate; public class UnusedDeclarationPresentation extends DefaultInspectionToolPresentation { private final Map> myPackageContents = Collections.synchronizedMap(new HashMap>()); @@ -125,7 +126,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta @Override public void exportResults(@NotNull final Element parentNode, @NotNull RefEntity refEntity, - @NotNull Set excludedDescriptions) { + @NotNull Predicate excludedDescriptions) { if (!(refEntity instanceof RefJavaElement)) return; final RefFilter filter = getFilter(); if (!getIgnoredRefElements().contains(refEntity) && filter.accepts((RefJavaElement)refEntity)) { diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/HTMLComposerImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/HTMLComposerImpl.java index b5f18c246efc..bdbf81f83524 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/HTMLComposerImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/HTMLComposerImpl.java @@ -92,17 +92,13 @@ public abstract class HTMLComposerImpl extends HTMLComposer { if (refEntity instanceof RefElement) { RefElement refElement = (RefElement)refEntity; - appendHeading(buf, InspectionsBundle.message("inspection.offline.view.tool.display.name.title")); - buf.append(BR); - appendAfterHeaderIndention(buf); - - appendShortName(buf, refElement); - buf.append(BR).append(BR); - appendHeading(buf, InspectionsBundle.message("inspection.export.results.capitalized.location")); + buf.append("
"); + appendShortName(buf, refElement); buf.append(BR); - appendAfterHeaderIndention(buf); + buf.append("in "); appendLocation(buf, refElement); + buf.append("
"); buf.append(BR).append(BR); } } @@ -202,12 +198,9 @@ public abstract class HTMLComposerImpl extends HTMLComposer { buf.append(A_CLOSING); } - protected void appendQuickFix(@NonNls final StringBuffer buf, String text, int index) { + protected void appendQuickFix(@NonNls final StringBuffer buf, String text) { if (myExporter == null) { - buf.append(""); buf.append(text); - buf.append(""); } } @@ -299,8 +292,7 @@ public abstract class HTMLComposerImpl extends HTMLComposer { if (where instanceof RefElement && !where.isValid()) return; if (quickFixes != null) { boolean listStarted = false; - for (int i = 0; i < quickFixes.length; i++) { - final String text = quickFixes[i]; + for (final String text : quickFixes) { if (text == null) continue; if (!listStarted) { appendHeading(buf, InspectionsBundle.message("inspection.problem.resolution")); @@ -308,7 +300,7 @@ public abstract class HTMLComposerImpl extends HTMLComposer { listStarted = true; } startListItem(buf); - appendQuickFix(buf, text, i); + appendQuickFix(buf, text); doneListItem(buf); } diff --git a/platform/lang-api/src/com/intellij/execution/configurations/ModuleBasedConfiguration.java b/platform/lang-api/src/com/intellij/execution/configurations/ModuleBasedConfiguration.java index 9c5e7f9613ae..3ead8069b323 100644 --- a/platform/lang-api/src/com/intellij/execution/configurations/ModuleBasedConfiguration.java +++ b/platform/lang-api/src/com/intellij/execution/configurations/ModuleBasedConfiguration.java @@ -80,6 +80,10 @@ public abstract class ModuleBasedConfiguration configuration = (ModuleBasedConfiguration)getFactory().createTemplateConfiguration(getProject()); @@ -92,11 +96,11 @@ public abstract class ModuleBasedConfiguration li { li input:checked + ol > li:last-child { margin: 0 0 1px; +} + +div.location { + margin-left: 40px; } \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java index 9eede64bf64b..bfc7d26c7610 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -255,7 +255,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp try { InspectionToolWrapper toolWrapper = state.getTool(); InspectionToolPresentation presentation = getPresentation(toolWrapper); - presentation.exportResults(element, refEntity, Collections.emptySet()); + presentation.exportResults(element, refEntity, d -> false); } catch (Throwable e) { LOG.error("Problem when exporting: " + refEntity.getExternalName(), e); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/export/ExportToHTMLDialog.java b/platform/lang-impl/src/com/intellij/codeInspection/export/ExportToHTMLDialog.java index c11e840a0d0e..6eb3c423f2be 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/export/ExportToHTMLDialog.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/export/ExportToHTMLDialog.java @@ -22,14 +22,16 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.ui.OptionGroup; +import com.intellij.util.ui.GraphicsUtil; import javax.swing.*; +import java.awt.*; public class ExportToHTMLDialog extends DialogWrapper{ private final Project myProject; - protected JCheckBox myCbOpenInBrowser; - protected TextFieldWithBrowseButton myTargetDirectoryField; - protected final boolean myCanBeOpenInBrowser; + private JCheckBox myCbOpenInBrowser; + private TextFieldWithBrowseButton myTargetDirectoryField; + private final boolean myCanBeOpenInBrowser; public ExportToHTMLDialog(Project project, final boolean canBeOpenInBrowser) { super(project, true); @@ -42,12 +44,8 @@ public class ExportToHTMLDialog extends DialogWrapper{ @Override protected JComponent createNorthPanel() { - OptionGroup optionGroup = new OptionGroup(); - myTargetDirectoryField = new TextFieldWithBrowseButton(); - optionGroup.add(com.intellij.codeEditor.printing.ExportToHTMLDialog.assignLabel(myTargetDirectoryField, myProject)); - - return optionGroup.createPanel(); + return com.intellij.codeEditor.printing.ExportToHTMLDialog.assignLabel(myTargetDirectoryField, myProject); } @Override @@ -71,7 +69,9 @@ public class ExportToHTMLDialog extends DialogWrapper{ if (myCanBeOpenInBrowser) { myCbOpenInBrowser.setSelected(exportToHTMLSettings.OPEN_IN_BROWSER); } - myTargetDirectoryField.setText(exportToHTMLSettings.OUTPUT_DIRECTORY); + final String text = exportToHTMLSettings.OUTPUT_DIRECTORY; + myTargetDirectoryField.setText(text); + myTargetDirectoryField.setPreferredSize(new Dimension(GraphicsUtil.stringWidth(text, myTargetDirectoryField.getFont()) + 100, myTargetDirectoryField.getPreferredSize().height)); } public void apply() { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/export/InspectionTreeHtmlWriter.java b/platform/lang-impl/src/com/intellij/codeInspection/export/InspectionTreeHtmlWriter.java index 4521c89bb97d..213ec7b9cd81 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/export/InspectionTreeHtmlWriter.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/export/InspectionTreeHtmlWriter.java @@ -17,7 +17,9 @@ package com.intellij.codeInspection.export; import com.intellij.codeHighlighting.HighlightDisplayLevel; import com.intellij.codeInsight.daemon.HighlightDisplayKey; -import com.intellij.codeInspection.*; +import com.intellij.codeInspection.CommonProblemDescriptor; +import com.intellij.codeInspection.InspectionProfile; +import com.intellij.codeInspection.ProblemDescriptorBase; import com.intellij.codeInspection.ex.HTMLComposerImpl; import com.intellij.codeInspection.ex.InspectionToolWrapper; import com.intellij.codeInspection.reference.RefEntity; @@ -26,6 +28,7 @@ import com.intellij.codeInspection.ui.*; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.ui.SimpleTextAttributes; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -44,13 +47,13 @@ public class InspectionTreeHtmlWriter { private final RefManager myManager; private final ExcludedInspectionTreeNodesManager myExcludedManager; - public InspectionTreeHtmlWriter(InspectionTree tree, + public InspectionTreeHtmlWriter(InspectionResultsView view, String outputDir) { - myTree = tree; + myTree = view.getTree(); myOutputDir = outputDir; - myProfile = tree.getContext().getCurrentProfile(); - myManager = tree.getContext().getRefManager(); - myExcludedManager = tree.getContext().getView().getExcludedManager(); + myProfile = view.getCurrentProfile(); + myManager = view.getGlobalInspectionContext().getRefManager(); + myExcludedManager = view.getExcludedManager(); serializeTreeToHtml(); } @@ -71,6 +74,17 @@ public class InspectionTreeHtmlWriter { appendHeader(); appendTree((builder) -> { final HTMLComposerImpl[] exporter = new HTMLComposerImpl[] {null}; + final InspectionTreeTailRenderer tailRenderer = new InspectionTreeTailRenderer(myTree.getContext()) { + @Override + protected void appendText(String text, SimpleTextAttributes attributes) { + builder.append(escapeNonBreakingSymbols(text)); + } + + @Override + protected void appendText(String text) { + builder.append(escapeNonBreakingSymbols(text)); + } + }; traverseInspectionTree(myTree.getRoot(), (n) -> { final int nodeId = System.identityHashCode(n); @@ -79,9 +93,9 @@ public class InspectionTreeHtmlWriter { .append(nodeId) .append("\">") .append(convertNodeToHtml(n)) - .append(" ") - .append(getTailText(n)) - .append(""); + tailRenderer.appendTailText(n); + builder.append(""); } - private static String getTailText(InspectionTreeNode node) { - if (node instanceof ProblemDescriptionNode) { - final CommonProblemDescriptor descriptor = ((ProblemDescriptionNode)node).getDescriptor(); - if (descriptor instanceof ProblemDescriptorBase) { - - final int number = ((ProblemDescriptorBase)descriptor).getLineNumber(); - return "(at line " + number + ")"; - } - } - return escapeNonBreakingSymbols(InspectionsBundle.message("inspection.problem.descriptor.count", node.getProblemCount())); - } - private void appendTree(Consumer treeRenderer) { myBuilder.append("

Inspection tree:

"); treeRenderer.accept(myBuilder); @@ -195,6 +197,6 @@ public class InspectionTreeHtmlWriter { } private static String escapeNonBreakingSymbols(@NotNull Object source) { - return StringUtil.replace(source.toString(), new String[]{" ", "-"}, new String[]{" ", "‑"}); + return StringUtil.replace(StringUtil.escapeXml(source.toString()), new String[]{" ", "-"}, new String[]{" ", "‑"}); } } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java index 3513d4247aa9..d277b3e84086 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java @@ -54,6 +54,7 @@ import org.jetbrains.annotations.Nullable; import java.io.*; import java.util.*; +import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -173,12 +174,12 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro @Override public void exportResults(@NotNull final Element parentNode, - @NotNull final Set excludedEntities, - @NotNull final Set excludedDescriptors) { + @NotNull final Predicate excludedEntities, + @NotNull final Predicate excludedDescriptors) { getRefManager().iterate(new RefVisitor(){ @Override public void visitElement(@NotNull RefEntity elem) { - if (!excludedEntities.contains(elem)) { + if (!excludedEntities.test(elem)) { exportResults(parentNode, elem, excludedDescriptors); } } @@ -294,7 +295,7 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro private synchronized void writeOutput(@NotNull final CommonProblemDescriptor[] descriptions, @NotNull RefEntity refElement) { final Element parentNode = new Element(InspectionsBundle.message("inspection.problems")); - exportResults(descriptions, refElement, parentNode, Collections.emptySet()); + exportResults(descriptions, refElement, parentNode, d -> false); final List list = parentNode.getChildren(); @NonNls final String ext = ".xml"; @@ -474,12 +475,12 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro @Override public void exportResults(@NotNull final Element parentNode, @NotNull RefEntity refEntity, - @NotNull Set excludedDescriptors) { + @NotNull Predicate isDescriptorExcluded) { synchronized (lock) { if (getProblemElements().containsKey(refEntity)) { CommonProblemDescriptor[] descriptions = getDescriptions(refEntity); if (descriptions != null) { - exportResults(descriptions, refEntity, parentNode, excludedDescriptors); + exportResults(descriptions, refEntity, parentNode, isDescriptorExcluded); } } } @@ -488,9 +489,9 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro private void exportResults(@NotNull final CommonProblemDescriptor[] descriptors, @NotNull RefEntity refEntity, @NotNull Element parentNode, - @NotNull Set excludedDescriptors) { + @NotNull Predicate isDescriptorExcluded) { for (CommonProblemDescriptor descriptor : descriptors) { - if (excludedDescriptors.contains(descriptor)) continue; + if (isDescriptorExcluded.test(descriptor)) continue; @NonNls final String template = descriptor.getDescriptionTemplate(); int line = descriptor instanceof ProblemDescriptor ? ((ProblemDescriptor)descriptor).getLineNumber() : -1; final PsiElement psiElement = descriptor instanceof ProblemDescriptor ? ((ProblemDescriptor)descriptor).getPsiElement() : null; diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/ExcludedInspectionTreeNodesManager.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/ExcludedInspectionTreeNodesManager.java index 5250c6566a2d..3362b90900eb 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/ExcludedInspectionTreeNodesManager.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/ExcludedInspectionTreeNodesManager.java @@ -16,10 +16,16 @@ package com.intellij.codeInspection.ui; +import com.intellij.codeInspection.CommonProblemDescriptor; +import com.intellij.codeInspection.offlineViewer.OfflineProblemDescriptorNode; +import com.intellij.codeInspection.offlineViewer.OfflineRefElementNode; +import com.intellij.codeInspection.reference.RefEntity; import com.intellij.util.containers.FactoryMap; import gnu.trove.THashSet; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collections; import java.util.Map; import java.util.Set; @@ -32,12 +38,18 @@ public class ExcludedInspectionTreeNodesManager { @Nullable @Override protected Set create(Class key) { - return new THashSet<>(); + return new THashSet(); } }; + private final boolean myOffline; + + public ExcludedInspectionTreeNodesManager(boolean offline) { + myOffline = offline; + } + public synchronized boolean isExcluded(InspectionTreeNode node) { - final Set excluded = myExcludedNodeObjects.get(node.getClass()); + final Set excluded = myExcludedNodeObjects.get(node.getClass()); return excluded.contains(node.getUserObject()); } @@ -48,4 +60,12 @@ public class ExcludedInspectionTreeNodesManager { public synchronized void amnesty(InspectionTreeNode node) { myExcludedNodeObjects.get(node.getClass()).remove(node.getUserObject()); } + + public synchronized boolean containsRefEntity(@NotNull RefEntity entity) { + return myExcludedNodeObjects.getOrDefault(myOffline ? OfflineRefElementNode.class : RefElementNode.class, Collections.emptySet()).contains(entity); + } + + public synchronized boolean containsProblemDescriptor(@NotNull CommonProblemDescriptor descriptor) { + return myExcludedNodeObjects.getOrDefault(myOffline ? OfflineProblemDescriptorNode.class : ProblemDescriptionNode.class, Collections.emptySet()).contains(descriptor); + } } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java index ccd8225a27f9..8a1b1dd38221 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java @@ -23,6 +23,7 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel; import com.intellij.codeInsight.daemon.HighlightDisplayKey; import com.intellij.codeInspection.*; import com.intellij.codeInspection.ex.*; +import com.intellij.codeInspection.offlineViewer.OfflineInspectionRVContentProvider; import com.intellij.codeInspection.reference.RefElement; import com.intellij.codeInspection.reference.RefEntity; import com.intellij.codeInspection.ui.actions.ExportHTMLAction; @@ -121,7 +122,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren private final ExclusionHandler myExclusionHandler; private EditorEx myPreviewEditor; private InspectionTreeLoadingProgressAware myLoadingProgressPreview; - private final ExcludedInspectionTreeNodesManager myExcludedInspectionTreeNodesManager = new ExcludedInspectionTreeNodesManager(); + private final ExcludedInspectionTreeNodesManager myExcludedInspectionTreeNodesManager; private final Set mySuppressedNodes = new HashSet<>(); private final ConcurrentMap> mySuppressActions = new ConcurrentHashMap<>(); @@ -135,6 +136,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren myScope = globalInspectionContext.getCurrentScope(); myGlobalInspectionContext = globalInspectionContext; myProvider = provider; + myExcludedInspectionTreeNodesManager = new ExcludedInspectionTreeNodesManager(provider instanceof OfflineInspectionRVContentProvider); myTree = new InspectionTree(myProject, globalInspectionContext, this); initTreeListeners(); @@ -436,7 +438,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren showInRightPanel(null); } } - else if (node instanceof InspectionRootNode || node instanceof InspectionGroupNode || node instanceof InspectionSeverityGroupNode) { + else if (node instanceof InspectionGroupNode || node instanceof InspectionSeverityGroupNode) { final InspectionViewNavigationPanel panel = new InspectionViewNavigationPanel(node, myTree); myLoadingProgressPreview = panel; mySplitter.setSecondComponent(panel); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewUtil.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewUtil.java index 95a483ec31fb..a7a54de092ce 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewUtil.java @@ -54,7 +54,7 @@ public class InspectionResultsViewUtil { @NotNull static JLabel getNothingToShowTextLabel() { - return createLabelForText(InspectionViewNavigationPanel.getTitleText(false, false)); + return createLabelForText(InspectionViewNavigationPanel.getTitleText(false)); } @NotNull diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionRootNode.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionRootNode.java index e8a1304552a5..0053e6090e0e 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionRootNode.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionRootNode.java @@ -16,46 +16,18 @@ package com.intellij.codeInspection.ui; -import com.intellij.codeInspection.InspectionsBundle; -import com.intellij.icons.AllIcons; -import com.intellij.openapi.application.ex.ApplicationInfoEx; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.IconLoader; -import com.intellij.util.PlatformUtils; import org.jetbrains.annotations.NotNull; -import javax.swing.*; -import javax.swing.tree.MutableTreeNode; - /** * @author max */ public class InspectionRootNode extends InspectionTreeNode { - private static final Icon APP_ICON = PlatformUtils.isJetBrainsProduct() - ? AllIcons.Nodes.IdeaProject - : IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getSmallIconUrl()); - private final Project myProject; - public InspectionRootNode(Project project, @NotNull InspectionTreeUpdater updater) { super(project); - myProject = project; myUpdater = updater; } - public String toString() { - return isEmpty() ? InspectionsBundle.message("inspection.empty.root.node.text") : - myProject.getName(); - } - - private boolean isEmpty() { - return getChildCount() == 0; - } - - @Override - public Icon getIcon(boolean expanded) { - return APP_ICON; - } - public InspectionTreeUpdater getUpdater() { return myUpdater; } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionRootNodeImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionRootNodeImpl.java new file mode 100644 index 000000000000..ce5223208a79 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionRootNodeImpl.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.codeInspection.ui; + +/** + * @author Dmitry Batkovich + */ +public class InspectionRootNodeImpl { +} diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionToolPresentation.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionToolPresentation.java index 9356ef20eaa2..66daf80e24fc 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionToolPresentation.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionToolPresentation.java @@ -31,6 +31,7 @@ import javax.swing.*; import java.util.Collection; import java.util.Map; import java.util.Set; +import java.util.function.Predicate; public interface InspectionToolPresentation extends ProblemDescriptionsProcessor { @@ -64,7 +65,7 @@ public interface InspectionToolPresentation extends ProblemDescriptionsProcessor IntentionAction findQuickFixes(@NotNull CommonProblemDescriptor descriptor, final String hint); @NotNull HTMLComposerImpl getComposer(); - void exportResults(@NotNull final Element parentNode, @NotNull RefEntity refEntity, Set excludedDescriptions); + void exportResults(@NotNull final Element parentNode, @NotNull RefEntity refEntity, Predicate isDescriptorExcluded); @NotNull Set getModuleProblems(); @Nullable @@ -88,8 +89,8 @@ public interface InspectionToolPresentation extends ProblemDescriptionsProcessor @NotNull Map descriptorMap, @Nullable CommonProblemDescriptor[] allowedDescriptors); void exportResults(@NotNull final Element parentNode, - @NotNull final Set excludedEntities, - @NotNull final Set excludedDescriptors); + @NotNull final Predicate isEntityExcluded, + @NotNull final Predicate isProblemExcluded); default JComponent getCustomPreviewPanel(RefEntity entity) { return null; diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeCellRenderer.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeCellRenderer.java index 92972ba66802..fb80d2c41def 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeCellRenderer.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeCellRenderer.java @@ -15,51 +15,34 @@ */ package com.intellij.codeInspection.ui; -import com.intellij.codeHighlighting.HighlightDisplayLevel; -import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; -import com.intellij.codeInspection.InspectionsBundle; import com.intellij.codeInspection.reference.RefElement; import com.intellij.codeInspection.reference.RefEntity; -import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.FileStatus; import com.intellij.ui.ColoredTreeCellRenderer; import com.intellij.ui.JBColor; import com.intellij.ui.SimpleTextAttributes; -import com.intellij.util.containers.FactoryMap; -import com.intellij.util.containers.SoftHashMap; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.util.Locale; -import java.util.Map; -import java.util.TreeMap; /** * @author Dmitry Batkovich */ class InspectionTreeCellRenderer extends ColoredTreeCellRenderer { - private final static int MAX_LEVEL_TYPES = 5; - - private final Map myPluralizedSeverityNames = new SoftHashMap<>(); - private final Map myUnpluralizedSeverityNames = new SoftHashMap<>(); - private final FactoryMap myItemCounter; private final InspectionResultsView myView; - private final SeverityRegistrar myRegistrar; + private final InspectionTreeTailRenderer myTailRenderer; public InspectionTreeCellRenderer(InspectionResultsView view) { - myRegistrar = SeverityRegistrar.getSeverityRegistrar(view.getProject()); - myItemCounter = new FactoryMap() { - @Nullable + myTailRenderer = new InspectionTreeTailRenderer(view.getGlobalInspectionContext()) { @Override - protected Integer create(HighlightDisplayLevel key) { - return 0; + protected void appendText(String text, SimpleTextAttributes attributes) { + append(text, attributes); } @Override - protected Map createMap() { - return new TreeMap<>((o1, o2) -> -myRegistrar.compare(o1.getSeverity(), o2.getSeverity())); + protected void appendText(String text) { + append(text); } }; myView = view; @@ -79,35 +62,7 @@ class InspectionTreeCellRenderer extends ColoredTreeCellRenderer { patchMainTextAttrs(node, node.appearsBold() ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : getMainForegroundAttributes(node))); - - append(" "); - final String customizedTailText = node.getCustomizedTailText(); - if (customizedTailText != null) { - append(" "); - append(customizedTailText, SimpleTextAttributes.GRAYED_ATTRIBUTES); - } - else { - myItemCounter.clear(); - node.visitProblemSeverities(myItemCounter); - if (myItemCounter.size() > MAX_LEVEL_TYPES) { - append(InspectionsBundle.message("inspection.problem.descriptor.count", - myItemCounter.values().stream().reduce(0, (i, j) -> i + j)) + " ", - SimpleTextAttributes.GRAYED_ATTRIBUTES); - } - else { - for (Map.Entry entry : myItemCounter.entrySet()) { - final HighlightDisplayLevel level = entry.getKey(); - final Integer occur = entry.getValue(); - - SimpleTextAttributes attrs = SimpleTextAttributes.GRAY_ATTRIBUTES; - if (level == HighlightDisplayLevel.ERROR && !myView.getGlobalInspectionContext().getUIOptions().GROUP_BY_SEVERITY) { - attrs = attrs.derive(-1, JBColor.red.brighter(), null, null); - } - append(occur + " " + getPresentableName(level, occur > 1) + " ", attrs); - } - } - } - + myTailRenderer.appendTailText(node); setIcon(node.getIcon(expanded)); // do not need reset model (for recalculation of prefered size) when digit number of problemCount is growth // or INVALID marker appears @@ -127,24 +82,6 @@ class InspectionTreeCellRenderer extends ColoredTreeCellRenderer { return attributes; } - private String getPresentableName(HighlightDisplayLevel level, boolean pluralize) { - final HighlightSeverity severity = level.getSeverity(); - if (pluralize) { - String name = myPluralizedSeverityNames.get(severity); - if (name == null) { - final String lowerCaseName = level.getName().toLowerCase(Locale.ENGLISH); - name = myPluralizedSeverityNames - .put(severity, myRegistrar.isDefaultSeverity(severity) ? StringUtil.pluralize(lowerCaseName) : lowerCaseName); - } - return name; - } else { - String name = myUnpluralizedSeverityNames.get(severity); - if (name == null) { - name = myUnpluralizedSeverityNames.put(severity, level.getName().toLowerCase(Locale.ENGLISH)); - } - return name; - } - } private static SimpleTextAttributes getMainForegroundAttributes(InspectionTreeNode node) { SimpleTextAttributes foreground = SimpleTextAttributes.REGULAR_ATTRIBUTES; diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeTailRenderer.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeTailRenderer.java new file mode 100644 index 000000000000..abeb9f41c1d2 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeTailRenderer.java @@ -0,0 +1,119 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.codeInspection.ui; + +import com.intellij.codeHighlighting.HighlightDisplayLevel; +import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; +import com.intellij.codeInspection.InspectionsBundle; +import com.intellij.codeInspection.ex.GlobalInspectionContextImpl; +import com.intellij.lang.annotation.HighlightSeverity; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.ui.JBColor; +import com.intellij.ui.SimpleTextAttributes; +import com.intellij.util.containers.FactoryMap; +import com.intellij.util.containers.SoftHashMap; +import org.jetbrains.annotations.Nullable; + +import java.util.Locale; +import java.util.Map; +import java.util.TreeMap; + +/** + * @author Dmitry Batkovich + */ +public abstract class InspectionTreeTailRenderer { + private final static int MAX_LEVEL_TYPES = 5; + + private final Map myPluralizedSeverityNames = new SoftHashMap<>(); + private final Map myUnpluralizedSeverityNames = new SoftHashMap<>(); + + private final FactoryMap myItemCounter; + private final SeverityRegistrar myRegistrar; + private final GlobalInspectionContextImpl myContext; + + public InspectionTreeTailRenderer(GlobalInspectionContextImpl context) { + myRegistrar = SeverityRegistrar.getSeverityRegistrar(context.getProject()); + myContext = context; + myItemCounter = new FactoryMap() { + + @Nullable + @Override + protected Integer create(HighlightDisplayLevel key) { + return 0; + } + + @Override + protected Map createMap() { + return new TreeMap<>((o1, o2) -> -myRegistrar.compare(o1.getSeverity(), o2.getSeverity())); + } + }; + } + + public void appendTailText(InspectionTreeNode node) { + appendText(" "); + final String customizedTailText = node.getCustomizedTailText(); + if (customizedTailText != null) { + appendText(" "); + appendText(customizedTailText, SimpleTextAttributes.GRAYED_ATTRIBUTES); + } + else { + myItemCounter.clear(); + node.visitProblemSeverities(myItemCounter); + if (myItemCounter.size() > MAX_LEVEL_TYPES) { + appendText(InspectionsBundle.message("inspection.problem.descriptor.count", + myItemCounter.values().stream().reduce(0, (i, j) -> i + j)) + " ", + SimpleTextAttributes.GRAYED_ATTRIBUTES); + } + else { + for (Map.Entry entry : myItemCounter.entrySet()) { + final HighlightDisplayLevel level = entry.getKey(); + final Integer occur = entry.getValue(); + + SimpleTextAttributes attrs = SimpleTextAttributes.GRAY_ATTRIBUTES; + if (level == HighlightDisplayLevel.ERROR && !myContext.getUIOptions().GROUP_BY_SEVERITY) { + attrs = attrs.derive(-1, JBColor.red.brighter(), null, null); + } + appendText(occur + " " + getPresentableName(level, occur > 1) + " ", attrs); + } + } + } + } + + protected abstract void appendText(String text, SimpleTextAttributes attributes); + + protected abstract void appendText(String text); + + private String getPresentableName(HighlightDisplayLevel level, boolean pluralize) { + final HighlightSeverity severity = level.getSeverity(); + if (pluralize) { + String name = myPluralizedSeverityNames.get(severity); + if (name == null) { + final String lowerCaseName = level.getName().toLowerCase(Locale.ENGLISH); + name = myRegistrar.isDefaultSeverity(severity) ? StringUtil.pluralize(lowerCaseName) : lowerCaseName; + myPluralizedSeverityNames.put(severity, name); + } + return name; + } + else { + String name = myUnpluralizedSeverityNames.get(severity); + if (name == null) { + name = level.getName().toLowerCase(Locale.ENGLISH); + myUnpluralizedSeverityNames.put(severity, name); + } + return name; + } + } +} diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeUpdater.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeUpdater.java index a024d6306251..8720e9e89e0d 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeUpdater.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTreeUpdater.java @@ -38,8 +38,8 @@ public class InspectionTreeUpdater { } public void updateWithPreviewPanel(@Nullable TreeNode node) { + myDoUpdatePreviewPanel.set(true); update(node, false); - myDoUpdatePreviewPanel.compareAndSet(false, true); } public void update(@Nullable TreeNode node, boolean force) { @@ -61,8 +61,6 @@ public class InspectionTreeUpdater { try { tree.setQueueUpdate(true); ((DefaultTreeModel)tree.getModel()).reload(); - tree.revalidate(); - tree.repaint(); tree.restoreExpansionAndSelection(tree.getRoot()); myView.openRightPanelIfNeed(); if (myDoUpdatePreviewPanel.compareAndSet(true, false)) { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionViewNavigationPanel.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionViewNavigationPanel.java index 110222cdaaab..3f3bbdf189ad 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionViewNavigationPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionViewNavigationPanel.java @@ -41,7 +41,7 @@ public class InspectionViewNavigationPanel extends JPanel implements InspectionT myTree = tree; setLayout(new BorderLayout()); setBorder(IdeBorderFactory.createEmptyBorder(18, 12, 0, 0)); - final String titleLabelText = getTitleText(myNode instanceof InspectionRootNode, true); + final String titleLabelText = getTitleText(true); add(new JBLabel(titleLabelText), BorderLayout.NORTH); myLinks = new JPanel(); myLinks.setLayout(new BoxLayout(myLinks, BoxLayout.Y_AXIS)); @@ -61,8 +61,8 @@ public class InspectionViewNavigationPanel extends JPanel implements InspectionT } @NotNull - public static String getTitleText(boolean addGroupWord, boolean addColon) { - return "Select inspection" + (addGroupWord ? " group " : " ") + "to see problems" + (addColon ? ":" : "."); + public static String getTitleText(boolean addColon) { + return "Select inspection to see problems" + (addColon ? ":" : "."); } private void resetChildrenNavigation() { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java index c3c1a90bc515..1a9a2a8e700c 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java @@ -154,6 +154,12 @@ public class ProblemDescriptionNode extends SuppressableInspectionTreeNode { @Nullable @Override public String getCustomizedTailText() { - return isQuickFixAppliedFromView() ? "" : super.getCustomizedTailText(); + if (isQuickFixAppliedFromView()) { + return ""; + } + else { + final String text = super.getCustomizedTailText(); + return text == null ? "" : text; + } } } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/ExportHTMLAction.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/ExportHTMLAction.java index d944676d43ed..bd3f06cfbe7b 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/ExportHTMLAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/ExportHTMLAction.java @@ -17,15 +17,14 @@ package com.intellij.codeInspection.ui.actions; import com.intellij.codeEditor.printing.ExportToHTMLSettings; -import com.intellij.codeInspection.CommonProblemDescriptor; import com.intellij.codeInspection.InspectionApplication; import com.intellij.codeInspection.InspectionsBundle; import com.intellij.codeInspection.ex.GlobalInspectionContextImpl; import com.intellij.codeInspection.ex.InspectionToolWrapper; import com.intellij.codeInspection.ex.ScopeToolState; import com.intellij.codeInspection.ex.Tools; -import com.intellij.codeInspection.export.*; -import com.intellij.codeInspection.reference.RefEntity; +import com.intellij.codeInspection.export.ExportToHTMLDialog; +import com.intellij.codeInspection.export.InspectionTreeHtmlWriter; import com.intellij.codeInspection.ui.*; import com.intellij.icons.AllIcons; import com.intellij.ide.BrowserUtil; @@ -53,7 +52,8 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; -import java.util.*; +import java.util.HashSet; +import java.util.Set; /** * User: anna @@ -76,8 +76,7 @@ public class ExportHTMLAction extends AnAction implements DumbAware { new BaseListPopupStep(InspectionsBundle.message("inspection.action.export.popup.title"), HTML, XML) { @Override public PopupStep onChosen(final String selectedValue, final boolean finalChoice) { - exportHTML(Comparing.strEqual(selectedValue, HTML)); - return PopupStep.FINAL_CHOICE; + return doFinalStep(() -> exportHTML(Comparing.strEqual(selectedValue, HTML))); } }); InspectionResultsView.showPopup(e, popup); @@ -96,42 +95,31 @@ public class ExportHTMLAction extends AnAction implements DumbAware { exportToHTMLDialog.apply(); final String outputDirectoryName = exportToHTMLSettings.OUTPUT_DIRECTORY; - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - final Runnable exportRunnable = new Runnable() { - @Override - public void run() { - ApplicationManager.getApplication().runReadAction(new Runnable() { - @Override - public void run() { - if (!exportToHTML) { - dump2xml(outputDirectoryName); - } - else { - try { - new InspectionTreeHtmlWriter(myView.getTree(), outputDirectoryName); - } - catch (ProcessCanceledException e) { - // Do nothing here. - } - } - } - }); + ApplicationManager.getApplication().invokeLater(() -> { + final Runnable exportRunnable = () -> ApplicationManager.getApplication().runReadAction(() -> { + if (!exportToHTML) { + dump2xml(outputDirectoryName); + } + else { + try { + new InspectionTreeHtmlWriter(myView, outputDirectoryName); + } + catch (ProcessCanceledException e) { + // Do nothing here. } - }; - - if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(exportRunnable, - InspectionsBundle.message(exportToHTML - ? "inspection.generating.html.progress.title" - : "inspection.generating.xml.progress.title"), true, - myView.getProject())) { - return; } + }); - if (exportToHTML && exportToHTMLSettings.OPEN_IN_BROWSER) { - BrowserUtil.browse(new File(exportToHTMLSettings.OUTPUT_DIRECTORY, "index.html")); - } + if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(exportRunnable, + InspectionsBundle.message(exportToHTML + ? "inspection.generating.html.progress.title" + : "inspection.generating.xml.progress.title"), true, + myView.getProject())) { + return; + } + + if (exportToHTML && exportToHTMLSettings.OPEN_IN_BROWSER) { + BrowserUtil.browse(new File(exportToHTMLSettings.OUTPUT_DIRECTORY, "index.html")); } }); } @@ -144,49 +132,33 @@ public class ExportHTMLAction extends AnAction implements DumbAware { } final InspectionTreeNode root = myView.getTree().getRoot(); final IOException[] ex = new IOException[1]; - TreeUtil.traverse(root, new TreeUtil.Traverse() { - @Override - public boolean accept(final Object node) { - if (node instanceof InspectionNode) { - InspectionNode toolNode = (InspectionNode)node; - Element problems = new Element(PROBLEMS); - InspectionToolWrapper toolWrapper = toolNode.getToolWrapper(); + TreeUtil.traverse(root, node -> { + if (node instanceof InspectionNode) { + InspectionNode toolNode = (InspectionNode)node; + Element problems = new Element(PROBLEMS); + InspectionToolWrapper toolWrapper = toolNode.getToolWrapper(); - final Set toolWrappers = getWorkedTools(toolNode); - for (InspectionToolWrapper wrapper : toolWrappers) { - InspectionToolPresentation presentation = myView.getGlobalInspectionContext().getPresentation(wrapper); - if (!toolNode.isExcluded(myView.getExcludedManager())) { - final Set excludedEntities = new HashSet<>(); - final Set excludedDescriptors = new HashSet<>(); - TreeUtil.traverse(toolNode, o -> { - InspectionTreeNode n = (InspectionTreeNode)o; - if (n.isExcluded(myView.getExcludedManager())) { - if (n instanceof RefElementNode) { - excludedEntities.add(((RefElementNode)n).getElement()); - } - if (n instanceof ProblemDescriptionNode) { - excludedDescriptors.add(((ProblemDescriptionNode)n).getDescriptor()); - } - } - return true; - }); - presentation.exportResults(problems, excludedEntities, excludedDescriptors); - } - } - PathMacroManager.getInstance(myView.getProject()).collapsePaths(problems); - try { - if (problems.getContentSize() != 0) { - JDOMUtil.writeDocument(new Document(problems), - outputDirectoryName + File.separator + toolWrapper.getShortName() + InspectionApplication.XML_EXTENSION, - CodeStyleSettingsManager.getSettings(null).getLineSeparator()); - } - } - catch (IOException e) { - ex[0] = e; + final Set toolWrappers = getWorkedTools(toolNode); + for (InspectionToolWrapper wrapper : toolWrappers) { + InspectionToolPresentation presentation = myView.getGlobalInspectionContext().getPresentation(wrapper); + final ExcludedInspectionTreeNodesManager excludedManager = myView.getExcludedManager(); + if (!toolNode.isExcluded(excludedManager)) { + presentation.exportResults(problems, excludedManager::containsRefEntity, excludedManager::containsProblemDescriptor); } } - return true; + PathMacroManager.getInstance(myView.getProject()).collapsePaths(problems); + try { + if (problems.getContentSize() != 0) { + JDOMUtil.writeDocument(new Document(problems), + outputDirectoryName + File.separator + toolWrapper.getShortName() + InspectionApplication.XML_EXTENSION, + CodeStyleSettingsManager.getSettings(null).getLineSeparator()); + } + } + catch (IOException e) { + ex[0] = e; + } } + return true; }); if (ex[0] != null) { throw ex[0]; @@ -201,12 +173,7 @@ public class ExportHTMLAction extends AnAction implements DumbAware { CodeStyleSettingsManager.getSettings(null).getLineSeparator()); } catch (final IOException e) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - Messages.showErrorDialog(myView, e.getMessage()); - } - }); + ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(myView, e.getMessage())); } } diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties index 996ecead056a..2114486e6d55 100644 --- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties +++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties @@ -248,7 +248,6 @@ inspection.action.apply.quickfix.description=Apply an inspection quickfix inspection.tree.popup.title=Accept Resolution inspection.action.rerun=Rerun Inspection inspection.general.tools.group.name=General -inspection.empty.root.node.text=Nothing left to show inspection.invalid.node.text=(INVALID) inspection.problem.descriptor.count={0, choice, 0#|1#(1 item)|2#({0,number,integer} items)} inspection.action.go.next=Go Next Problem diff --git a/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java index e44c9650d9eb..e0dd032f0e95 100644 --- a/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/InspectionTestUtil.java @@ -33,7 +33,6 @@ import java.io.CharArrayReader; import java.io.File; import java.io.StreamTokenizer; import java.util.ArrayList; -import java.util.Collections; import java.util.List; public class InspectionTestUtil { @@ -139,7 +138,7 @@ expected: InspectionToolPresentation presentation = context.getPresentation(toolWrapper); presentation.updateContent(); //e.g. dead code need check for reachables - presentation.exportResults(root, Collections.emptySet(), Collections.emptySet()); + presentation.exportResults(root, x -> false, x -> false); File file = new File(testDir + "/expected.xml"); try { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonRunConfiguration.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonRunConfiguration.java index d5f14e4e3b01..64781af2557a 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonRunConfiguration.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonRunConfiguration.java @@ -17,7 +17,6 @@ package org.jetbrains.plugins.groovy.griffon; import com.intellij.execution.configurations.ConfigurationFactory; -import com.intellij.execution.configurations.ModuleBasedConfiguration; import com.intellij.execution.configurations.RunConfigurationModule; import com.intellij.openapi.project.Project; import org.jetbrains.plugins.groovy.mvc.MvcRunConfiguration; @@ -35,13 +34,4 @@ public class GriffonRunConfiguration extends MvcRunConfiguration { protected String getNoSdkMessage() { return "Griffon SDK is not configured"; } - - @Override - protected ModuleBasedConfiguration createInstance() { - GriffonRunConfiguration res = new GriffonRunConfiguration(myFactory, getConfigurationModule().getProject(), getName(), cmdLine); - res.envs.putAll(envs); - res.passParentEnv = passParentEnv; - return res; - } - } \ No newline at end of file diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java b/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java index 6da637dd5210..21568c6702d8 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java @@ -188,11 +188,6 @@ public class JUnitConfiguration extends JavaTestConfigurationBase { return JavaRunConfigurationModule.getModulesForClass(getProject(), myData.getMainClassName()); } - @Override - protected ModuleBasedConfiguration createInstance() { - return new JUnitConfiguration(getName(), getProject(), myData.clone(), JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);// throw new RuntimeException("Should not call"); - } - @Override public String suggestedName() { return myData.getGeneratedName(getConfigurationModule()); diff --git a/plugins/junit/src/com/intellij/execution/junit/testDiscovery/JUnitTestDiscoveryConfiguration.java b/plugins/junit/src/com/intellij/execution/junit/testDiscovery/JUnitTestDiscoveryConfiguration.java index 70460e4ca74c..dddbc7f1e081 100644 --- a/plugins/junit/src/com/intellij/execution/junit/testDiscovery/JUnitTestDiscoveryConfiguration.java +++ b/plugins/junit/src/com/intellij/execution/junit/testDiscovery/JUnitTestDiscoveryConfiguration.java @@ -45,14 +45,6 @@ public class JUnitTestDiscoveryConfiguration extends TestDiscoveryConfiguration new JUnitConfiguration("", project, JUnitConfigurationType.getInstance().getConfigurationFactories()[0])); } - @Override - protected ModuleBasedConfiguration createInstance() { - final JUnitTestDiscoveryConfigurationType configurationType = - ConfigurationTypeUtil.findConfigurationType(JUnitTestDiscoveryConfigurationType.class); - final ConfigurationFactory[] factories = configurationType.getConfigurationFactories(); - return new JUnitTestDiscoveryConfiguration(getName(), getProject(), factories[0]); - } - @Nullable @Override public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException { diff --git a/plugins/properties/src/com/intellij/lang/properties/parsing/idea-skeleton b/plugins/properties/src/com/intellij/lang/properties/parsing/idea-skeleton deleted file mode 100644 index 0866f9f0c7b6..000000000000 --- a/plugins/properties/src/com/intellij/lang/properties/parsing/idea-skeleton +++ /dev/null @@ -1,262 +0,0 @@ - /** initial size of the lookahead buffer */ ---- private static final int ZZ_BUFFERSIZE = ...; - - /** lexical states */ ---- lexical states, charmap - - /* error codes */ - private static final int ZZ_UNKNOWN_ERROR = 0; - private static final int ZZ_NO_MATCH = 1; - private static final int ZZ_PUSHBACK_2BIG = 2; - private static final char[] EMPTY_BUFFER = new char[0]; - private static final int YYEOF = -1; - - /* error messages for the codes above */ - private static final String ZZ_ERROR_MSG[] = { - "Unkown internal scanner error", - "Error: could not match input", - "Error: pushback value was too large" - }; - ---- isFinal list - /** the current state of the DFA */ - private int zzState; - - /** the current lexical state */ - private int zzLexicalState = YYINITIAL; - - /** this buffer contains the current text to be matched and is - the source of the yytext() string */ - private char zzBuffer[] = EMPTY_BUFFER; - - /** the textposition at the last accepting state */ - private int zzMarkedPos; - - /** the textposition at the last state to be included in yytext */ - private int zzPushbackPos; - - /** the current text position in the buffer */ - private int zzCurrentPos; - - /** startRead marks the beginning of the yytext() string in the buffer */ - private int zzStartRead; - - /** endRead marks the last character in the buffer, that has been read - from input */ - private int zzEndRead; - - /** - * zzAtBOL == true <=> the scanner is currently at the beginning of a line - */ - private boolean zzAtBOL = true; - - /** zzAtEOF == true <=> the scanner is at the EOF */ - private boolean zzAtEOF; - ---- user class code - - /** - * Creates a new scanner - * There is also a java.io.InputStream version of this constructor. - * - * @param in the java.io.Reader to read input from. - */ ---- constructor declaration - - - /** - * Refills the input buffer. - * - * @return false, iff there was new input. - * - * @exception java.io.IOException if any I/O-Error occurs - */ - private boolean zzRefill() throws java.io.IOException { - return true; - } - - - /** - * Closes the input stream. - */ - public final void yyclose() throws java.io.IOException { - zzAtEOF = true; /* indicate end of file */ - zzEndRead = zzStartRead; /* invalidate buffer */ - } - - - /** - * Resets the scanner to read from a new input stream. - * Does not close the old reader. - * - * All internal variables are reset, the old input stream - * cannot be reused (internal buffer is discarded and lost). - * Lexical state is set to ZZ_INITIAL. - * - * @param reader the new input stream - */ - public final void yyreset(java.io.Reader reader) { - zzAtBOL = true; - zzAtEOF = false; - zzEndRead = zzStartRead = 0; - zzCurrentPos = zzMarkedPos = zzPushbackPos = 0; - zzLexicalState = YYINITIAL; - } - - - /** - * Returns the current lexical state. - */ - public final int yystate() { - return zzLexicalState; - } - - - /** - * Enters a new lexical state - * - * @param newState the new lexical state - */ - public final void yybegin(int newState) { - zzLexicalState = newState; - } - - - /** - * Returns the text matched by the current regular expression. - */ - public final String yytext() { - return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); - } - - - /** - * Returns the character at position pos from the - * matched text. - * - * It is equivalent to yytext().charAt(pos), but faster - * - * @param pos the position of the character to fetch. - * A value from 0 to yylength()-1. - * - * @return the character at position pos - */ - public final char yycharat(int pos) { - return zzBuffer[zzStartRead+pos]; - } - - - /** - * Returns the length of the matched text region. - */ - public final int yylength() { - return zzMarkedPos-zzStartRead; - } - - - /** - * Reports an error that occured while scanning. - * - * In a wellformed scanner (no or only correct usage of - * yypushback(int) and a match-all fallback rule) this method - * will only be called with things that "Can't Possibly Happen". - * If this method is called, something is seriously wrong - * (e.g. a JFlex bug producing a faulty scanner etc.). - * - * Usual syntax/scanner level error handling should be done - * in error fallback rules. - * - * @param errorCode the code of the errormessage to display - */ ---- zzScanError declaration - String message; - try { - message = ZZ_ERROR_MSG[errorCode]; - } - catch (ArrayIndexOutOfBoundsException e) { - message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; - } - ---- throws clause - } - - - /** - * Pushes the specified amount of characters back into the input stream. - * - * They will be read again by then next call of the scanning method - * - * @param number the number of characters to be read again. - * This number must not be greater than yylength()! - */ ---- yypushback decl (contains zzScanError exception) - if ( number > yylength() ) - zzScanError(ZZ_PUSHBACK_2BIG); - - zzMarkedPos -= number; - } - - ---- zzDoEOF - /** - * Resumes scanning until the next regular expression is matched, - * the end of input is encountered or an I/O-Error occurs. - * - * @return the next token - * @exception java.io.IOException if any I/O-Error occurs - */ ---- yylex declaration - int zzInput; - int zzAction; - - // cached fields: - int zzCurrentPosL; - int zzMarkedPosL; - int zzEndReadL = zzEndRead; - char [] zzBufferL = zzBuffer; - char [] zzCMapL = ZZ_CMAP; - ---- local declarations - - while (true) { - zzMarkedPosL = zzMarkedPos; - ---- start admin (line, char, col count) - zzAction = -1; - - zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; - ---- start admin (lexstate etc) - - zzForAction: { - while (true) { - ---- next input, line, col, char count, next transition, isFinal action - zzAction = zzState; - zzMarkedPosL = zzCurrentPosL; ---- line count update - } - - } - } - - // store back cached position - zzMarkedPos = zzMarkedPosL; ---- char count update - ---- actions - default: - if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { - zzAtEOF = true; ---- eofvalue - } - else { ---- no match - } - } - } - } - ---- main - -} diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfiguration.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfiguration.java index f10fab50855a..bf27fb5c4622 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfiguration.java +++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfiguration.java @@ -128,12 +128,6 @@ public class TestNGConfiguration extends JavaTestConfigurationBase { return data; } - @Override - protected ModuleBasedConfiguration createInstance() { - return new TestNGConfiguration(getName(), getProject(), data.clone(), - TestNGConfigurationType.getInstance().getConfigurationFactories()[0]); - } - @Override public Collection getValidModules() { //TODO add handling for package diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/testDiscovery/TestNGTestDiscoveryConfiguration.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/testDiscovery/TestNGTestDiscoveryConfiguration.java index 09efc7ef06aa..9ecb0d556213 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/configuration/testDiscovery/TestNGTestDiscoveryConfiguration.java +++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/testDiscovery/TestNGTestDiscoveryConfiguration.java @@ -45,14 +45,6 @@ public class TestNGTestDiscoveryConfiguration extends TestDiscoveryConfiguration new TestNGConfiguration("", project, TestNGConfigurationType.getInstance().getConfigurationFactories()[0])); } - @Override - protected ModuleBasedConfiguration createInstance() { - final TestNGTestDiscoveryConfigurationType configurationType = - ConfigurationTypeUtil.findConfigurationType(TestNGTestDiscoveryConfigurationType.class); - final ConfigurationFactory[] factories = configurationType.getConfigurationFactories(); - return new TestNGTestDiscoveryConfiguration(getName(), getProject(), factories[0]); - } - @Nullable @Override public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException {