mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -39,10 +39,7 @@ import com.intellij.openapi.projectRoots.JavaSdkType;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.ex.PathUtilEx;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.OrderEnumerator;
|
||||
import com.intellij.openapi.roots.SourceFolder;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -62,6 +59,7 @@ import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -280,13 +278,21 @@ public class JavadocConfiguration implements ModuleRunProfile, JDOMExternalizabl
|
||||
}
|
||||
writer.println("-sourcepath");
|
||||
final PathsList pathsList = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getSourcePathsList();
|
||||
final String sourcePath = StringUtil.join(pathsList.getPathList(), new Function<String, String>() {
|
||||
@Override
|
||||
public String fun(String path) {
|
||||
return FileUtil.toSystemIndependentName(path);
|
||||
final List<VirtualFile> files = pathsList.getRootDirs();
|
||||
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
|
||||
final StringBuilder sourcePath = new StringBuilder();
|
||||
boolean start = true;
|
||||
for (VirtualFile file : files) {
|
||||
if (!myGenerationOptions.isIncludeTestSource() && fileIndex.isInTestSourceContent(file)) continue;
|
||||
if (start) {
|
||||
start = false;
|
||||
}
|
||||
}, File.pathSeparator);
|
||||
writer.println(GeneralCommandLine.quote(sourcePath));
|
||||
else {
|
||||
sourcePath.append(File.pathSeparator);
|
||||
}
|
||||
sourcePath.append(file.getPath());
|
||||
}
|
||||
writer.println(GeneralCommandLine.quote(sourcePath.toString()));
|
||||
}
|
||||
finally {
|
||||
writer.close();
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
public final class IdeaAntLogger2 extends DefaultLogger {
|
||||
static SegmentedOutputStream ourOut;
|
||||
static SegmentedOutputStream ourErr;
|
||||
public static final char MESSAGE_CONTENT = 'M';
|
||||
public static final char EXCEPTION_CONTENT = 'X';
|
||||
@@ -116,19 +115,16 @@ public final class IdeaAntLogger2 extends DefaultLogger {
|
||||
}
|
||||
|
||||
public static void guardStreams() {
|
||||
if (ourErr != null && ourOut != null) return;
|
||||
PrintStream out = System.out;
|
||||
if (ourErr != null) {
|
||||
return;
|
||||
}
|
||||
PrintStream err = System.err;
|
||||
ourOut = new SegmentedOutputStream(out);
|
||||
ourErr = new SegmentedOutputStream(err);
|
||||
System.setOut(new PrintStream(ourOut));
|
||||
System.setErr(new PrintStream(ourErr));
|
||||
ourOut.sendStart();
|
||||
ourErr.sendStart();
|
||||
}
|
||||
|
||||
private void send(PacketWriter packet) {
|
||||
packet.sendThrough(ourOut);
|
||||
packet.sendThrough(ourErr);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,32 +30,42 @@ import java.util.Vector;
|
||||
*/
|
||||
public class IdeaInputHandler implements InputHandler {
|
||||
public void handleInput(InputRequest request) throws BuildException {
|
||||
String prompt = request.getPrompt();
|
||||
if (prompt == null) throw new BuildException("Prompt is null");
|
||||
SegmentedOutputStream out = IdeaAntLogger2.ourOut;
|
||||
SegmentedOutputStream err = IdeaAntLogger2.ourErr;
|
||||
if (out == null || err == null)
|
||||
final String prompt = request.getPrompt();
|
||||
if (prompt == null) {
|
||||
throw new BuildException("Prompt is null");
|
||||
}
|
||||
final SegmentedOutputStream err = IdeaAntLogger2.ourErr;
|
||||
if (err == null) {
|
||||
throw new BuildException("Selected InputHandler should be used by Intellij IDEA");
|
||||
PacketWriter packet = PacketFactory.ourInstance.createPacket(IdeaAntLogger2.INPUT_REQUEST);
|
||||
}
|
||||
final PacketWriter packet = PacketFactory.ourInstance.createPacket(IdeaAntLogger2.INPUT_REQUEST);
|
||||
packet.appendLimitedString(prompt);
|
||||
if (request instanceof MultipleChoiceInputRequest) {
|
||||
Vector choices = ((MultipleChoiceInputRequest)request).getChoices();
|
||||
if (choices != null && choices.size() > 0) {
|
||||
int count = choices.size();
|
||||
packet.appendLong(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
for (int i = 0; i < count; i++) {
|
||||
packet.appendLimitedString((String)choices.elementAt(i));
|
||||
} else packet.appendLong(0);
|
||||
} else packet.appendLong(0);
|
||||
packet.sendThrough(out);
|
||||
}
|
||||
}
|
||||
else {
|
||||
packet.appendLong(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
packet.appendLong(0);
|
||||
}
|
||||
packet.sendThrough(err);
|
||||
try {
|
||||
byte[] replayLength = readBytes(4);
|
||||
int length = ((int)replayLength[0] << 24) | ((int)replayLength[1] << 16) | ((int)replayLength[2] << 8) | replayLength[3];
|
||||
byte[] replay = readBytes(length);
|
||||
String input = new String(replay);
|
||||
final byte[] replayLength = readBytes(4);
|
||||
final int length = ((int)replayLength[0] << 24) | ((int)replayLength[1] << 16) | ((int)replayLength[2] << 8) | replayLength[3];
|
||||
final byte[] replay = readBytes(length);
|
||||
final String input = new String(replay);
|
||||
request.setInput(input);
|
||||
if (!request.isInputValid()) throw new BuildException("Invalid input: " + input);
|
||||
if (!request.isInputValid()) {
|
||||
throw new BuildException("Invalid input: " + input);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
|
||||
@@ -774,5 +774,13 @@ public class UTest {
|
||||
assert myFixture.lookupElementStrings == ['new', 'nextWord']
|
||||
}
|
||||
|
||||
public void testUpdatePrefixMatchingOnTyping() {
|
||||
myFixture.addClass("class CertificateEncodingException {}")
|
||||
myFixture.addClass("class CertificateException {}")
|
||||
myFixture.configureByText 'a.java', 'class Foo {<caret>}'
|
||||
type 'CertificateExce'
|
||||
assert myFixture.lookupElementStrings == ['CertificateException', 'CertificateEncodingException']
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+6
-1
@@ -25,7 +25,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class PrefixMatchingWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
@Override
|
||||
public Comparable weigh(@NotNull LookupElement element, @NotNull CompletionLocation location) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
public static int getPrefixMatchingDegree(LookupElement item, CompletionLocation location) {
|
||||
final String prefix = location.getCompletionParameters().getLookup().itemPattern(item);
|
||||
|
||||
final int setting = CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE;
|
||||
|
||||
+26
-11
@@ -16,10 +16,7 @@
|
||||
package com.intellij.codeInsight.completion.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.*;
|
||||
import com.intellij.codeInsight.lookup.Classifier;
|
||||
import com.intellij.codeInsight.lookup.ClassifierFactory;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementWeigher;
|
||||
import com.intellij.codeInsight.lookup.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
@@ -262,13 +259,31 @@ public class CompletionServiceImpl extends CompletionService{
|
||||
}
|
||||
|
||||
for (final Weigher weigher : WeighingService.getWeighers(CompletionService.RELEVANCE_KEY)) {
|
||||
sorter = sorter.weigh(new LookupElementWeigher(weigher.toString()) {
|
||||
@NotNull
|
||||
@Override
|
||||
public Comparable weigh(@NotNull LookupElement element) {
|
||||
return new NegatingComparable(weigher.weigh(element, location));
|
||||
}
|
||||
});
|
||||
final String id = weigher.toString();
|
||||
if ("prefix".equals(id)) {
|
||||
sorter = sorter.withClassifier(new ClassifierFactory<LookupElement>(id) {
|
||||
@Override
|
||||
public Classifier<LookupElement> createClassifier(Classifier<LookupElement> next) {
|
||||
return new ComparingClassifier<LookupElement>(next, id) {
|
||||
@NotNull
|
||||
@Override
|
||||
public Comparable getWeight(LookupElement element) {
|
||||
return -PrefixMatchingWeigher.getPrefixMatchingDegree(element, location);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
sorter = sorter.weigh(new LookupElementWeigher(id) {
|
||||
@NotNull
|
||||
@Override
|
||||
public Comparable weigh(@NotNull LookupElement element) {
|
||||
return new NegatingComparable(weigher.weigh(element, location));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return sorter.withClassifier("priority", true, new ClassifierFactory<LookupElement>("liftShorter") {
|
||||
|
||||
+1
-7
@@ -39,13 +39,7 @@ public class CompletionSorterImpl extends CompletionSorter {
|
||||
return new ClassifierFactory<LookupElement>(id) {
|
||||
@Override
|
||||
public Classifier<LookupElement> createClassifier(Classifier<LookupElement> next) {
|
||||
return new ComparingClassifier<LookupElement>(next, id) {
|
||||
@NotNull
|
||||
@Override
|
||||
public Comparable getWeight(LookupElement element) {
|
||||
return weigher.weigh(element);
|
||||
}
|
||||
};
|
||||
return new CachingComparingClassifier(next, weigher);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+5
-9
@@ -227,22 +227,18 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
|
||||
myHighlights.addAll(toApplyInside);
|
||||
gotHighlights.clear();
|
||||
gotHighlights.addAll(outsideResult);
|
||||
|
||||
final long modificationStamp = myDocument.getModificationStamp();
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myProject.isDisposed()) return;
|
||||
if (myProject.isDisposed() || modificationStamp != myDocument.getModificationStamp()) return;
|
||||
MarkupModel markupModel = myDocument.getMarkupModel(myProject);
|
||||
|
||||
UpdateHighlightersUtil.setHighlightersInRange(myProject, myDocument, priorityIntersection, getColorsScheme(), toApplyInside,
|
||||
(MarkupModelEx)markupModel, Pass.UPDATE_ALL);
|
||||
}
|
||||
});
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myProject.isDisposed() || myEditor == null) return;
|
||||
new ShowAutoImportPass(myProject, myFile, myEditor).applyInformationToEditor();
|
||||
if (myEditor != null) {
|
||||
new ShowAutoImportPass(myProject, myFile, myEditor).applyInformationToEditor();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+8
-9
@@ -73,7 +73,6 @@ import java.util.concurrent.ConcurrentMap;
|
||||
*/
|
||||
public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass implements DumbAware {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.LocalInspectionsPass");
|
||||
private static final int NUM_ELEMENTS_PER_CHECK_CANCELLED = 5;
|
||||
public static final TextRange EMPTY_PRIORITY_RANGE = TextRange.EMPTY_RANGE;
|
||||
private final int myStartOffset;
|
||||
private final int myEndOffset;
|
||||
@@ -255,7 +254,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
}
|
||||
}
|
||||
};
|
||||
PsiElementVisitor visitor = createVisitorAndAcceptElements(tool, holder, isOnTheFly, session, elements, indicator);
|
||||
PsiElementVisitor visitor = createVisitorAndAcceptElements(tool, holder, isOnTheFly, session, elements);
|
||||
|
||||
synchronized (init) {
|
||||
init.add(Trinity.create(tool, holder, visitor));
|
||||
@@ -277,8 +276,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
@NotNull ProblemsHolder holder,
|
||||
boolean isOnTheFly,
|
||||
@NotNull LocalInspectionToolSession session,
|
||||
@NotNull List<PsiElement> elements,
|
||||
@NotNull ProgressIndicator indicator) {
|
||||
@NotNull List<PsiElement> elements) {
|
||||
PsiElementVisitor visitor = tool.buildVisitor(holder, isOnTheFly, session);
|
||||
//noinspection ConstantConditions
|
||||
if(visitor == null) {
|
||||
@@ -288,7 +286,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
: "The visitor returned from LocalInspectionTool.buildVisitor() must not be recursive. "+tool;
|
||||
|
||||
tool.inspectionStarted(session, isOnTheFly);
|
||||
acceptElements(elements, visitor, indicator);
|
||||
acceptElements(elements, visitor);
|
||||
return visitor;
|
||||
}
|
||||
|
||||
@@ -310,7 +308,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
|
||||
ProblemsHolder holder = trinity.second;
|
||||
PsiElementVisitor elementVisitor = trinity.third;
|
||||
acceptElements(elements, elementVisitor, indicator);
|
||||
acceptElements(elements, elementVisitor);
|
||||
|
||||
advanceProgress(1);
|
||||
|
||||
@@ -329,11 +327,12 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
inspectInjectedPsi(elements, tools, isOnTheFly, indicator, iManager, false);
|
||||
}
|
||||
|
||||
private static void acceptElements(@NotNull List<PsiElement> elements, @NotNull PsiElementVisitor elementVisitor, @NotNull ProgressIndicator indicator) {
|
||||
private static void acceptElements(@NotNull List<PsiElement> elements,
|
||||
@NotNull PsiElementVisitor elementVisitor) {
|
||||
for (int i = 0, elementsSize = elements.size(); i < elementsSize; i++) {
|
||||
PsiElement element = elements.get(i);
|
||||
element.accept(elementVisitor);
|
||||
if (i % NUM_ELEMENTS_PER_CHECK_CANCELLED == 0) indicator.checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,7 +668,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
};
|
||||
|
||||
LocalInspectionToolSession injSession = new LocalInspectionToolSession(injectedPsi, 0, injectedPsi.getTextLength());
|
||||
createVisitorAndAcceptElements(tool, holder, isOnTheFly, injSession, elements, indicator);
|
||||
createVisitorAndAcceptElements(tool, holder, isOnTheFly, injSession, elements);
|
||||
tool.inspectionFinished(injSession,holder);
|
||||
List<ProblemDescriptor> problems = holder.getResults();
|
||||
if (problems != null && !problems.isEmpty()) {
|
||||
|
||||
+23
-8
@@ -69,6 +69,7 @@ public abstract class AbstractExternalFilter {
|
||||
@NonNls private static final String DT = "<DT>";
|
||||
private static final Pattern CHARSET_META_PATTERN =
|
||||
Pattern.compile("<meta.*content\\s*=\".*[;|\\s]*charset=\\s*(.*)\\s*[;|\\s]*\">", Pattern.CASE_INSENSITIVE);
|
||||
private final HttpConfigurable myHttpConfigurable = HttpConfigurable.getInstance();
|
||||
|
||||
protected static abstract class RefConvertor {
|
||||
private final Pattern mySelector;
|
||||
@@ -209,6 +210,10 @@ public abstract class AbstractExternalFilter {
|
||||
}
|
||||
|
||||
protected void doBuildFromStream(String surl, Reader input, StringBuffer data) throws IOException {
|
||||
doBuildFromStream(surl, input, data, true);
|
||||
}
|
||||
|
||||
protected void doBuildFromStream(String surl, Reader input, StringBuffer data, boolean search4Encoding) throws IOException {
|
||||
BufferedReader buf = new BufferedReader(input);
|
||||
Matcher anchorMatcher = ourAnchorsuffix.matcher(surl);
|
||||
@NonNls String startSection = "<!-- ======== START OF CLASS DATA ======== -->";
|
||||
@@ -225,20 +230,30 @@ public abstract class AbstractExternalFilter {
|
||||
data.append(HTML);
|
||||
|
||||
String read;
|
||||
String charset = null;
|
||||
String contentEncoding = null;
|
||||
do {
|
||||
read = buf.readLine();
|
||||
if (read != null && read.contains("charset")) {
|
||||
charset = read;
|
||||
if (read != null && search4Encoding && read.contains("charset")) {
|
||||
String foundEncoding = parseContentEncoding(read);
|
||||
if (foundEncoding != null) {
|
||||
contentEncoding = foundEncoding;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (read != null && read.toUpperCase().indexOf(startSection) == -1);
|
||||
|
||||
if (input instanceof MyReader && charset != null) {
|
||||
String contentEncoding = parseContentEncoding(charset);
|
||||
if (contentEncoding != null) { //restart page parsing with correct encoding
|
||||
input = new MyReader(((MyReader)input).getInputStream(), contentEncoding);
|
||||
buf = new BufferedReader(input);
|
||||
if (input instanceof MyReader && contentEncoding != null) {
|
||||
if (contentEncoding != null && !contentEncoding.equals("UTF-8") && !contentEncoding.equals(((MyReader)input).getEncoding())) { //restart page parsing with correct encoding
|
||||
Reader stream;
|
||||
try {
|
||||
stream = getReaderByUrl(surl, myHttpConfigurable, new ProgressIndicatorBase());
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
return;
|
||||
}
|
||||
data.delete(0, data.length());
|
||||
doBuildFromStream(surl, new MyReader(((MyReader)stream).getInputStream(), contentEncoding), data, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -41,6 +41,7 @@ import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vcs.FileStatusManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.refactoring.util.RefactoringUIUtil;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
@@ -117,7 +118,8 @@ public class ImplementationViewComponent extends JPanel {
|
||||
for (PsiElement element : elements) {
|
||||
PsiFile file = getContainingFile(element);
|
||||
if (file == null) continue;
|
||||
files.add(new FileDescriptor(file, element.getParent()));
|
||||
final PsiElement parent = element.getParent();
|
||||
files.add(new FileDescriptor(file, parent == file ? element : parent));
|
||||
candidates.add(element.getNavigationElement());
|
||||
}
|
||||
myElements = PsiUtilBase.toPsiElementArray(candidates);
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.codeInsight.lookup;
|
||||
|
||||
import com.intellij.util.containers.StripedLockConcurrentHashMap;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class CachingComparingClassifier extends ComparingClassifier<LookupElement> {
|
||||
private final Map<LookupElement, Comparable> myWeights = new StripedLockConcurrentHashMap<LookupElement, Comparable>(TObjectHashingStrategy.IDENTITY);
|
||||
private final LookupElementWeigher myWeigher;
|
||||
|
||||
public CachingComparingClassifier(Classifier<LookupElement> next, LookupElementWeigher weigher) {
|
||||
super(next, weigher.toString());
|
||||
myWeigher = weigher;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public final Comparable getWeight(LookupElement t) {
|
||||
final Comparable weight = myWeights.get(t);
|
||||
if (weight == null) {
|
||||
throw new AssertionError(myName + "; " + myWeights.containsKey(t) + "; element=" + t);
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addElement(LookupElement t) {
|
||||
myWeights.put(t, myWeigher.weigh(t));
|
||||
super.addElement(t);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,19 +18,16 @@ package com.intellij.codeInsight.lookup;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.StripedLockConcurrentHashMap;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class ComparingClassifier<T> extends Classifier<T> {
|
||||
private final Map<T, Comparable> myWeights = new StripedLockConcurrentHashMap<T, Comparable>(TObjectHashingStrategy.IDENTITY);
|
||||
private final Classifier<T> myNext;
|
||||
private final String myName;
|
||||
protected final String myName;
|
||||
|
||||
public ComparingClassifier(Classifier<T> next, String name) {
|
||||
myNext = next;
|
||||
@@ -40,19 +37,14 @@ public abstract class ComparingClassifier<T> extends Classifier<T> {
|
||||
@NotNull
|
||||
public abstract Comparable getWeight(T t);
|
||||
|
||||
@Override
|
||||
public void addElement(T t) {
|
||||
myWeights.put(t, getWeight(t));
|
||||
myNext.addElement(t);
|
||||
}
|
||||
|
||||
private TreeMap<Comparable, List<T>> groupByWeights(List<T> source) {
|
||||
TreeMap<Comparable, List<T>> map = new TreeMap<Comparable, List<T>>();
|
||||
for (T t : source) {
|
||||
final Comparable weight = myWeights.get(t);
|
||||
if (weight == null) {
|
||||
throw new AssertionError(myName + "; " + myWeights.containsKey(t) + "; element=" + t);
|
||||
}
|
||||
final Comparable weight = getWeight(t);
|
||||
List<T> list = map.get(weight);
|
||||
if (list == null) {
|
||||
map.put(weight, list = new SmartList<T>());
|
||||
|
||||
@@ -625,6 +625,8 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec
|
||||
}
|
||||
|
||||
public void requestFocus() {
|
||||
mySearchField.setSelectionStart(0);
|
||||
mySearchField.setSelectionEnd(mySearchField.getText().length());
|
||||
requestFocus(mySearchField);
|
||||
}
|
||||
|
||||
|
||||
@@ -583,6 +583,7 @@ public class FindUtil {
|
||||
public void run() {
|
||||
document.setText(newText);
|
||||
editor.getCaretModel().moveToOffset(finalCaretOffset);
|
||||
editor.getSelectionModel().removeSelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+52
-41
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package com.intellij.ide.navigationToolbar;
|
||||
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.ui.UISettingsListener;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
@@ -27,6 +28,7 @@ import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.IdeRootPaneNorthExtension;
|
||||
import com.intellij.openapi.wm.impl.IdeFrameImpl;
|
||||
@@ -186,48 +188,56 @@ public class NavBarRootPaneExtension extends IdeRootPaneNorthExtension {
|
||||
}
|
||||
|
||||
private JComponent buildNavBarPanel() {
|
||||
final JComponent result = new JPanel(new BorderLayout()) {
|
||||
final Ref<JPanel> panel = new Ref<JPanel>(null);
|
||||
final Runnable updater = new Runnable() {
|
||||
String laf;
|
||||
@Override
|
||||
public void run() {
|
||||
if (LafManager.getInstance().getCurrentLookAndFeel().getName().equals(laf)) return;
|
||||
laf = LafManager.getInstance().getCurrentLookAndFeel().getName();
|
||||
panel.get().removeAll();
|
||||
myScrollPane = null;
|
||||
myCloseIcon = null;
|
||||
if (myNavigationBar != null && !Disposer.isDisposed(myNavigationBar)) {
|
||||
Disposer.dispose(myNavigationBar);
|
||||
}
|
||||
myNavigationBar = new NavBarPanel(myProject);
|
||||
myWrapperPanel.putClientProperty("NavBarPanel", myNavigationBar);
|
||||
myNavigationBar.getModel().setFixedComponent(true);
|
||||
|
||||
myScrollPane = ScrollPaneFactory.createScrollPane(myNavigationBar);
|
||||
myScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
|
||||
myScrollPane.setHorizontalScrollBar(null);
|
||||
myScrollPane.setBorder(null);
|
||||
|
||||
myScrollPane.setOpaque(false);
|
||||
myScrollPane.getViewport().setOpaque(false);
|
||||
|
||||
panel.get().setBackground(UIUtil.isUnderGTKLookAndFeel() ? Color.WHITE : UIUtil.getListBackground());
|
||||
panel.get().setOpaque(!UIUtil.isUnderAquaLookAndFeel() || UISettings.getInstance().SHOW_MAIN_TOOLBAR);
|
||||
panel.get().setBorder(UIUtil.isUnderAquaLookAndFeel() ? BorderFactory.createEmptyBorder(2, 0, 2, 4) : new NavBarBorder(true, 0));
|
||||
myNavigationBar.setBorder(null);
|
||||
panel.get().add(myScrollPane, BorderLayout.CENTER);
|
||||
if (!SystemInfo.isMac) {
|
||||
myCloseIcon = new JLabel(CROSS_ICON);
|
||||
myCloseIcon.addMouseListener(new MouseAdapter() {
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
UISettings.getInstance().SHOW_NAVIGATION_BAR = false;
|
||||
uiSettingsChanged(UISettings.getInstance());
|
||||
}
|
||||
});
|
||||
panel.get().add(myCloseIcon, BorderLayout.EAST);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
panel.set(new JPanel(new BorderLayout()) {
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
removeAll();
|
||||
myScrollPane = null;
|
||||
myCloseIcon = null;
|
||||
if (myNavigationBar != null && !Disposer.isDisposed(myNavigationBar)) {
|
||||
Disposer.dispose(myNavigationBar);
|
||||
}
|
||||
myNavigationBar = new NavBarPanel(myProject);
|
||||
myWrapperPanel.putClientProperty("NavBarPanel", myNavigationBar);
|
||||
myNavigationBar.getModel().setFixedComponent(true);
|
||||
|
||||
myScrollPane = ScrollPaneFactory.createScrollPane(myNavigationBar);
|
||||
myScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
|
||||
myScrollPane.setHorizontalScrollBar(null);
|
||||
myScrollPane.setBorder(null);
|
||||
|
||||
myScrollPane.setOpaque(false);
|
||||
myScrollPane.getViewport().setOpaque(false);
|
||||
|
||||
setBackground(UIUtil.isUnderGTKLookAndFeel() ? Color.WHITE : UIUtil.getListBackground());
|
||||
setOpaque(!UIUtil.isUnderAquaLookAndFeel() || UISettings.getInstance().SHOW_MAIN_TOOLBAR);
|
||||
setBorder(UIUtil.isUnderAquaLookAndFeel() ? BorderFactory.createEmptyBorder(2, 0, 2, 4) : new NavBarBorder(true, 0));
|
||||
myNavigationBar.setBorder(null);
|
||||
add(myScrollPane, BorderLayout.CENTER);
|
||||
if (!SystemInfo.isMac) {
|
||||
myCloseIcon = new JLabel(CROSS_ICON);
|
||||
myCloseIcon.addMouseListener(new MouseAdapter() {
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
UISettings.getInstance().SHOW_NAVIGATION_BAR = false;
|
||||
uiSettingsChanged(UISettings.getInstance());
|
||||
}
|
||||
});
|
||||
add(myCloseIcon, BorderLayout.EAST);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (UISettings.getInstance().SHOW_NAVIGATION_BAR) {
|
||||
SwingUtilities.invokeLater(updater);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -292,9 +302,10 @@ public class NavBarRootPaneExtension extends IdeRootPaneNorthExtension {
|
||||
closePreferredSize.width, closePreferredSize.height);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return result;
|
||||
updater.run();
|
||||
return panel.get();
|
||||
}
|
||||
|
||||
public void uiSettingsChanged(final UISettings settings) {
|
||||
|
||||
@@ -55,6 +55,10 @@ public class DirDiffSettings {
|
||||
public static enum CompareMode {
|
||||
CONTENT, // the most honest, the slowest. Compares size, if equal compares contents. Ignores timestamps
|
||||
SIZE, // Compares size only
|
||||
TIMESTAMP // Compares size, if equal compares timestamps
|
||||
TIMESTAMP; // Compares size, if equal compares timestamps
|
||||
|
||||
public String getPresentableName() {
|
||||
return StringUtil.capitalize(name().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,16 +28,39 @@ import java.awt.event.KeyEvent;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 16-Dec-2005
|
||||
* @author Anna Kozlova
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public abstract class FilterComponent extends JPanel {
|
||||
private final SearchTextFieldWithStoredHistory myFilter;
|
||||
private final Alarm myUpdateAlarm = new Alarm();
|
||||
private boolean myOnTheFly;
|
||||
|
||||
public FilterComponent(@NonNls String propertyName, int historySize) {
|
||||
this(propertyName, historySize, true);
|
||||
}
|
||||
|
||||
public FilterComponent(@NonNls String propertyName, int historySize, boolean onTheFlyUpdate) {
|
||||
super(new BorderLayout());
|
||||
myFilter = new SearchTextFieldWithStoredHistory(propertyName);
|
||||
myOnTheFly = onTheFlyUpdate;
|
||||
myFilter = new SearchTextFieldWithStoredHistory(propertyName) {
|
||||
@Override
|
||||
protected Runnable createItemChosenCallback(JList list) {
|
||||
final Runnable callback = super.createItemChosenCallback(list);
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
callback.run();
|
||||
filter();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Component getPopupLocationComponent() {
|
||||
return FilterComponent.this.getPopupLocationComponent();
|
||||
}
|
||||
};
|
||||
myFilter.getTextEditor().addKeyListener(new KeyAdapter() {
|
||||
//to consume enter in combo box - do not process this event by default button from DialogWrapper
|
||||
public void keyPressed(final KeyEvent e) {
|
||||
@@ -45,6 +68,8 @@ public abstract class FilterComponent extends JPanel {
|
||||
e.consume();
|
||||
myFilter.addCurrentTextToHistory();
|
||||
filter();
|
||||
} else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
onEscape(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -61,21 +86,31 @@ public abstract class FilterComponent extends JPanel {
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
public void onChange() {
|
||||
myUpdateAlarm.cancelAllRequests();
|
||||
myUpdateAlarm.addRequest(new Runnable(){
|
||||
public void run() {
|
||||
onlineFilter();
|
||||
}
|
||||
}, 100, ModalityState.stateForComponent(myFilter));
|
||||
}
|
||||
});
|
||||
|
||||
myFilter.setHistorySize(historySize);
|
||||
add(myFilter, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
protected JComponent getPopupLocationComponent() {
|
||||
return myFilter;
|
||||
}
|
||||
|
||||
public JTextField getTextEditor() {
|
||||
return myFilter.getTextEditor();
|
||||
}
|
||||
|
||||
private void onChange() {
|
||||
if (myOnTheFly) {
|
||||
myUpdateAlarm.cancelAllRequests();
|
||||
myUpdateAlarm.addRequest(new Runnable(){
|
||||
public void run() {
|
||||
onlineFilter();
|
||||
}
|
||||
}, 100, ModalityState.stateForComponent(myFilter));
|
||||
}
|
||||
}
|
||||
|
||||
public void setHistorySize(int historySize){
|
||||
myFilter.setHistorySize(historySize);
|
||||
}
|
||||
@@ -84,6 +119,9 @@ public abstract class FilterComponent extends JPanel {
|
||||
myFilter.reset();
|
||||
}
|
||||
|
||||
protected void onEscape(KeyEvent e) {
|
||||
}
|
||||
|
||||
public String getFilter(){
|
||||
return myFilter.getText();
|
||||
}
|
||||
|
||||
@@ -88,6 +88,16 @@ public class SearchTextField extends JPanel {
|
||||
}
|
||||
});
|
||||
add(myTextField, BorderLayout.CENTER);
|
||||
myTextField.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||
if (myPopup == null || !myPopup.isVisible()) {
|
||||
showPopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (hasNativeLeopardSearchControl()) {
|
||||
myTextField.putClientProperty("JTextField.variant", "search");
|
||||
@@ -318,13 +328,8 @@ public class SearchTextField extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
protected void showPopup() {
|
||||
if (myPopup == null) {
|
||||
final JList list = new JBList(myModel);
|
||||
if (myListener != null) {
|
||||
removeKeyListener(myListener);
|
||||
}
|
||||
final Runnable chooseRunnable = new Runnable() {
|
||||
protected Runnable createItemChosenCallback(final JList list) {
|
||||
return new Runnable() {
|
||||
public void run() {
|
||||
final String value = (String)list.getSelectedValue();
|
||||
getTextEditor().setText(value != null ? value : "");
|
||||
@@ -334,35 +339,50 @@ public class SearchTextField extends JPanel {
|
||||
}
|
||||
}
|
||||
};
|
||||
myListener = new KeyAdapter() {
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||
if (list.getSelectedIndex() < list.getModel().getSize() - 1) {
|
||||
list.setSelectedIndex(list.getSelectedIndex() + 1);
|
||||
}
|
||||
}
|
||||
else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||
if (list.getSelectedIndex() > 0) {
|
||||
list.setSelectedIndex(list.getSelectedIndex() - 1);
|
||||
}
|
||||
}
|
||||
else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
if (list.getSelectedIndex() > -1) {
|
||||
chooseRunnable.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
addKeyboardListener(myListener);
|
||||
}
|
||||
|
||||
protected void showPopup() {
|
||||
//removeKeyListener(myListener);
|
||||
if (myPopup == null) {
|
||||
final JList list = new JBList(myModel);
|
||||
//if (myListener != null) {
|
||||
// removeKeyListener(myListener);
|
||||
//}
|
||||
final Runnable chooseRunnable = createItemChosenCallback(list);
|
||||
//myListener = new KeyAdapter() {
|
||||
// public void keyPressed(KeyEvent e) {
|
||||
// if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
||||
// if (list.getSelectedIndex() < list.getModel().getSize() - 1) {
|
||||
// list.setSelectedIndex(list.getSelectedIndex() + 1);
|
||||
// }
|
||||
// }
|
||||
// else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
||||
// if (list.getSelectedIndex() > 0) {
|
||||
// list.setSelectedIndex(list.getSelectedIndex() - 1);
|
||||
// }
|
||||
// }
|
||||
// else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
// if (list.getSelectedIndex() > -1) {
|
||||
// chooseRunnable.run();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//};
|
||||
//addKeyboardListener(myListener);
|
||||
myPopup = JBPopupFactory.getInstance().createListPopupBuilder(list)
|
||||
.setMovable(false)
|
||||
.setRequestFocus(false)
|
||||
.setRequestFocus(true)
|
||||
.setItemChoosenCallback(chooseRunnable).createPopup();
|
||||
|
||||
if (isShowing()) myPopup.showUnderneathOf(this);
|
||||
if (isShowing()) {
|
||||
myPopup.showUnderneathOf(getPopupLocationComponent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Component getPopupLocationComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private void togglePopup() {
|
||||
if (myPopup == null) {
|
||||
showPopup();
|
||||
|
||||
@@ -431,7 +431,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
}
|
||||
|
||||
private boolean useGraphite(boolean awtHint) {
|
||||
return !isUseSystemLook() && awtHint;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void hide(IdeTooltip tooltip) {
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -57,10 +56,6 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
myComponent.myLafComboBox.setModel(new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels()));
|
||||
myComponent.myLafComboBox.setRenderer(new MyLafComboBoxRenderer(myComponent.myLafComboBox.getRenderer()));
|
||||
|
||||
myComponent.myTooltipMode.setModel(new DefaultComboBoxModel(new Object[]{"default", "graphite", "system"}));
|
||||
myComponent.myTooltipMode.setRenderer(new MyTooltipModeRenderer(myComponent.myTooltipMode.getRenderer()));
|
||||
myComponent.myTooltipMode.setSelectedItem(Registry.stringValue("ide.tooltip.mode"));
|
||||
|
||||
myComponent.myEnableAlphaModeCheckBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
boolean state = myComponent.myEnableAlphaModeCheckBox.isSelected();
|
||||
@@ -153,10 +148,6 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
}
|
||||
}
|
||||
|
||||
if (myComponent.myTooltipMode.getSelectedItem() != null && !myComponent.myTooltipMode.getSelectedItem().equals(Registry.stringValue("ide.tooltip.mode"))) {
|
||||
update = true;
|
||||
Registry.get("ide.tooltip.mode").setValue(myComponent.myTooltipMode.getSelectedItem().toString());
|
||||
}
|
||||
|
||||
if (shouldUpdateUI) {
|
||||
lafManager.updateUI();
|
||||
@@ -202,7 +193,6 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
myComponent.myLafComboBox.setSelectedItem(LafManager.getInstance().getCurrentLookAndFeel());
|
||||
myComponent.myOverrideLAFFonts.setSelected(settings.OVERRIDE_NONIDEA_LAF_FONTS);
|
||||
myComponent.myDisableMnemonics.setSelected(settings.DISABLE_MNEMONICS);
|
||||
myComponent.myTooltipMode.setSelectedItem(Registry.stringValue("ide.tooltip.mode"));
|
||||
|
||||
boolean alphaModeEnabled = WindowManagerEx.getInstanceEx().isAlphaModeSupported();
|
||||
if (alphaModeEnabled) {
|
||||
@@ -257,8 +247,6 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
isModified |= ratio != settings.ALPHA_MODE_RATIO;
|
||||
}
|
||||
|
||||
isModified |= myComponent.myTooltipMode.getSelectedItem() != null && !myComponent.myTooltipMode.getSelectedItem().equals(Registry.stringValue("ide.tooltip.mode"));
|
||||
|
||||
return isModified;
|
||||
}
|
||||
|
||||
@@ -285,21 +273,6 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
}
|
||||
}
|
||||
|
||||
private static final class MyTooltipModeRenderer extends ListCellRendererWrapper<String> {
|
||||
public MyTooltipModeRenderer(final ListCellRenderer listCellRenderer) {
|
||||
super(listCellRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize(final JList list, final String value, final int index, final boolean selected, final boolean cellHasFocus) {
|
||||
String s = value;
|
||||
if (s != null && s.length() > 1) {
|
||||
s = s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
|
||||
}
|
||||
setText(s);
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyComponent {
|
||||
private JPanel myPanel;
|
||||
private JComboBox myFontCombo;
|
||||
@@ -324,7 +297,6 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
private JCheckBox myHideIconsInQuickNavigation;
|
||||
private JCheckBox myCbDisplayIconsInMenu;
|
||||
private JCheckBox myDisableMnemonics;
|
||||
private JComboBox myTooltipMode;
|
||||
|
||||
public MyComponent() {
|
||||
ActionListener updater = new ActionListener() {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<text resource-bundle="messages/IdeBundle" key="checkboox.cyclic.scrolling.in.lists"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="4c401" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="4c401" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -61,20 +61,6 @@
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="8098f" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="4" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Tooltip Mode:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f57f7" class="javax.swing.JComboBox" binding="myTooltipMode">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="d9fb" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
|
||||
@@ -357,13 +357,13 @@ public class FileUtil {
|
||||
return createTempFile(dir, prefix, suffix, create, true);
|
||||
}
|
||||
|
||||
public static File createTempFile(@NonNls final File dir, @NotNull @NonNls String prefix, @NonNls String suffix, final boolean create, boolean removeOnExit) throws IOException {
|
||||
public static File createTempFile(@NonNls final File dir, @NotNull @NonNls String prefix, @NonNls String suffix, final boolean create, boolean deleteOnExit) throws IOException {
|
||||
File file = doCreateTempFile(prefix, suffix, dir);
|
||||
file.delete();
|
||||
if (create) {
|
||||
file.createNewFile();
|
||||
}
|
||||
if (removeOnExit) {
|
||||
if (deleteOnExit) {
|
||||
file.deleteOnExit();
|
||||
}
|
||||
return file;
|
||||
@@ -371,10 +371,17 @@ public class FileUtil {
|
||||
|
||||
@NotNull
|
||||
public static File createTempFile(@NotNull @NonNls String prefix, @NonNls String suffix) throws IOException{
|
||||
return createTempFile(prefix, suffix, false); //false until TeamCity fixes its plugin
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File createTempFile(@NotNull @NonNls String prefix, @NonNls String suffix, boolean deleteOnExit) throws IOException {
|
||||
File file = doCreateTempFile(prefix, suffix);
|
||||
file.delete();
|
||||
file.createNewFile();
|
||||
file.deleteOnExit();
|
||||
if (deleteOnExit) {
|
||||
file.deleteOnExit();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,4 +70,9 @@ public class DirDiffDialog extends DialogWrapper {
|
||||
protected Action[] createActions() {
|
||||
return new Action[]{};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHelpId() {
|
||||
return "reference.dialogs.diff.folder";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
*/
|
||||
package com.intellij.openapi.diff.impl.dir;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.diff.DirDiffSettings;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.FrameWrapper;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -35,6 +39,16 @@ public class DirDiffFrame extends FrameWrapper {
|
||||
Disposer.register(this, myPanel);
|
||||
setComponent(myPanel.getPanel());
|
||||
setProject(project);
|
||||
closeOnEsc();
|
||||
DataManager.registerDataProvider(myPanel.getPanel(), new DataProvider() {
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (PlatformDataKeys.HELP_ID.is(dataId)) {
|
||||
return "reference.dialogs.diff.folder";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -113,31 +113,21 @@
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="97b9b" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<grid id="97b9b" binding="myFilterPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="5d686" class="com.intellij.ui.components.JBLabel">
|
||||
<component id="5d686" class="com.intellij.ui.components.JBLabel" binding="myFilterLabel">
|
||||
<constraints border-constraint="West"/>
|
||||
<properties>
|
||||
<horizontalAlignment value="2"/>
|
||||
<iconTextGap value="0"/>
|
||||
<labelFor value="8b193"/>
|
||||
<text value="&Filter:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8b193" class="javax.swing.JTextField" binding="myFilter">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties>
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<maximumSize width="2147483647" height="20"/>
|
||||
<minimumSize width="4" height="20"/>
|
||||
<preferredSize width="80" height="20"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
|
||||
@@ -28,15 +28,18 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.ui.FilterComponent;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.components.JBLoadingPanel;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -58,7 +61,9 @@ public class DirDiffPanel implements Disposable {
|
||||
private JBLabel mySourceDirLabel;
|
||||
private JPanel myToolBarPanel;
|
||||
private JPanel myRootPanel;
|
||||
private JTextField myFilter;
|
||||
private JPanel myFilterPanel;
|
||||
private JBLabel myFilterLabel;
|
||||
private FilterComponent myFilter;
|
||||
private final DirDiffTableModel myModel;
|
||||
public JLabel myErrorLabel;
|
||||
private final DirDiffWindow myDiffWindow;
|
||||
@@ -199,6 +204,24 @@ public class DirDiffPanel implements Disposable {
|
||||
});
|
||||
myRootPanel.removeAll();
|
||||
myRootPanel.add(loadingPanel, BorderLayout.CENTER);
|
||||
myFilter = new FilterComponent("dir.diff.filter", 15, false) {
|
||||
@Override
|
||||
public void filter() {
|
||||
fireFilterUpdated();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEscape(KeyEvent e) {
|
||||
e.consume();
|
||||
focusTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JComponent getPopupLocationComponent() {
|
||||
return UIUtil.findComponentOfType(super.getPopupLocationComponent(), JTextComponent.class);
|
||||
}
|
||||
};
|
||||
|
||||
myModel.addModelListener(new DirDiffModelListener() {
|
||||
@Override
|
||||
public void updateStarted() {
|
||||
@@ -210,22 +233,12 @@ public class DirDiffPanel implements Disposable {
|
||||
myFilter.setEnabled(true);
|
||||
}
|
||||
});
|
||||
|
||||
myFilter.setText(settings.getFilter());
|
||||
oldFilter = myFilter.getText();
|
||||
myFilter.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
e.consume();
|
||||
fireFilterUpdated();
|
||||
}
|
||||
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
e.consume();
|
||||
focusTable();
|
||||
}
|
||||
}
|
||||
});
|
||||
myFilter.getTextEditor().setColumns(10);
|
||||
myFilter.setFilter(settings.getFilter());
|
||||
//oldFilter = myFilter.getText();
|
||||
oldFilter = myFilter.getFilter();
|
||||
myFilterPanel.add(myFilter, BorderLayout.CENTER);
|
||||
myFilterLabel.setLabelFor(myFilter);
|
||||
final Callable<DiffElement> srcChooser = myModel.getSourceDir().getElementChooser(project);
|
||||
final Callable<DiffElement> trgChooser = myModel.getTargetDir().getElementChooser(project);
|
||||
if (srcChooser != null) {
|
||||
@@ -286,12 +299,12 @@ public class DirDiffPanel implements Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
public JTextField getFilter() {
|
||||
return myFilter;
|
||||
public String getFilter() {
|
||||
return myFilter.getFilter();
|
||||
}
|
||||
|
||||
private void fireFilterUpdated() {
|
||||
final String newFilter = myFilter.getText();
|
||||
final String newFilter = myFilter.getFilter();
|
||||
if (!StringUtil.equals(oldFilter, newFilter)) {
|
||||
oldFilter = newFilter;
|
||||
myModel.getSettings().setFilter(newFilter);
|
||||
|
||||
@@ -128,7 +128,7 @@ public class DirDiffTableModel extends AbstractTableModel implements Disposable
|
||||
}
|
||||
|
||||
public void updateFromUI() {
|
||||
getSettings().setFilter(myPanel.getFilter().getText());
|
||||
getSettings().setFilter(myPanel.getFilter());
|
||||
}
|
||||
|
||||
private static String prepareText(String text) {
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ import com.intellij.ide.diff.DirDiffSettings;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.diff.impl.dir.DirDiffTableModel;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.Icons;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
|
||||
@@ -37,7 +36,7 @@ class ChangeCompareModeAction extends AnAction {
|
||||
private final DirDiffSettings.CompareMode myMode;
|
||||
|
||||
ChangeCompareModeAction(DirDiffTableModel model, DirDiffSettings.CompareMode mode) {
|
||||
super(StringUtil.capitalize(mode.name().toLowerCase()));
|
||||
super(mode.getPresentableName());
|
||||
myModel = model;
|
||||
myMode = mode;
|
||||
}
|
||||
|
||||
+30
-7
@@ -16,12 +16,16 @@
|
||||
package com.intellij.openapi.diff.impl.dir.actions;
|
||||
|
||||
import com.intellij.ide.diff.DirDiffSettings;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
|
||||
import com.intellij.openapi.diff.impl.dir.DirDiffTableModel;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -29,20 +33,39 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class ChangeCompareModeGroup extends ComboBoxAction {
|
||||
private final DefaultActionGroup myGroup;
|
||||
private DirDiffSettings mySettings;
|
||||
|
||||
public ChangeCompareModeGroup(DirDiffTableModel model) {
|
||||
getTemplatePresentation().setText("Compare by");
|
||||
mySettings = model.getSettings();
|
||||
getTemplatePresentation().setText(mySettings.compareMode.getPresentableName());
|
||||
final ArrayList<ChangeCompareModeAction> actions = new ArrayList<ChangeCompareModeAction>();
|
||||
if (model.getSettings().showCompareModes) {
|
||||
final ArrayList<ChangeCompareModeAction> actions = new ArrayList<ChangeCompareModeAction>();
|
||||
for (DirDiffSettings.CompareMode mode : DirDiffSettings.CompareMode.values()) {
|
||||
actions.add(new ChangeCompareModeAction(model, mode));
|
||||
}
|
||||
myGroup = new DefaultActionGroup(actions.toArray(new ChangeCompareModeAction[actions.size()]));
|
||||
} else {
|
||||
getTemplatePresentation().setEnabled(false);
|
||||
getTemplatePresentation().setVisible(false);
|
||||
myGroup = new DefaultActionGroup();
|
||||
}
|
||||
else {
|
||||
getTemplatePresentation().setVisible(false);
|
||||
getTemplatePresentation().setEnabled(false);
|
||||
}
|
||||
myGroup = new DefaultActionGroup(actions.toArray(new ChangeCompareModeAction[actions.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
getTemplatePresentation().setText(mySettings.compareMode.getPresentableName());
|
||||
e.getPresentation().setText(mySettings.compareMode.getPresentableName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createCustomComponent(Presentation presentation) {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
final JLabel label = new JLabel("Compare by:");
|
||||
panel.add(label, BorderLayout.WEST);
|
||||
panel.add(super.createCustomComponent(presentation).getComponent(0), BorderLayout.CENTER);
|
||||
panel.setBorder(IdeBorderFactory.createEmptyBorder(2, 6, 2, 0));
|
||||
return panel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -47,8 +47,9 @@ remove.unnecessary.parentheses.intention.name=Remove unnecessary parentheses
|
||||
remove.unnecessary.parentheses.intention.family.name=Remove Unnecessary Parentheses
|
||||
merge.if.and.intention.name=Merge nested 'if's
|
||||
merge.if.and.intention.family.name=Merge Nested Ifs to ANDed Condition
|
||||
replace.concatenation.with.string.buffer.intention.name=Replace '+' with '.append()'
|
||||
replace.concatenation.with.string.buffer.intention.family.name=Replace + with StringBuffer.append()
|
||||
replace.concatenation.with.string.buffer.intention.name=Replace '+' with 'StringBuffer.append()'
|
||||
replace.concatenation.with.string.builder.intention.name=Replace '+' with 'StringBuilder.append()'
|
||||
replace.concatenation.with.string.buffer.intention.family.name=Replace + with StringBuilder.append()
|
||||
remove.conditional.intention.name=Simplify '?:'
|
||||
remove.conditional.intention.family.name=Remove Pointless Conditional
|
||||
move.comment.to.separate.line.intention.name=Move comment to separate line
|
||||
@@ -121,8 +122,8 @@ wrap.vararg.arguments.with.explicit.array.intention.name=Wrap vararg arguments w
|
||||
wrap.vararg.arguments.with.explicit.array.intention.family.name=Wrap Vararg Arguments with Explicit Array Creation
|
||||
extract.while.loop.condition.to.if.statement.intention.name=Extract condition to internal 'if' statement
|
||||
extract.while.loop.condition.to.if.statement.intention.family.name=Extract While Loop Condition to Internal If Statement
|
||||
replace.concatenation.with.format.string.intention.name=Replace '+' with 'String.format()' call
|
||||
replace.concatenation.with.format.string.intention.family.name=Replace String Concatenation with String.format() Call
|
||||
replace.concatenation.with.format.string.intention.name=Replace '+' with 'String.format()'
|
||||
replace.concatenation.with.format.string.intention.family.name=Replace String Concatenation with String.format()
|
||||
copy.concatenated.string.to.clipboard.intention.name=Copy String concatenation text to the clipboard
|
||||
copy.concatenated.string.to.clipboard.intention.family.name=Copy String Concatenation Text to the Clipboard
|
||||
flip.expression.intention.family.name=Flip Binary Expression
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2010 Bas Leijdekkers
|
||||
* Copyright 2008-2011 Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,7 +31,7 @@ public class CopyConcatenatedStringToClipboardIntention extends Intention {
|
||||
|
||||
@Override @NotNull
|
||||
protected PsiElementPredicate getElementPredicate() {
|
||||
return new SimpleStringConcatenationPredicate();
|
||||
return new SimpleStringConcatenationPredicate(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,4 +85,4 @@ public class CopyConcatenatedStringToClipboardIntention extends Intention {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -31,7 +31,7 @@ public class ReplaceConcatenationWithFormatStringIntention
|
||||
@Override
|
||||
@NotNull
|
||||
protected PsiElementPredicate getElementPredicate() {
|
||||
return new SimpleStringConcatenationPredicate();
|
||||
return new SimpleStringConcatenationPredicate(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,7 +150,8 @@ public class ReplaceConcatenationWithFormatStringIntention
|
||||
type.equalsToText("char"))) {
|
||||
if (length > 2) {
|
||||
formatString.append(
|
||||
text.substring(1, length - 1).replace("%", "%%"));
|
||||
text.substring(1, length - 1).replace("%", "%%")
|
||||
.replace("\\'", "'"));
|
||||
}
|
||||
} else {
|
||||
formatString.append(text);
|
||||
|
||||
+16
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2010 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,19 +18,32 @@ package com.siyeh.ipp.concatenation;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.siyeh.IntentionPowerPackBundle;
|
||||
import com.siyeh.ipp.base.Intention;
|
||||
import com.siyeh.ipp.base.MutablyNamedIntention;
|
||||
import com.siyeh.ipp.base.PsiElementPredicate;
|
||||
import com.siyeh.ipp.psiutils.ConcatenationUtils;
|
||||
import com.siyeh.ipp.psiutils.ParenthesesUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReplaceConcatenationWithStringBufferIntention extends Intention {
|
||||
public class ReplaceConcatenationWithStringBufferIntention extends MutablyNamedIntention {
|
||||
|
||||
@Override
|
||||
protected String getTextForElement(PsiElement element) {
|
||||
if (PsiUtil.isLanguageLevel5OrHigher(element)) {
|
||||
return IntentionPowerPackBundle.message(
|
||||
"replace.concatenation.with.string.builder.intention.name");
|
||||
} else {
|
||||
return IntentionPowerPackBundle.message(
|
||||
"replace.concatenation.with.string.buffer.intention.name");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElementPredicate getElementPredicate() {
|
||||
return new SimpleStringConcatenationPredicate();
|
||||
return new SimpleStringConcatenationPredicate(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+24
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2007 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,7 +15,8 @@
|
||||
*/
|
||||
package com.siyeh.ipp.concatenation;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.siyeh.ipp.base.PsiElementPredicate;
|
||||
import com.siyeh.ipp.psiutils.ConcatenationUtils;
|
||||
import com.siyeh.ipp.psiutils.ErrorUtil;
|
||||
@@ -23,10 +24,31 @@ import com.siyeh.ipp.psiutils.ErrorUtil;
|
||||
class SimpleStringConcatenationPredicate
|
||||
implements PsiElementPredicate{
|
||||
|
||||
private final boolean excludeConcatentationsInsideAnnotations;
|
||||
|
||||
public SimpleStringConcatenationPredicate(boolean excludeConcatentationsInsideAnnotations) {
|
||||
this.excludeConcatentationsInsideAnnotations = excludeConcatentationsInsideAnnotations;
|
||||
}
|
||||
|
||||
public boolean satisfiedBy(PsiElement element){
|
||||
if(!ConcatenationUtils.isConcatenation(element)){
|
||||
return false;
|
||||
}
|
||||
if (excludeConcatentationsInsideAnnotations && isInsideAnnotation(element)) {
|
||||
return false;
|
||||
}
|
||||
return !ErrorUtil.containsError(element);
|
||||
}
|
||||
|
||||
private static boolean isInsideAnnotation(PsiElement element) {
|
||||
for (int i = 0; i < 20 && element instanceof PsiBinaryExpression; i++) {
|
||||
// optimization: don't check deep string concatenation more than 20 levels up.
|
||||
element = element.getParent();
|
||||
if (element instanceof PsiNameValuePair ||
|
||||
element instanceof PsiArrayInitializerMemberValue) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
package com.intellij.lang.ant.config.execution;
|
||||
|
||||
import com.intellij.execution.junit.JUnitProcessHandler;
|
||||
import com.intellij.execution.junit2.segments.*;
|
||||
import com.intellij.execution.junit2.segments.DeferredActionsQueue;
|
||||
import com.intellij.execution.junit2.segments.DeferredActionsQueueImpl;
|
||||
import com.intellij.execution.junit2.segments.InputConsumer;
|
||||
import com.intellij.execution.junit2.segments.SegmentReader;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.lang.ant.config.AntBuildFile;
|
||||
@@ -85,9 +88,8 @@ final class OutputParser2 extends OutputParser implements PacketProcessor, Input
|
||||
final AntBuildMessageView errorView,
|
||||
final ProgressIndicator progress,
|
||||
final AntBuildFile buildFile) {
|
||||
OutputParser2 parser = new OutputParser2(myProject, handler, errorView, progress, buildFile.getName());
|
||||
DeferredActionsQueue queue = new DeferredActionsQueueImpl();
|
||||
handler.getOut().setPacketDispatcher(parser, queue);
|
||||
final OutputParser2 parser = new OutputParser2(myProject, handler, errorView, progress, buildFile.getName());
|
||||
final DeferredActionsQueue queue = new DeferredActionsQueueImpl();
|
||||
handler.getErr().setPacketDispatcher(parser, queue);
|
||||
return parser;
|
||||
}
|
||||
|
||||
@@ -129,8 +129,9 @@ public class AntDomFileReferenceSet extends FileReferenceSet {
|
||||
else {
|
||||
basedir = containingProject.getContextAntProject().getProjectBasedirPath();
|
||||
}
|
||||
assert basedir != null;
|
||||
root = LocalFileSystem.getInstance().findFileByPath(basedir);
|
||||
if (basedir != null) {
|
||||
root = LocalFileSystem.getInstance().findFileByPath(basedir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ public class NavigationGutterIconBuilder<T> {
|
||||
final List<SmartPsiElementPointer> list = new ArrayList<SmartPsiElementPointer>(targets.size());
|
||||
for (final T target : targets) {
|
||||
for (final PsiElement psiElement : myConverter.fun(target)) {
|
||||
if (elements.add(psiElement)) {
|
||||
if (elements.add(psiElement) && psiElement.isValid()) {
|
||||
list.add(manager.createSmartPsiElementPointer(psiElement));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user