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:
+10
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -18,6 +18,7 @@ package com.jetbrains.javascript.debugger
|
||||
import com.google.common.base.CharMatcher
|
||||
import com.intellij.openapi.editor.Document
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
import gnu.trove.THashMap
|
||||
@@ -26,14 +27,14 @@ import org.jetbrains.debugger.sourcemap.MappingList
|
||||
import org.jetbrains.debugger.sourcemap.SourceMap
|
||||
import org.jetbrains.rpc.LOG
|
||||
|
||||
|
||||
private val S1 = ",()[]{}="
|
||||
// don't trim trailing .&: - could be part of expression
|
||||
private val OPERATOR_TRIMMER = CharMatcher.INVISIBLE.or(CharMatcher.anyOf(S1))
|
||||
|
||||
val NAME_TRIMMER = CharMatcher.INVISIBLE.or(CharMatcher.anyOf(S1 + ".&:"))
|
||||
|
||||
open class NameMapper(private val document: Document, private val generatedDocument: Document, private val sourceMappings: MappingList, private val sourceMap: SourceMap) {
|
||||
// generateVirtualFile only for debug purposes
|
||||
open class NameMapper(private val document: Document, private val transpiledDocument: Document, private val sourceMappings: MappingList, private val sourceMap: SourceMap, private val transpiledFile: VirtualFile? = null) {
|
||||
var rawNameToSource: MutableMap<String, String>? = null
|
||||
private set
|
||||
|
||||
@@ -55,7 +56,12 @@ open class NameMapper(private val document: Document, private val generatedDocum
|
||||
return null
|
||||
}
|
||||
|
||||
val generatedName = extractName(getGeneratedName(generatedDocument, sourceMap, sourceEntry))
|
||||
if (sourceEntry.generatedLine > document.lineCount) {
|
||||
LOG.warn("Cannot get generated name: source entry line ${sourceEntry.generatedLine} > ${document.lineCount}. Transpiled File: " + transpiledFile?.path)
|
||||
return null
|
||||
}
|
||||
|
||||
val generatedName = extractName(getGeneratedName(transpiledDocument, sourceMap, sourceEntry))
|
||||
if (generatedName.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -546,6 +546,7 @@ nodejs.debugger.use.jb.support=true
|
||||
js.debugger.name.mappings.by.source.code=false
|
||||
js.debugger.v8.log=
|
||||
js.debugger.wip.log=
|
||||
js.debugger.member.filter.prefer.vm.source=false
|
||||
|
||||
js.index.node.submodules=false
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.Function;
|
||||
import gnu.trove.*;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -1212,6 +1213,36 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T, E> Iterable<Pair<T, E>> zip(@NotNull final Iterable<T> iterable1, @NotNull final Iterable<E> iterable2) {
|
||||
return new Iterable<Pair<T, E>>() {
|
||||
@Override
|
||||
public Iterator<Pair<T, E>> iterator() {
|
||||
return new Iterator<Pair<T, E>>() {
|
||||
private final Iterator<T> i1 = iterable1.iterator();
|
||||
private final Iterator<E> i2 = iterable2.iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return i1.hasNext() && i2.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<T, E> next() {
|
||||
return Pair.create(i1.next(), i2.next());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
i1.remove();
|
||||
i2.remove();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <E> void swapElements(@NotNull List<E> list, int index1, int index2) {
|
||||
E e1 = list.get(index1);
|
||||
E e2 = list.get(index2);
|
||||
|
||||
@@ -166,7 +166,7 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
|
||||
XmlSerializerUtil.copyBean(state, this);
|
||||
}
|
||||
|
||||
public static VcsConfiguration getInstance(Project project) {
|
||||
public static VcsConfiguration getInstance(@NotNull Project project) {
|
||||
return ServiceManager.getService(project, VcsConfiguration.class);
|
||||
}
|
||||
|
||||
|
||||
-17
@@ -32,23 +32,6 @@ public interface VcsRevisionNumber extends Comparable<VcsRevisionNumber>{
|
||||
}
|
||||
};
|
||||
|
||||
VcsRevisionNumber LOCAL = new VcsRevisionNumber() {
|
||||
@Override
|
||||
public String asString() {
|
||||
return "Local Changes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull VcsRevisionNumber vcsRevisionNumber) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
};
|
||||
|
||||
class Int implements VcsRevisionNumber, LongRevisionNumber {
|
||||
private final int myValue;
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package com.intellij.diff;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.text.LineTokenizer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.diff.Diff;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -26,7 +28,9 @@ import java.util.List;
|
||||
* author: lesya
|
||||
*/
|
||||
public class Block {
|
||||
private final String[] mySource;
|
||||
private static final Logger LOG = Logger.getInstance(Block.class);
|
||||
|
||||
@NotNull private final String[] mySource;
|
||||
private final int myStart;
|
||||
private final int myEnd;
|
||||
|
||||
@@ -35,6 +39,10 @@ public class Block {
|
||||
}
|
||||
|
||||
public Block(@NotNull String[] source, int start, int end) {
|
||||
if (start < 0 || end > source.length || end < start) {
|
||||
LOG.error("Invalid block range: [" + start + ", " + end + "); length - " + source.length);
|
||||
}
|
||||
|
||||
mySource = source;
|
||||
myStart = start;
|
||||
myEnd = end;
|
||||
@@ -77,14 +85,7 @@ public class Block {
|
||||
|
||||
@NotNull
|
||||
public String getBlockContent() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < myEnd - myStart; i++) {
|
||||
if (i != 0) result.append("\n");
|
||||
result.append(mySource[i + myStart]);
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
return StringUtil.join(getLines(), "\n");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -112,6 +113,7 @@ public class Block {
|
||||
return myEnd;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String[] getSource() {
|
||||
return mySource;
|
||||
}
|
||||
@@ -132,7 +134,7 @@ public class Block {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private void appendLines(StringBuilder result, int from, int to) {
|
||||
private void appendLines(@NotNull StringBuilder result, int from, int to) {
|
||||
for (int i = from; i < to; i++) {
|
||||
result.append(mySource[i]);
|
||||
result.append("\n");
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.intellij.openapi.ui.FrameWrapper;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.ui.popup.util.PopupUtil;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.vcs.*;
|
||||
import com.intellij.openapi.vcs.history.*;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -66,6 +65,23 @@ import static com.intellij.util.ObjectUtils.notNull;
|
||||
public class VcsHistoryDialog extends FrameWrapper implements DataProvider {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.history.impl.VcsHistoryDialog");
|
||||
|
||||
private static final VcsRevisionNumber LOCAL_REVISION_NUMBER = new VcsRevisionNumber() {
|
||||
@Override
|
||||
public String asString() {
|
||||
return "Local Changes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull VcsRevisionNumber vcsRevisionNumber) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return asString();
|
||||
}
|
||||
};
|
||||
|
||||
private static final ColumnInfo REVISION = new ColumnInfo(VcsBundle.message("column.name.revision.version")) {
|
||||
@Override
|
||||
public Object valueOf(Object object) {
|
||||
@@ -104,11 +120,11 @@ public class VcsHistoryDialog extends FrameWrapper implements DataProvider {
|
||||
|
||||
private static final Block EMPTY_BLOCK = new Block("", 0, 0);
|
||||
|
||||
private final Project myProject;
|
||||
private final VirtualFile myFile;
|
||||
private final Editor myEditor;
|
||||
private final AbstractVcs myActiveVcs;
|
||||
private final CachedRevisionsContents myCachedContents;
|
||||
@NotNull private final Project myProject;
|
||||
@NotNull private final VirtualFile myFile;
|
||||
@NotNull private final Editor myEditor;
|
||||
@NotNull private final AbstractVcs myActiveVcs;
|
||||
@NotNull private final CachedRevisionsContents myCachedContents;
|
||||
private final int mySelectionStart;
|
||||
private final int mySelectionEnd;
|
||||
@NonNls private final String myHelpId;
|
||||
@@ -127,16 +143,16 @@ public class VcsHistoryDialog extends FrameWrapper implements DataProvider {
|
||||
private boolean myIsDuringUpdate = false;
|
||||
private boolean myIsDisposed = false;
|
||||
|
||||
public VcsHistoryDialog(Project project,
|
||||
VirtualFile file,
|
||||
Editor editor,
|
||||
VcsHistoryProvider vcsHistoryProvider,
|
||||
VcsHistorySession session,
|
||||
AbstractVcs vcs,
|
||||
public VcsHistoryDialog(@NotNull Project project,
|
||||
@NotNull VirtualFile file,
|
||||
@NotNull Editor editor,
|
||||
@NotNull VcsHistoryProvider vcsHistoryProvider,
|
||||
@NotNull VcsHistorySession session,
|
||||
@NotNull AbstractVcs vcs,
|
||||
int selectionStart,
|
||||
int selectionEnd,
|
||||
String title,
|
||||
CachedRevisionsContents cachedContents) {
|
||||
@NotNull String title,
|
||||
@NotNull CachedRevisionsContents cachedContents) {
|
||||
super(project);
|
||||
myProject = project;
|
||||
myFile = file;
|
||||
@@ -159,7 +175,7 @@ public class VcsHistoryDialog extends FrameWrapper implements DataProvider {
|
||||
|
||||
myDiffPanel = DiffManager.getInstance().createRequestPanel(myProject, this, getFrame());
|
||||
|
||||
myRevisions.add(new CurrentRevision(file, VcsRevisionNumber.LOCAL));
|
||||
myRevisions.add(new CurrentRevision(file, LOCAL_REVISION_NUMBER));
|
||||
myRevisions.addAll(session.getRevisionList());
|
||||
|
||||
myBlocks.addAll(Collections.<Block>nCopies(myRevisions.size(), null));
|
||||
@@ -308,7 +324,7 @@ public class VcsHistoryDialog extends FrameWrapper implements DataProvider {
|
||||
for (int i = firstRevision - 1; i >= 0; i--) {
|
||||
Block block1 = getBlock(i + 1);
|
||||
Block block2 = getBlock(i);
|
||||
if (orderedEquals(block1.getLines(), block2.getLines())) continue;
|
||||
if (block1.getLines().equals(block2.getLines())) continue;
|
||||
result.add(myRevisions.get(i));
|
||||
}
|
||||
|
||||
@@ -452,12 +468,4 @@ public class VcsHistoryDialog extends FrameWrapper implements DataProvider {
|
||||
}
|
||||
return myBlocks.get(index);
|
||||
}
|
||||
|
||||
private static boolean orderedEquals(@NotNull List data1, @NotNull List data2) {
|
||||
if (data1.size() != data2.size()) return false;
|
||||
for (int i = 0; i < data1.size(); i++) {
|
||||
if (!Comparing.equal(data1.get(i), data2.get(i))) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1700,7 +1700,8 @@
|
||||
description="Refresh IntelliJ IDEA project structure so that it matches Griffon build settings">
|
||||
</action>
|
||||
|
||||
<action id="Mvc.RunTarget" class="org.jetbrains.plugins.groovy.mvc.actions.MvcRunCommandAction">
|
||||
<action id="Mvc.RunTarget" class="org.jetbrains.plugins.groovy.mvc.actions.MvcRunCommandAction"
|
||||
text="Run Command" description="Run arbitrary Grails/Griffon command">
|
||||
<keyboard-shortcut keymap="$default" first-keystroke="ctrl alt G"/>
|
||||
</action>
|
||||
<add-to-group group-id="ProjectViewPopupMenu" anchor="after" relative-to-action="AddFrameworkSupport"/>
|
||||
|
||||
Reference in New Issue
Block a user