mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inspection view: cleanup (deadcode)
This commit is contained in:
@@ -26,7 +26,6 @@ import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.reference.*;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -302,12 +301,7 @@ public class HTMLJavaHTMLComposerImpl extends HTMLJavaHTMLComposer {
|
||||
|
||||
buf.append(HTMLComposerImpl.A_HREF_OPENING);
|
||||
|
||||
if (myComposer.myExporter == null) {
|
||||
buf.append(((RefElementImpl)refElement).getURL());
|
||||
}
|
||||
else {
|
||||
buf.append(myComposer.myExporter.getURL(refElement));
|
||||
}
|
||||
buf.append(((RefElementImpl)refElement).getURL());
|
||||
|
||||
buf.append("\"");
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ package com.intellij.codeInspection.ex;
|
||||
import com.intellij.codeInspection.CommonProblemDescriptor;
|
||||
import com.intellij.codeInspection.HTMLComposer;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.export.HTMLExporter;
|
||||
import com.intellij.codeInspection.lang.HTMLComposerExtension;
|
||||
import com.intellij.codeInspection.lang.InspectionExtensionsFactory;
|
||||
import com.intellij.codeInspection.reference.*;
|
||||
@@ -51,7 +50,6 @@ import java.util.Map;
|
||||
* @author max
|
||||
*/
|
||||
public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
protected HTMLExporter myExporter;
|
||||
private final int[] myListStack;
|
||||
private int myListStackTop;
|
||||
private final Map<Key, HTMLComposerExtension> myExtensions = new HashMap<>();
|
||||
@@ -83,12 +81,6 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
|
||||
public void compose(StringBuffer buf, RefEntity refElement, CommonProblemDescriptor descriptor) {}
|
||||
|
||||
public void composeWithExporter(StringBuffer buf, RefEntity refEntity, HTMLExporter exporter) {
|
||||
myExporter = exporter;
|
||||
compose(buf, refEntity);
|
||||
myExporter = null;
|
||||
}
|
||||
|
||||
protected void genPageHeader(final StringBuffer buf, RefEntity refEntity) {
|
||||
if (refEntity instanceof RefElement) {
|
||||
RefElement refElement = (RefElement)refEntity;
|
||||
@@ -178,14 +170,9 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
|
||||
@Override
|
||||
public void appendElementReference(final StringBuffer buf, RefElement refElement, String linkText, @NonNls String frameName) {
|
||||
if (myExporter == null) {
|
||||
final String url = ((RefElementImpl)refElement).getURL();
|
||||
if (url != null) {
|
||||
appendElementReference(buf, url, linkText, frameName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
appendElementReference(buf, myExporter.getURL(refElement), linkText, frameName);
|
||||
final String url = ((RefElementImpl)refElement).getURL();
|
||||
if (url != null) {
|
||||
appendElementReference(buf, url, linkText, frameName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,9 +192,7 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
}
|
||||
|
||||
protected void appendQuickFix(@NonNls final StringBuffer buf, String text) {
|
||||
if (myExporter == null) {
|
||||
buf.append(text);
|
||||
}
|
||||
buf.append(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -219,12 +204,7 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
} else if (refElement instanceof RefFile) {
|
||||
buf.append(A_HREF_OPENING);
|
||||
|
||||
if (myExporter == null) {
|
||||
buf.append(((RefElementImpl)refElement).getURL());
|
||||
}
|
||||
else {
|
||||
buf.append(myExporter.getURL(refElement));
|
||||
}
|
||||
buf.append(((RefElementImpl)refElement).getURL());
|
||||
|
||||
buf.append("\">");
|
||||
String refElementName = refElement.getName();
|
||||
@@ -294,7 +274,6 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
}
|
||||
|
||||
protected void appendResolution(StringBuffer buf, RefEntity where, String[] quickFixes) {
|
||||
if (myExporter != null) return;
|
||||
if (where instanceof RefElement && !where.isValid()) return;
|
||||
if (quickFixes != null) {
|
||||
boolean listStarted = false;
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: max
|
||||
* Date: Jan 20, 2002
|
||||
* Time: 9:50:29 PM
|
||||
* To change template for new class use
|
||||
* Code Style | Class Templates options (Tools | IDE Options).
|
||||
*/
|
||||
package com.intellij.codeInspection.export;
|
||||
|
||||
import com.intellij.codeInspection.ex.HTMLComposerImpl;
|
||||
import com.intellij.codeInspection.reference.RefEntity;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class HTMLExporter {
|
||||
private final String myRootFolder;
|
||||
private int myFileCounter;
|
||||
private final Map<RefEntity,String> myElementToFilenameMap;
|
||||
private final HTMLComposerImpl myComposer;
|
||||
private final Set<RefEntity> myGeneratedReferences;
|
||||
|
||||
public HTMLExporter(String rootFolder, HTMLComposerImpl composer) {
|
||||
myRootFolder = rootFolder;
|
||||
myElementToFilenameMap = new HashMap<>();
|
||||
myFileCounter = 0;
|
||||
myComposer = composer;
|
||||
myGeneratedReferences = new HashSet<>();
|
||||
}
|
||||
|
||||
public String createPage(RefEntity element) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
myComposer.composeWithExporter(buf, element, this);
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
//TODO delete all these methods
|
||||
|
||||
public String getURL(RefEntity element) {
|
||||
myGeneratedReferences.add(element);
|
||||
return fileNameForElement(element);
|
||||
}
|
||||
|
||||
public String fileNameForElement(RefEntity element) {
|
||||
@NonNls String fileName = myElementToFilenameMap.get(element);
|
||||
|
||||
if (fileName == null) {
|
||||
fileName = "e" + Integer.toString(++myFileCounter) + ".html";
|
||||
myElementToFilenameMap.put(element, fileName);
|
||||
}
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public String getRootFolder() {
|
||||
return myRootFolder;
|
||||
}
|
||||
}
|
||||
@@ -158,13 +158,8 @@ public class DescriptorComposer extends HTMLComposerImpl {
|
||||
|
||||
//noinspection HardCodedStringLiteral
|
||||
anchor.append("<a HREF=\"");
|
||||
if (myExporter == null){
|
||||
//noinspection HardCodedStringLiteral
|
||||
anchor.append(appendURL(vFile, "descr:" + i));
|
||||
}
|
||||
else {
|
||||
anchor.append(myExporter.getURL(refElement));
|
||||
}
|
||||
//noinspection HardCodedStringLiteral
|
||||
anchor.append(appendURL(vFile, "descr:" + i));
|
||||
|
||||
anchor.append("\">");
|
||||
anchor.append(ProblemDescriptorUtil.extractHighlightedText(description, expression).replaceAll("\\$", "\\\\\\$"));
|
||||
@@ -197,14 +192,12 @@ public class DescriptorComposer extends HTMLComposerImpl {
|
||||
if (expression != null && lineNumber >= 0) {
|
||||
Document doc = FileDocumentManager.getInstance().getDocument(vFile);
|
||||
lineAnchor.append(InspectionsBundle.message("inspection.export.results.at.line")).append(" ");
|
||||
if (myExporter == null) {
|
||||
//noinspection HardCodedStringLiteral
|
||||
lineAnchor.append("<a HREF=\"");
|
||||
int offset = doc.getLineStartOffset(lineNumber);
|
||||
offset = CharArrayUtil.shiftForward(doc.getCharsSequence(), offset, " \t");
|
||||
lineAnchor.append(appendURL(vFile, String.valueOf(offset)));
|
||||
lineAnchor.append("\">");
|
||||
}
|
||||
//noinspection HardCodedStringLiteral
|
||||
lineAnchor.append("<a HREF=\"");
|
||||
int offset = doc.getLineStartOffset(lineNumber);
|
||||
offset = CharArrayUtil.shiftForward(doc.getCharsSequence(), offset, " \t");
|
||||
lineAnchor.append(appendURL(vFile, String.valueOf(offset)));
|
||||
lineAnchor.append("\">");
|
||||
lineAnchor.append(Integer.toString(lineNumber + 1));
|
||||
//noinspection HardCodedStringLiteral
|
||||
lineAnchor.append("</a>");
|
||||
|
||||
Reference in New Issue
Block a user