mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -35,7 +35,7 @@ import javax.swing.*;
|
||||
*/
|
||||
public class CompilerIconLayerProvider implements IconLayerProvider {
|
||||
@Override
|
||||
public Icon getLayerIcon(@NotNull Iconable element) {
|
||||
public Icon getLayerIcon(@NotNull Iconable element, boolean isLocked) {
|
||||
VirtualFile vFile = null;
|
||||
Project project = null;
|
||||
if (element instanceof PsiModifierListOwner) {
|
||||
|
||||
+16
-1
@@ -55,11 +55,13 @@ public class VcsContentAnnotationExceptionFilter implements Filter, FilterMixin
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.contentAnnotation.VcsContentAnnotationExceptionFilter");
|
||||
private final GlobalSearchScope myScope;
|
||||
private final VcsContentAnnotationSettings mySettings;
|
||||
private Map<VirtualFile,VcsRevisionNumber> myRevNumbersCache;
|
||||
|
||||
public VcsContentAnnotationExceptionFilter(GlobalSearchScope scope) {
|
||||
myScope = scope;
|
||||
myProject = scope.getProject();
|
||||
mySettings = VcsContentAnnotationSettings.getInstance(myProject);
|
||||
myRevNumbersCache = new HashMap<VirtualFile, VcsRevisionNumber>();
|
||||
}
|
||||
|
||||
private static class MyAdditionalHighlight extends AdditionalHighlight {
|
||||
@@ -111,7 +113,20 @@ public class VcsContentAnnotationExceptionFilter implements Filter, FilterMixin
|
||||
});
|
||||
if (worker.getResult() != null) {
|
||||
VirtualFile vf = worker.getFile().getVirtualFile();
|
||||
final VcsRevisionNumber recentChangeRevision = vcsContentAnnotation.fileRecentlyChanged(vf);
|
||||
if (vf.getFileSystem().isReadOnly()) continue;
|
||||
|
||||
VcsRevisionNumber recentChangeRevision = myRevNumbersCache.get(vf);
|
||||
if (recentChangeRevision == null) {
|
||||
recentChangeRevision = vcsContentAnnotation.fileRecentlyChanged(vf);
|
||||
if (recentChangeRevision == null) {
|
||||
myRevNumbersCache.put(vf, VcsRevisionNumber.NULL);
|
||||
} else {
|
||||
myRevNumbersCache.put(vf, recentChangeRevision);
|
||||
}
|
||||
}
|
||||
if (VcsRevisionNumber.NULL.equals(recentChangeRevision)) {
|
||||
recentChangeRevision = null;
|
||||
}
|
||||
if (localChangesCorrector.isFileAlreadyIdentifiedAsChanged(vf) || ChangeListManager.isFileChanged(myProject, vf) ||
|
||||
recentChangeRevision != null) {
|
||||
final Document document = getDocumentForFile(worker);
|
||||
|
||||
@@ -62,7 +62,7 @@ public class CoreJavaFileManager implements JavaFileManager {
|
||||
for (File file : myClasspath) {
|
||||
final PsiClass psiClass = findClassInClasspathEntry(qName, file);
|
||||
if (psiClass != null) {
|
||||
return null;
|
||||
return psiClass;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.core;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.JavaPsiImplementationHelper;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class CoreJavaPsiImplementationHelper extends JavaPsiImplementationHelper {
|
||||
@Override
|
||||
public PsiClass getOriginalClass(PsiClass psiClass) {
|
||||
return psiClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getClsFileNavigationElement(PsiJavaFile clsFile) {
|
||||
return clsFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LanguageLevel getClassesLanguageLevel(VirtualFile virtualFile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ASTNode getDefaultImportAnchor(PsiImportList list, PsiImportStatementBase statement) {
|
||||
throw new UnsupportedOperationException("TODO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getDefaultMemberAnchor(PsiClass psiClass, PsiMember firstPsi) {
|
||||
throw new UnsupportedOperationException("TODO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupCatchBlock(String exceptionName, PsiElement context, PsiCatchSection element) {
|
||||
throw new UnsupportedOperationException("TODO");
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.EmptySubstitutorImpl;
|
||||
import com.intellij.psi.impl.JavaPsiFacadeImpl;
|
||||
import com.intellij.psi.impl.JavaPsiImplementationHelper;
|
||||
import com.intellij.psi.impl.PsiElementFactoryImpl;
|
||||
import com.intellij.psi.impl.compiled.ClassFileStubBuilder;
|
||||
import com.intellij.psi.impl.compiled.ClsStubBuilderFactory;
|
||||
@@ -52,6 +53,7 @@ public class JavaCoreEnvironment extends CoreEnvironment {
|
||||
javaPsiFacade);
|
||||
myProject.registerService(JavaPsiFacade.class, javaPsiFacade);
|
||||
myProject.registerService(PsiElementFactory.class, new PsiElementFactoryImpl(myPsiManager));
|
||||
myProject.registerService(JavaPsiImplementationHelper.class, new CoreJavaPsiImplementationHelper());
|
||||
|
||||
myApplication.registerService(EmptySubstitutor.class, new EmptySubstitutorImpl());
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.ide.highlighter;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -27,7 +28,13 @@ public class JavaClassFileType implements FileType {
|
||||
|
||||
public static JavaClassFileType INSTANCE = new JavaClassFileType();
|
||||
|
||||
private static final Icon ICON = IconLoader.getIcon("/fileTypes/javaClass.png");
|
||||
private static final NotNullLazyValue<Icon> ICON = new NotNullLazyValue<Icon>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return IconLoader.getIcon("/fileTypes/javaClass.png");
|
||||
}
|
||||
};
|
||||
|
||||
private JavaClassFileType() {
|
||||
}
|
||||
@@ -48,7 +55,7 @@ public class JavaClassFileType implements FileType {
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
return ICON;
|
||||
return ICON.getValue();
|
||||
}
|
||||
|
||||
public boolean isBinary() {
|
||||
|
||||
@@ -211,7 +211,7 @@ public class ElementPresentationUtil implements PlatformIcons {
|
||||
int flags = getFlags(aClass, false);
|
||||
String adj = "";
|
||||
for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
|
||||
if (provider.getLayerIcon(aClass) != null) {
|
||||
if (provider.getLayerIcon(aClass, false) != null) {
|
||||
adj += " " + provider.getLayerDescription();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ public class ExceptionWorker {
|
||||
myClass = psiFacade.findClass(className, mySearchScope);
|
||||
if (myClass == null) {
|
||||
myClass = psiFacade.findClass(className, GlobalSearchScope.allScope(myProject));
|
||||
if (myClass == null) {//try to find class according to all dollars in package name
|
||||
/*if (myClass == null) {//try to find class according to all dollars in package name
|
||||
myClass = psiFacade.findClass(className, GlobalSearchScope.allScope(myProject));
|
||||
}
|
||||
}*/
|
||||
if (myClass == null) return;
|
||||
}
|
||||
myFile = (PsiFile) myClass.getContainingFile().getNavigationElement();
|
||||
|
||||
@@ -29,7 +29,7 @@ public interface IconLayerProvider {
|
||||
ExtensionPointName<IconLayerProvider> EP_NAME = ExtensionPointName.create("com.intellij.iconLayerProvider");
|
||||
|
||||
@Nullable
|
||||
Icon getLayerIcon(@NotNull Iconable element);
|
||||
Icon getLayerIcon(@NotNull Iconable element, boolean isLocked);
|
||||
|
||||
@Nullable
|
||||
String getLayerDescription();
|
||||
|
||||
@@ -16,13 +16,20 @@
|
||||
package com.intellij.openapi.fileTypes;
|
||||
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class UnknownFileType implements FileType {
|
||||
private static final Icon ICON = IconLoader.getIcon("/fileTypes/unknown.png");
|
||||
private static final NotNullLazyValue<Icon> ICON = new NotNullLazyValue<Icon>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return IconLoader.getIcon("/fileTypes/unknown.png");
|
||||
}
|
||||
};
|
||||
public static final FileType INSTANCE = new UnknownFileType();
|
||||
|
||||
private UnknownFileType() {}
|
||||
@@ -43,7 +50,7 @@ public class UnknownFileType implements FileType {
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
return ICON;
|
||||
return ICON.getValue();
|
||||
}
|
||||
|
||||
public boolean isBinary() {
|
||||
|
||||
@@ -25,10 +25,7 @@ import com.intellij.openapi.fileTypes.INativeFileType;
|
||||
import com.intellij.openapi.fileTypes.UnknownFileType;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.Iconable;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -42,6 +39,7 @@ import com.intellij.util.*;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import com.intellij.util.ui.update.ComparableObject;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -62,8 +60,21 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable
|
||||
};
|
||||
private static final Key<TIntObjectHashMap<Icon>> BASE_ICONS = Key.create("BASE_ICONS");
|
||||
|
||||
private static final Icon VISIBILITY_ICON_PLACEHOLDER = EmptyIcon.create(PlatformIcons.PUBLIC_ICON);
|
||||
public static final Icon ICON_PLACEHOLDER = IconLoader.getIcon("/nodes/nodePlaceholder.png");
|
||||
private static final NotNullLazyValue<Icon> VISIBILITY_ICON_PLACEHOLDER = new NotNullLazyValue<Icon>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return EmptyIcon.create(PlatformIcons.PUBLIC_ICON);
|
||||
}
|
||||
};
|
||||
|
||||
public static final NotNullLazyValue<Icon> ICON_PLACEHOLDER = new NotNullLazyValue<Icon>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return IconLoader.getIcon("/nodes/nodePlaceholder.png");
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
public Icon getIcon(int flags) {
|
||||
@@ -133,7 +144,7 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable
|
||||
}
|
||||
}
|
||||
}
|
||||
return ICON_PLACEHOLDER;
|
||||
return ICON_PLACEHOLDER.getValue();
|
||||
}
|
||||
|
||||
public static boolean isNativeFileType(FileType fileType) {
|
||||
@@ -145,7 +156,7 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable
|
||||
if ((flags & ICON_FLAG_VISIBILITY) > 0) {
|
||||
RowIcon rowIcon = new RowIcon(2);
|
||||
rowIcon.setIcon(icon, 0);
|
||||
rowIcon.setIcon(VISIBILITY_ICON_PLACEHOLDER, 1);
|
||||
rowIcon.setIcon(VISIBILITY_ICON_PLACEHOLDER.getValue(), 1);
|
||||
result = rowIcon;
|
||||
}
|
||||
|
||||
@@ -230,7 +241,7 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable
|
||||
public static RowIcon createLayeredIcon(Iconable instance, Icon icon, int flags) {
|
||||
List<Icon> layersFromProviders = new SmartList<Icon>();
|
||||
for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
|
||||
final Icon layerIcon = provider.getLayerIcon(instance);
|
||||
final Icon layerIcon = provider.getLayerIcon(instance, (flags & FLAGS_LOCKED) != 0);
|
||||
if (layerIcon != null) {
|
||||
layersFromProviders.add(layerIcon);
|
||||
}
|
||||
@@ -281,8 +292,4 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable
|
||||
}
|
||||
ourIconLayers.add(new IconLayer(flagMask, icon));
|
||||
}
|
||||
|
||||
static {
|
||||
registerIconLayer(FLAGS_LOCKED, PlatformIcons.LOCKED_ICON);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class TextChangeImpl implements TextChange {
|
||||
private int myEnd;
|
||||
|
||||
/**
|
||||
* Shorthand for creating {@link TextChangeImpl} with the given arguments where <code>'end index'</code> has the same value as
|
||||
* Shorthand for creating change object with the given arguments where <code>'end index'</code> has the same value as
|
||||
* <code>'start index'</code>.
|
||||
*
|
||||
* @param text text affected by the current change
|
||||
@@ -137,9 +137,7 @@ public class TextChangeImpl implements TextChange {
|
||||
/**
|
||||
* Applies given offset applied to the {@link #getStart() start} and {@link #getEnd() end} properties of current text change object.
|
||||
*
|
||||
* @param offset offset to apply to the current change object
|
||||
* @return text change that is built on the basis of the current object that with {@link #getStart() start}
|
||||
* and {@link #getEnd() end} positions shifted to the given offset
|
||||
* @param offset offset to apply to the current change object
|
||||
* @throws IllegalArgumentException if start index becomes zero after given offset appliance (it is not applied then)
|
||||
*/
|
||||
public void advance(int offset) throws IllegalArgumentException {
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -87,7 +89,13 @@ public class CoreJarVirtualFile extends VirtualFile {
|
||||
|
||||
@Override
|
||||
public VirtualFile[] getChildren() {
|
||||
throw new UnsupportedOperationException("TODO");
|
||||
List<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
final String[] children = myHandler.list(this);
|
||||
for (String child : children) {
|
||||
final VirtualFile childFile = myHandler.findFileByPath(myPathInJar + "/" + child);
|
||||
result.add(childFile);
|
||||
}
|
||||
return result.toArray(new VirtualFile[result.size()]);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ public class AutoHardWrapHandler {
|
||||
caretOffsetDiff[0] += event.getNewLength() - event.getOldLength();
|
||||
}
|
||||
|
||||
if (event.getNewLength() <= 0) {
|
||||
if (event.getNewLength() <= event.getOldLength()) {
|
||||
// There is a possible case that document fragment is removed because of auto-formatting. We don't want to process such events.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -406,21 +406,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
myHyperlinks = new EditorHyperlinkSupport(myEditor, myProject);
|
||||
requestFlushImmediately();
|
||||
myMainPanel.add(createCenterComponent(), BorderLayout.CENTER);
|
||||
|
||||
|
||||
myEditor.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
public void documentChanged(DocumentEvent e) {
|
||||
if (e.getNewLength() == 0) {
|
||||
// string has been removed, adjust token ranges
|
||||
synchronized (LOCK) {
|
||||
ConsoleUtil.updateTokensOnTextRemoval(myTokens, e.getOffset(), e.getOffset() + e.getOldLength());
|
||||
int toRemoveLen = e.getOldLength();
|
||||
myContentSize -= Math.min(myContentSize, toRemoveLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
myEditor.getScrollingModel().addVisibleAreaListener(new VisibleAreaListener() {
|
||||
@Override
|
||||
public void visibleAreaChanged(VisibleAreaEvent e) {
|
||||
@@ -732,6 +717,14 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
}
|
||||
|
||||
public void documentChanged(DocumentEvent event) {
|
||||
if (event.getNewLength() == 0) {
|
||||
// string has been removed, adjust token ranges
|
||||
synchronized (LOCK) {
|
||||
ConsoleUtil.updateTokensOnTextRemoval(myTokens, event.getOffset(), event.getOffset() + event.getOldLength());
|
||||
int toRemoveLen = event.getOldLength();
|
||||
myContentSize -= Math.min(myContentSize, toRemoveLen);
|
||||
}
|
||||
}
|
||||
if (myFileType != null) {
|
||||
highlightUserTokens();
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ class NavBarItem extends SimpleColoredComponent implements Disposable {
|
||||
setIpad(new Insets(0,0,0,0));
|
||||
setMyBorder(null);
|
||||
setBorder(null);
|
||||
setPaintFocusBorder(false);
|
||||
}
|
||||
update();
|
||||
myPadding = new JBInsets(3, 3, 3, 3);
|
||||
@@ -144,7 +145,6 @@ class NavBarItem extends SimpleColoredComponent implements Disposable {
|
||||
}
|
||||
|
||||
private void doPaintDecorated(Graphics2D g) {
|
||||
setPaintFocusBorder(false);
|
||||
Icon icon = myIcon;
|
||||
final Color bg = getBackground();
|
||||
g.setPaint(bg);
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class NativeFileIconProvider implements FileIconProvider {
|
||||
if (icon != null) {
|
||||
return icon;
|
||||
}
|
||||
return new DeferredIconImpl<VirtualFile>(ElementBase.ICON_PLACEHOLDER, file, false, new Function<VirtualFile, Icon>() {
|
||||
return new DeferredIconImpl<VirtualFile>(ElementBase.ICON_PLACEHOLDER.getValue(), file, false, new Function<VirtualFile, Icon>() {
|
||||
public Icon fun(VirtualFile virtualFile) {
|
||||
final File f = new File(filePath);
|
||||
if (!f.exists()) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.intellij.refactoring.rename;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.CollectHighlightsUtil;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
@@ -108,8 +107,6 @@ public class PsiElementRenameHandler implements RenameHandler {
|
||||
|
||||
static @Nullable String renameabilityStatus(Project project, PsiElement element) {
|
||||
if (element == null) return "";
|
||||
if (!(element instanceof PsiFile) &&
|
||||
CollectHighlightsUtil.isOutsideSourceRoot(element.getContainingFile())) return "";
|
||||
|
||||
boolean hasRenameProcessor = RenamePsiElementProcessor.forElement(element) != RenamePsiElementProcessor.DEFAULT;
|
||||
boolean hasWritableMetaData = element instanceof PsiMetaOwner && ((PsiMetaOwner)element).getMetaData() instanceof PsiWritableMetaData;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.LineTokenizer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
@@ -292,6 +293,7 @@ public class EditorModificationUtil {
|
||||
boolean atLineStart = caretOffset >= doc.getTextLength() || doc.getLineStartOffset(doc.getLineNumber(caretOffset)) == caretOffset;
|
||||
if (atLineStart && project != null) {
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
PsiDocumentManager.getInstance(project).commitDocument(doc); // Sync document and PSI before formatting.
|
||||
String properIndent = offset >= doc.getTextLength() ? "" : CodeStyleFacade.getInstance(project).getLineIndent(doc, offset);
|
||||
if (properIndent != null) {
|
||||
int tabSize = editor.getSettings().getTabSize(project);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.ide;
|
||||
|
||||
import com.intellij.openapi.util.Iconable;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class LockedIconLayerProvider implements IconLayerProvider {
|
||||
@Override
|
||||
public Icon getLayerIcon(@NotNull Iconable element, boolean isLocked) {
|
||||
return isLocked ? PlatformIcons.LOCKED_ICON : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLayerDescription() {
|
||||
return "Read-only";
|
||||
}
|
||||
}
|
||||
@@ -185,9 +185,19 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
|
||||
validateCallContext();
|
||||
moveToLogicalPosition(myEditor.offsetToLogicalPosition(offset), locateBeforeSoftWrap);
|
||||
if (!ignoreWrongMoves && !myEditor.offsetToLogicalPosition(myOffset).equals(myEditor.offsetToLogicalPosition(offset))) {
|
||||
StringBuilder documentInfo = new StringBuilder();
|
||||
Document document = myEditor.getDocument();
|
||||
for (int line = 0; line < document.getLineCount(); line++) {
|
||||
documentInfo.append(line).append(": ").append(document.getLineStartOffset(line)).append("-")
|
||||
.append(document.getLineEndOffset(line)).append(", ");
|
||||
}
|
||||
if (documentInfo.length() > 0) {
|
||||
documentInfo.setLength(documentInfo.length() - 1);
|
||||
}
|
||||
LOG.error(
|
||||
"caret moved to wrong offset. Requested:" + offset + " but actual:" + myOffset
|
||||
+ ". Soft wraps data: " + myEditor.getSoftWrapModel() + ", folding data: " + myEditor.getFoldingModel());
|
||||
+ ". Soft wraps data: " + myEditor.getSoftWrapModel() + ", folding data: " + myEditor.getFoldingModel() + ", "
|
||||
+ "document info: " + documentInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -648,7 +648,7 @@ button.edit.action.icon=Edit Action &Icon
|
||||
button.add.separator=Add &Separator
|
||||
button.move.up.u=Move &Up
|
||||
button.move.down.d=Move &Down
|
||||
button.add.action.after=Add a&fter...
|
||||
button.add.action.after=Add A&fter...
|
||||
title.custom.actions.schemas=Custom Actions Schemes
|
||||
title.customizations=Menus and Toolbars
|
||||
label.choosebyname.no.matches.found=No matches found
|
||||
|
||||
@@ -151,5 +151,5 @@ ide.enable.toolwindow.stack=false
|
||||
|
||||
change.signature.awesome.mode=true
|
||||
change.signature.awesome.mode.description=Enables list view for change signature
|
||||
navbar.is.decorated=false
|
||||
navbar.is.decorated=true
|
||||
navbar.is.decorated.description=NavBar with decorations
|
||||
|
||||
@@ -254,4 +254,5 @@
|
||||
<postStartupActivity implementation="com.intellij.openapi.actionSystem.impl.ActionPreloader"/>
|
||||
<patch.extension implementation="com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP"/>
|
||||
|
||||
<iconLayerProvider implementation="com.intellij.ide.LockedIconLayerProvider"/>
|
||||
</extensions>
|
||||
|
||||
+8
-4
@@ -44,7 +44,7 @@ public class ApplyPatchForBaseRevisionTexts {
|
||||
@NotNull
|
||||
public static ApplyPatchForBaseRevisionTexts create(final Project project, final VirtualFile file, final FilePath pathBeforeRename,
|
||||
final TextFilePatch patch, final Getter<CharSequence> baseContents) {
|
||||
assert ! patch.isNewFile(); // todo check
|
||||
assert ! patch.isNewFile();
|
||||
final String beforeVersionId = patch.getBeforeVersionId();
|
||||
DefaultPatchBaseVersionProvider provider = null;
|
||||
if (beforeVersionId != null) {
|
||||
@@ -81,7 +81,7 @@ public class ApplyPatchForBaseRevisionTexts {
|
||||
return true;
|
||||
}
|
||||
myBase = text;
|
||||
myPatched = applier.getAfter();
|
||||
setPatched(applier.getAfter());
|
||||
return false;
|
||||
}
|
||||
}, myWarnings);
|
||||
@@ -102,7 +102,7 @@ public class ApplyPatchForBaseRevisionTexts {
|
||||
if (! applier.execute()) {
|
||||
applier.trySolveSomehow();
|
||||
}
|
||||
myPatched = applier.getAfter();
|
||||
setPatched(applier.getAfter());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class ApplyPatchForBaseRevisionTexts {
|
||||
if (! applier.execute()) {
|
||||
applier.trySolveSomehow();
|
||||
}
|
||||
myPatched = applier.getAfter();
|
||||
setPatched(applier.getAfter());
|
||||
}
|
||||
|
||||
public CharSequence getLocal() {
|
||||
@@ -120,6 +120,10 @@ public class ApplyPatchForBaseRevisionTexts {
|
||||
public CharSequence getBase() {
|
||||
return myBase;
|
||||
}
|
||||
|
||||
private void setPatched(final String text) {
|
||||
myPatched = StringUtil.convertLineSeparators(text);
|
||||
}
|
||||
|
||||
public String getPatched() {
|
||||
return myPatched;
|
||||
|
||||
+29
-3
@@ -27,6 +27,8 @@ import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.vcs.*;
|
||||
import com.intellij.openapi.vcs.changes.ContentRevision;
|
||||
import com.intellij.openapi.vcs.diff.DiffProvider;
|
||||
import com.intellij.openapi.vcs.history.*;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.Processor;
|
||||
@@ -66,8 +68,8 @@ public class DefaultPatchBaseVersionProvider {
|
||||
}
|
||||
|
||||
public void getBaseVersionContent(final FilePath filePath,
|
||||
Processor<CharSequence> processor,
|
||||
List<String> warnings) throws VcsException {
|
||||
final Processor<CharSequence> processor,
|
||||
final List<String> warnings) throws VcsException {
|
||||
if (myVcs == null) {
|
||||
return;
|
||||
}
|
||||
@@ -79,9 +81,33 @@ public class DefaultPatchBaseVersionProvider {
|
||||
final Matcher matcher = myRevisionPattern.matcher(myVersionId);
|
||||
if (matcher.find()) {
|
||||
revision = myVcs.parseRevisionNumber(matcher.group(1), filePath);
|
||||
final VcsRevisionNumber finalRevision = revision;
|
||||
final Boolean[] loadedExactRevision = new Boolean[1];
|
||||
|
||||
if (historyProvider instanceof VcsBaseRevisionAdviser) {
|
||||
if (((VcsBaseRevisionAdviser) historyProvider).getBaseVersionContent(filePath, processor, revision.asString(), warnings)) return;
|
||||
final boolean success = VcsUtil.runVcsProcessWithProgress(new VcsRunnable() {
|
||||
public void run() throws VcsException {
|
||||
loadedExactRevision[0] = ((VcsBaseRevisionAdviser)historyProvider).getBaseVersionContent(filePath, processor, finalRevision.asString(), warnings);
|
||||
}
|
||||
}, VcsBundle.message("progress.text2.loading.revision", revision.asString()), true, myProject);
|
||||
// was cancelled
|
||||
if (! success) return;
|
||||
} else {
|
||||
// use diff provider
|
||||
final DiffProvider diffProvider = myVcs.getDiffProvider();
|
||||
if (diffProvider != null && filePath.getVirtualFile() != null) {
|
||||
final ContentRevision fileContent = diffProvider.createFileContent(finalRevision, filePath.getVirtualFile());
|
||||
|
||||
final boolean success = VcsUtil.runVcsProcessWithProgress(new VcsRunnable() {
|
||||
public void run() throws VcsException {
|
||||
loadedExactRevision[0] = ! processor.process(fileContent.getContent());
|
||||
}
|
||||
}, VcsBundle.message("progress.text2.loading.revision", revision.asString()), true, myProject);
|
||||
// was cancelled
|
||||
if (! success) return;
|
||||
}
|
||||
}
|
||||
if (Boolean.TRUE.equals(loadedExactRevision[0])) return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.indexing.*;
|
||||
import com.intellij.util.io.EnumeratorStringDescriptor;
|
||||
import com.intellij.util.io.KeyDescriptor;
|
||||
import org.jetbrains.android.resourceManagers.ResourceManager;
|
||||
import org.jetbrains.android.util.AndroidResourceUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -52,7 +53,8 @@ public class AndroidIdIndex extends ScalarIndexExtension<String> {
|
||||
if (parent == null || !parent.isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
if (!canContainIdDeclaration(parent.getName())) {
|
||||
final String resourceType = ResourceManager.getResourceTypeByDirName(parent.getName());
|
||||
if (resourceType == null || !canContainIdDeclaration(resourceType)) {
|
||||
return false;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
@@ -119,6 +121,6 @@ public class AndroidIdIndex extends ScalarIndexExtension<String> {
|
||||
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -394,6 +394,8 @@ public class AndroidLayoutPreviewToolWindowManager implements ProjectComponent {
|
||||
final JPanel panel = new JPanel(new BorderLayout());
|
||||
final JTextArea textArea = new JTextArea(stackTrace);
|
||||
textArea.setEditable(false);
|
||||
textArea.setRows(40);
|
||||
textArea.setColumns(70);
|
||||
panel.add(ScrollPaneFactory.createScrollPane(textArea));
|
||||
return panel;
|
||||
}
|
||||
@@ -473,7 +475,17 @@ public class AndroidLayoutPreviewToolWindowManager implements ProjectComponent {
|
||||
final VirtualFile changedFile = event.getFile();
|
||||
final VirtualFile parent = changedFile.getParent();
|
||||
|
||||
if (parent != null && ResourceManager.isResourceDirectory(parent, myProject)) {
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ResourceManager.isResourceDirectory(parent, myProject)) {
|
||||
myToolWindowForm.updateLocales();
|
||||
render();
|
||||
}
|
||||
|
||||
final VirtualFile gp = parent.getParent();
|
||||
if (gp != null && ResourceManager.isResourceDirectory(gp, myProject)) {
|
||||
myToolWindowForm.updateLocales();
|
||||
render();
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class RenderUtil {
|
||||
if (missingClasses.size() > 1) {
|
||||
warningBuilder.append("Missing classes:\n");
|
||||
for (String missingClass : missingClasses) {
|
||||
warningBuilder.append(" ").append(missingClass).append('\n');
|
||||
warningBuilder.append(" ").append(missingClass).append('\n');
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -173,6 +173,12 @@ public class AndroidLayoutDomTest extends AndroidDomTest {
|
||||
doTestHighlighting("idh.xml");
|
||||
}
|
||||
|
||||
public void testIdHighlighting1() throws Throwable {
|
||||
VirtualFile virtualFile = copyFileToProject("idh.xml", "res/layout-large/idh.xml");
|
||||
myFixture.configureFromExistingVirtualFile(virtualFile);
|
||||
myFixture.checkHighlighting(false, false, false);
|
||||
}
|
||||
|
||||
public void testIdReferenceCompletion() throws Throwable {
|
||||
toTestCompletion("idref1.xml", "idref1_after.xml");
|
||||
}
|
||||
|
||||
@@ -218,8 +218,11 @@ public class GitSimpleHandler extends GitTextHandler {
|
||||
}
|
||||
|
||||
public void startFailed(final Throwable exception) {
|
||||
ex[0] = new VcsException("Process failed to start (" + myCommandLine.getCommandLineString() + "): " + exception.toString(), exception);
|
||||
sem.release();
|
||||
try {
|
||||
ex[0] = new VcsException("Process failed to start (" + myCommandLine.getCommandLineString() + "): " + exception.toString(), exception);
|
||||
} finally {
|
||||
sem.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
GitHandlerUtil.runInCurrentThread(this, null);
|
||||
|
||||
@@ -68,10 +68,13 @@ public abstract class GitTextHandler extends GitHandler {
|
||||
|
||||
public void processTerminated(final ProcessEvent event) {
|
||||
final int exitCode = event.getExitCode();
|
||||
setExitCode(exitCode);
|
||||
cleanupEnv();
|
||||
GitTextHandler.this.processTerminated(exitCode);
|
||||
listeners().processTerminated(exitCode);
|
||||
try {
|
||||
setExitCode(exitCode);
|
||||
cleanupEnv();
|
||||
GitTextHandler.this.processTerminated(exitCode);
|
||||
} finally {
|
||||
listeners().processTerminated(exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
public void processWillTerminate(final ProcessEvent event, final boolean willBeDestroyed) {
|
||||
|
||||
@@ -171,33 +171,12 @@ public class GitHistoryProvider implements VcsHistoryProvider, VcsCacheableHisto
|
||||
throw new VcsException("Can not apply patch to " + filePath.getPath() + ".\nCan not find revision '" + beforeVersionId + "'.");
|
||||
}
|
||||
|
||||
/*final GitRevisionNumber mergeBase = GitHistoryUtils.getMergeBase(myProject, root, "HEAD", shaHash.getValue());
|
||||
if (mergeBase == null) {
|
||||
throw new VcsException("Can not apply patch to " + filePath.getPath() +
|
||||
".\nBase revision '" + beforeVersionId + "', used in patch, is not on current branch (reachable from current HEAD)," +
|
||||
"\nand there is no merge base between '" + beforeVersionId + "' and HEAD.");
|
||||
}*/
|
||||
final ContentRevision content = GitVcs.getInstance(myProject).getDiffProvider()
|
||||
.createFileContent(new GitRevisionNumber(shaHash.getValue()), filePath.getVirtualFile());
|
||||
if (content == null) {
|
||||
throw new VcsException("Can not load content of '" + filePath.getPath() + "' for revision '" + shaHash.getValue() + "'");
|
||||
}
|
||||
return ! processor.process(content.getContent());
|
||||
/*if (shaHash.getValue().startsWith(mergeBase.getRev())) {
|
||||
// ok
|
||||
return matched;
|
||||
} else {
|
||||
if (matched) {
|
||||
warnings.add("Base revision '" + beforeVersionId + "', used in patch, is not on current branch (reachable from current HEAD)." +
|
||||
"\nMerge base '" + mergeBase.getRev() +"' between '" + beforeVersionId + "' and HEAD was used.");
|
||||
return true;
|
||||
} else {
|
||||
throw new VcsException("Can not apply patch to " + filePath.getPath() +
|
||||
".\nBase revision '" + beforeVersionId + "', used in patch, is not on current branch (reachable from current HEAD)," +
|
||||
"\nand found merge base '" + mergeBase.getRev() + "' between '" + beforeVersionId +
|
||||
"' and HEAD doesn't match the context.");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void reportAppendableHistory(final FilePath path, final VcsAppendableHistorySessionPartner partner) throws VcsException {
|
||||
|
||||
@@ -223,6 +223,7 @@ public class GitHistoryUtils {
|
||||
}
|
||||
@Override
|
||||
public void startFailed(Throwable exception) {
|
||||
semaphore.up();
|
||||
}
|
||||
});
|
||||
semaphore.down();
|
||||
@@ -356,18 +357,24 @@ public class GitHistoryUtils {
|
||||
@Override
|
||||
public void startFailed(Throwable exception) {
|
||||
//noinspection ThrowableInstanceNeverThrown
|
||||
exceptionConsumer.consume(new VcsException(exception));
|
||||
semaphore.up();
|
||||
try {
|
||||
exceptionConsumer.consume(new VcsException(exception));
|
||||
} finally {
|
||||
semaphore.up();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processTerminated(int exitCode) {
|
||||
super.processTerminated(exitCode);
|
||||
final GitLogRecord record = accumulator.processLast();
|
||||
if (record != null) {
|
||||
resultAdapter.consume(record);
|
||||
try {
|
||||
super.processTerminated(exitCode);
|
||||
final GitLogRecord record = accumulator.processLast();
|
||||
if (record != null) {
|
||||
resultAdapter.consume(record);
|
||||
}
|
||||
} finally {
|
||||
semaphore.up();
|
||||
}
|
||||
semaphore.up();
|
||||
}
|
||||
});
|
||||
semaphore.down();
|
||||
@@ -607,6 +614,7 @@ public class GitHistoryUtils {
|
||||
}
|
||||
@Override
|
||||
public void startFailed(Throwable exception) {
|
||||
semaphore.up();
|
||||
}
|
||||
});
|
||||
semaphore.down();
|
||||
@@ -821,7 +829,7 @@ public class GitHistoryUtils {
|
||||
|
||||
@Override
|
||||
public void startFailed(Throwable exception) {
|
||||
// todo
|
||||
semaphore.up();
|
||||
}
|
||||
});
|
||||
semaphore.down();
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
package org.jetbrains.plugins.groovy.lang.groovydoc.psi.api;
|
||||
|
||||
import com.intellij.psi.javadoc.PsiInlineDocTag;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
public interface GrDocInlinedTag extends GrDocTag {
|
||||
public interface GrDocInlinedTag extends GrDocTag, PsiInlineDocTag {
|
||||
}
|
||||
|
||||
+10
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -152,11 +152,16 @@ public class PrimaryExpression implements GroovyElementTypes {
|
||||
}
|
||||
else if (builder.getTokenType() == mLBRACK) {
|
||||
PsiBuilder.Marker forArray = builder.mark();
|
||||
ParserUtils.getToken(builder, mNLS);
|
||||
ParserUtils.getToken(builder, mLBRACK);
|
||||
if (!AssignmentExpression.parse(builder, parser)) {
|
||||
builder.error(GroovyBundle.message("expression.expected"));
|
||||
}
|
||||
ParserUtils.getToken(builder, mNLS);
|
||||
ParserUtils.getToken(builder, mRBRACK, GroovyBundle.message("rbrack.expected"));
|
||||
while (ParserUtils.getToken(builder, mLBRACK)) {
|
||||
ParserUtils.getToken(builder, mNLS);
|
||||
if (!AssignmentExpression.parse(builder, parser)) {
|
||||
builder.error(GroovyBundle.message("expression.expected"));
|
||||
}
|
||||
AssignmentExpression.parse(builder, parser);
|
||||
ParserUtils.getToken(builder, mNLS);
|
||||
ParserUtils.getToken(builder, mRBRACK, GroovyBundle.message("rbrack.expected"));
|
||||
}
|
||||
@@ -188,4 +193,4 @@ public class PrimaryExpression implements GroovyElementTypes {
|
||||
marker.done(ARGUMENTS);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -192,6 +192,9 @@ public abstract class SubstitutorComputer {
|
||||
for (PsiTypeParameter typeParameter : typeParameters) {
|
||||
if (!substitutor.getSubstitutionMap().containsKey(typeParameter)) {
|
||||
substitutor = inferFromContext(typeParameter, PsiUtil.getSmartReturnType(method), substitutor, helper);
|
||||
if (!substitutor.getSubstitutionMap().containsKey(typeParameter)) {
|
||||
substitutor = substitutor.put(typeParameter, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -1,6 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 by JetBrains s.r.o. All Rights Reserved.
|
||||
* Use is subject to license terms.
|
||||
* 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 org.jetbrains.plugins.groovy.lang;
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -88,7 +88,7 @@ public class ExpressionsParsingTest extends GroovyParsingTestCase {
|
||||
public void testgstring$ugly_lexer() throws Throwable { doTest(); }
|
||||
public void testmapLiteral() throws Throwable { doTest(); }
|
||||
public void testnew$arr_decl() throws Throwable { doTest(); }
|
||||
// public void testnew$new1() throws Throwable { doTest(); }
|
||||
// public void testnew$new1() throws Throwable { doTest(); }
|
||||
public void testanonymous$anonymous() throws Throwable { doTest(); }
|
||||
public void testnumbers() throws Throwable { doTest(); }
|
||||
public void testparenthed$exprInParenth() throws Throwable { doTest(); }
|
||||
|
||||
+14
-10
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
* Copyright 2000-2007 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
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* 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 org.jetbrains.plugins.groovy.lang.resolve;
|
||||
|
||||
@@ -266,4 +266,8 @@ map['i'] += 2
|
||||
GrAssignmentExpression assignment = file.topStatements[2]
|
||||
assertTrue(assignment.getLValue().getType().equalsToText(CommonClassNames.JAVA_UTIL_DATE))
|
||||
}
|
||||
|
||||
void testAllTypeParamsAreSubstituted() {
|
||||
assertTypeEquals('java.util.Map', 'a.groovy')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
Map<Integer, Double> map3
|
||||
map3 = [].collectEntries {}
|
||||
int map4 = <warning descr="Cannot assign 'Map<K,V>' to 'int'">[].collectEntries {}</warning>
|
||||
int map4 = <warning descr="Cannot assign 'Map' to 'int'">[].collectEntries {}</warning>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
j = new int[1][2]
|
||||
j = new int[1][]
|
||||
j = new int[]
|
||||
j = new int[][2]
|
||||
-----
|
||||
Groovy script
|
||||
Assignment expression
|
||||
@@ -18,6 +21,63 @@ Groovy script
|
||||
PsiElement(Integer)('1')
|
||||
PsiElement(])(']')
|
||||
PsiElement([)('[')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(])(']')
|
||||
PsiElement(new line)('\n')
|
||||
Assignment expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('j')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
NEW expression
|
||||
PsiElement(new)('new')
|
||||
PsiWhiteSpace(' ')
|
||||
Built in type
|
||||
PsiElement(int)('int')
|
||||
Array declaration
|
||||
PsiElement([)('[')
|
||||
Literal
|
||||
PsiElement(Integer)('1')
|
||||
PsiElement(])(']')
|
||||
PsiElement([)('[')
|
||||
PsiElement(])(']')
|
||||
PsiElement(new line)('\n')
|
||||
Assignment expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('j')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
NEW expression
|
||||
PsiElement(new)('new')
|
||||
PsiWhiteSpace(' ')
|
||||
Built in type
|
||||
PsiElement(int)('int')
|
||||
Array declaration
|
||||
PsiElement([)('[')
|
||||
PsiErrorElement:Expression expected
|
||||
<empty list>
|
||||
PsiElement(])(']')
|
||||
PsiElement(new line)('\n')
|
||||
Assignment expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('j')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(=)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
NEW expression
|
||||
PsiElement(new)('new')
|
||||
PsiWhiteSpace(' ')
|
||||
Built in type
|
||||
PsiElement(int)('int')
|
||||
Array declaration
|
||||
PsiElement([)('[')
|
||||
PsiErrorElement:Expression expected
|
||||
<empty list>
|
||||
PsiElement(])(']')
|
||||
PsiElement([)('[')
|
||||
Literal
|
||||
PsiElement(Integer)('2')
|
||||
PsiElement(])(']')
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
List<String> l = ['a', 'b', 'c']
|
||||
def aa = l.collectEntries { [it, it]}
|
||||
|
||||
print a<ref>a
|
||||
+14
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.dom;
|
||||
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProfilesModel;
|
||||
import org.jetbrains.idea.maven.dom.references.MavenPropertyPsiReference;
|
||||
|
||||
@@ -201,7 +204,13 @@ public class MavenFilteredPropertiesCompletionAndResolutionTest extends MavenDom
|
||||
|
||||
VirtualFile f = createProjectSubFile("res/foo.properties",
|
||||
"foo=abc${xx<caret>x}abc");
|
||||
assertResolved(f, MavenDomUtil.findProperty(myProject, filter, "xxx").getPsiElement());
|
||||
assertResolved(f, findPropertyPsiElement(filter, "xxx"));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PsiElement findPropertyPsiElement(final VirtualFile filter, final String propName) {
|
||||
final IProperty property = MavenDomUtil.findProperty(myProject, filter, propName);
|
||||
return property != null ? property.getPsiElement() : null;
|
||||
}
|
||||
|
||||
public void testCompletionFromFilters() throws Exception {
|
||||
@@ -230,7 +239,7 @@ public class MavenFilteredPropertiesCompletionAndResolutionTest extends MavenDom
|
||||
}
|
||||
|
||||
public void testSearchingFromFilters() throws Exception {
|
||||
VirtualFile filter = createProjectSubFile("filters/filter.properties", "xxx=1");
|
||||
createProjectSubFile("filters/filter.properties", "xxx=1");
|
||||
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
@@ -250,7 +259,7 @@ public class MavenFilteredPropertiesCompletionAndResolutionTest extends MavenDom
|
||||
|
||||
VirtualFile f = createProjectSubFile("res/foo.properties",
|
||||
"foo=${xxx}");
|
||||
filter = createProjectSubFile("filters/filter.properties", "xx<caret>x=1");
|
||||
VirtualFile filter = createProjectSubFile("filters/filter.properties", "xx<caret>x=1");
|
||||
|
||||
assertSearchResultsInclude(filter, MavenDomUtil.findPropertyValue(myProject, f, "foo"));
|
||||
}
|
||||
@@ -415,15 +424,11 @@ public class MavenFilteredPropertiesCompletionAndResolutionTest extends MavenDom
|
||||
|
||||
VirtualFile f = createProjectSubFile("res/foo.properties",
|
||||
"foo=abc${x<caret>xx}abc");
|
||||
assertResolved(f, MavenDomUtil.findProperty(myProject, filter, "xxx").getPsiElement());
|
||||
assertResolved(f, findPropertyPsiElement(filter, "xxx"));
|
||||
|
||||
doRename(f, "bar");
|
||||
|
||||
assertEquals("foo=abc${bar}abc", findPsiFile(f).getText());
|
||||
assertEquals("bar=1", findPsiFile(filter).getText());
|
||||
}
|
||||
|
||||
public void testFilteredPropertiesUsages() throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SvnDiffProvider implements DiffProvider, DiffMixin {
|
||||
private VcsRevisionDescription getCurrentRevisionDescription(File path) {
|
||||
final SVNWCClient client = myVcs.createWCClient();
|
||||
try {
|
||||
final SVNInfo svnInfo = client.doInfo(path, SVNRevision.COMMITTED);
|
||||
final SVNInfo svnInfo = client.doInfo(path, SVNRevision.BASE);
|
||||
|
||||
if (svnInfo.getCommittedRevision().equals(SVNRevision.UNDEFINED) && ! svnInfo.getCopyFromRevision().equals(SVNRevision.UNDEFINED) &&
|
||||
svnInfo.getCopyFromURL() != null) {
|
||||
@@ -88,7 +88,7 @@ public class SvnDiffProvider implements DiffProvider, DiffMixin {
|
||||
|
||||
private String getProperties(SVNWCClient client, File path) throws SVNException {
|
||||
final String[] message = new String[1];
|
||||
client.doGetRevisionProperty(path, null, SVNRevision.COMMITTED, new ISVNPropertyHandler() {
|
||||
client.doGetRevisionProperty(path, null, SVNRevision.BASE, new ISVNPropertyHandler() {
|
||||
@Override
|
||||
public void handleProperty(File path, SVNPropertyData property) throws SVNException {
|
||||
handle(property);
|
||||
|
||||
Reference in New Issue
Block a user