Merge remote-tracking branch 'origin/master'

This commit is contained in:
Max Medvedev
2016-05-05 11:18:28 +03:00
28 changed files with 305 additions and 558 deletions
@@ -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<String, Set<RefEntity>> myPackageContents = Collections.synchronizedMap(new HashMap<String, Set<RefEntity>>());
@@ -125,7 +126,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
@Override
public void exportResults(@NotNull final Element parentNode,
@NotNull RefEntity refEntity,
@NotNull Set<CommonProblemDescriptor> excludedDescriptions) {
@NotNull Predicate<CommonProblemDescriptor> excludedDescriptions) {
if (!(refEntity instanceof RefJavaElement)) return;
final RefFilter filter = getFilter();
if (!getIgnoredRefElements().contains(refEntity) && filter.accepts((RefJavaElement)refEntity)) {
@@ -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("<div class=\"location\">");
appendShortName(buf, refElement);
buf.append(BR);
appendAfterHeaderIndention(buf);
buf.append("in ");
appendLocation(buf, refElement);
buf.append("</div>");
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("<a HREF=\"file://bred.txt#invoke:").append(index);
buf.append("\">");
buf.append(text);
buf.append("</a>");
}
}
@@ -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);
}
@@ -80,6 +80,10 @@ public abstract class ModuleBasedConfiguration<ConfigurationModule extends RunCo
return Arrays.asList(ModuleManager.getInstance(getProject()).getModules());
}
/**
* @deprecated method {@link com.intellij.execution.configurations.ConfigurationFactory#createTemplateConfiguration(com.intellij.openapi.project.Project)}
* would be used instead to avoid wrong custom 'cloning'
*/
protected ModuleBasedConfiguration createInstance() {
ModuleBasedConfiguration<ConfigurationModule> configuration =
(ModuleBasedConfiguration<ConfigurationModule>)getFactory().createTemplateConfiguration(getProject());
@@ -92,11 +96,11 @@ public abstract class ModuleBasedConfiguration<ConfigurationModule extends RunCo
final Element element = new Element(TO_CLONE_ELEMENT_NAME);
try {
writeExternal(element);
final ModuleBasedConfiguration configuration = createInstance();
RunConfiguration configuration = getFactory().createTemplateConfiguration(getProject());
configuration.setName(getName());
configuration.readExternal(element);
return configuration;
return (ModuleBasedConfiguration)configuration;
} catch (InvalidDataException e) {
LOG.error(e);
return null;
@@ -91,4 +91,8 @@ li input:checked + ol > li {
li input:checked + ol > li:last-child {
margin: 0 0 1px;
}
div.location {
margin-left: 40px;
}
@@ -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);
@@ -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() {
@@ -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("&nbsp;<span class=\"grayout\">")
.append(getTailText(n))
.append("</span></label><input type=\"checkbox\" ");
.append("&nbsp;<span class=\"grayout\">");
tailRenderer.appendTailText(n);
builder.append("</span></label><input type=\"checkbox\" ");
if (n instanceof InspectionRootNode) {
builder.append("checked");
}
@@ -175,18 +189,6 @@ public class InspectionTreeHtmlWriter {
.append(":</h3>");
}
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&nbsp;line&nbsp;" + number + ")";
}
}
return escapeNonBreakingSymbols(InspectionsBundle.message("inspection.problem.descriptor.count", node.getProblemCount()));
}
private void appendTree(Consumer<StringBuffer> treeRenderer) {
myBuilder.append("<div style=\"width:100%;\"><div style=\"float:left; width:50%;\"><h4>Inspection tree:</h4>");
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[]{"&nbsp;", "&#8209;"});
return StringUtil.replace(StringUtil.escapeXml(source.toString()), new String[]{" ", "-"}, new String[]{"&nbsp;", "&#8209;"});
}
}
@@ -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<RefEntity> excludedEntities,
@NotNull final Set<CommonProblemDescriptor> excludedDescriptors) {
@NotNull final Predicate<RefEntity> excludedEntities,
@NotNull final Predicate<CommonProblemDescriptor> 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<CommonProblemDescriptor> excludedDescriptors) {
@NotNull Predicate<CommonProblemDescriptor> 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<CommonProblemDescriptor> excludedDescriptors) {
@NotNull Predicate<CommonProblemDescriptor> 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;
@@ -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<Object> create(Class key) {
return new THashSet<>();
return new THashSet<Object>();
}
};
private final boolean myOffline;
public ExcludedInspectionTreeNodesManager(boolean offline) {
myOffline = offline;
}
public synchronized boolean isExcluded(InspectionTreeNode node) {
final Set<Object> 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);
}
}
@@ -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<InspectionTreeNode> myExclusionHandler;
private EditorEx myPreviewEditor;
private InspectionTreeLoadingProgressAware myLoadingProgressPreview;
private final ExcludedInspectionTreeNodesManager myExcludedInspectionTreeNodesManager = new ExcludedInspectionTreeNodesManager();
private final ExcludedInspectionTreeNodesManager myExcludedInspectionTreeNodesManager;
private final Set<Object> mySuppressedNodes = new HashSet<>();
private final ConcurrentMap<InspectionToolWrapper, Set<SuppressIntentionAction>> 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);
@@ -54,7 +54,7 @@ public class InspectionResultsViewUtil {
@NotNull
static JLabel getNothingToShowTextLabel() {
return createLabelForText(InspectionViewNavigationPanel.getTitleText(false, false));
return createLabelForText(InspectionViewNavigationPanel.getTitleText(false));
}
@NotNull
@@ -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;
}
@@ -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 {
}
@@ -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<CommonProblemDescriptor> excludedDescriptions);
void exportResults(@NotNull final Element parentNode, @NotNull RefEntity refEntity, Predicate<CommonProblemDescriptor> isDescriptorExcluded);
@NotNull
Set<RefModule> getModuleProblems();
@Nullable
@@ -88,8 +89,8 @@ public interface InspectionToolPresentation extends ProblemDescriptionsProcessor
@NotNull Map<RefEntity, CommonProblemDescriptor[]> descriptorMap,
@Nullable CommonProblemDescriptor[] allowedDescriptors);
void exportResults(@NotNull final Element parentNode,
@NotNull final Set<RefEntity> excludedEntities,
@NotNull final Set<CommonProblemDescriptor> excludedDescriptors);
@NotNull final Predicate<RefEntity> isEntityExcluded,
@NotNull final Predicate<CommonProblemDescriptor> isProblemExcluded);
default JComponent getCustomPreviewPanel(RefEntity entity) {
return null;
@@ -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<HighlightSeverity, String> myPluralizedSeverityNames = new SoftHashMap<>();
private final Map<HighlightSeverity, String> myUnpluralizedSeverityNames = new SoftHashMap<>();
private final FactoryMap<HighlightDisplayLevel, Integer> 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<HighlightDisplayLevel, Integer>() {
@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<HighlightDisplayLevel, Integer> 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<HighlightDisplayLevel, Integer> 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;
@@ -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<HighlightSeverity, String> myPluralizedSeverityNames = new SoftHashMap<>();
private final Map<HighlightSeverity, String> myUnpluralizedSeverityNames = new SoftHashMap<>();
private final FactoryMap<HighlightDisplayLevel, Integer> myItemCounter;
private final SeverityRegistrar myRegistrar;
private final GlobalInspectionContextImpl myContext;
public InspectionTreeTailRenderer(GlobalInspectionContextImpl context) {
myRegistrar = SeverityRegistrar.getSeverityRegistrar(context.getProject());
myContext = context;
myItemCounter = new FactoryMap<HighlightDisplayLevel, Integer>() {
@Nullable
@Override
protected Integer create(HighlightDisplayLevel key) {
return 0;
}
@Override
protected Map<HighlightDisplayLevel, Integer> 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<HighlightDisplayLevel, Integer> 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;
}
}
}
@@ -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)) {
@@ -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() {
@@ -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;
}
}
}
@@ -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<String>(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<InspectionToolWrapper> toolWrappers = getWorkedTools(toolNode);
for (InspectionToolWrapper wrapper : toolWrappers) {
InspectionToolPresentation presentation = myView.getGlobalInspectionContext().getPresentation(wrapper);
if (!toolNode.isExcluded(myView.getExcludedManager())) {
final Set<RefEntity> excludedEntities = new HashSet<>();
final Set<CommonProblemDescriptor> 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<InspectionToolWrapper> 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()));
}
}
@@ -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
@@ -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 {
@@ -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;
}
}
@@ -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());
@@ -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 {
@@ -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 <code>false</code>, 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
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @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 <tt>pos</tt> 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
}
@@ -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<Module> getValidModules() {
//TODO add handling for package
@@ -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 {