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:
@@ -25,7 +25,6 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.spellchecker.inspections.PlainTextSplitter;
|
||||
import com.intellij.spellchecker.tokenizer.EscapeSequenceTokenizer;
|
||||
import com.intellij.spellchecker.tokenizer.TokenConsumer;
|
||||
import com.intellij.spellchecker.tokenizer.Tokenizer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -33,7 +32,7 @@ import java.util.Collections;
|
||||
/**
|
||||
* @author shkate@jetbrains.com
|
||||
*/
|
||||
public class LiteralExpressionTokenizer extends Tokenizer<PsiLiteralExpression> {
|
||||
public class LiteralExpressionTokenizer extends EscapeSequenceTokenizer<PsiLiteralExpression> {
|
||||
@Override
|
||||
public void tokenize(@NotNull PsiLiteralExpression element, TokenConsumer consumer) {
|
||||
PsiLiteralExpressionImpl literalExpression = (PsiLiteralExpressionImpl)element;
|
||||
@@ -63,6 +62,6 @@ public class LiteralExpressionTokenizer extends Tokenizer<PsiLiteralExpression>
|
||||
int[] offsets = new int[text.length()+1];
|
||||
PsiLiteralExpressionImpl.parseStringCharacters(text, unescapedText, offsets);
|
||||
|
||||
EscapeSequenceTokenizer.processTextWithOffsets(element, consumer, unescapedText, offsets, 1);
|
||||
processTextWithOffsets(element, consumer, unescapedText, offsets, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,21 +790,19 @@ public class PsiClassImplUtil {
|
||||
|
||||
@Nullable
|
||||
public static PsiClass getSuperClass(@NotNull PsiClass psiClass) {
|
||||
PsiManager manager = psiClass.getManager();
|
||||
GlobalSearchScope resolveScope = psiClass.getResolveScope();
|
||||
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject());
|
||||
if (psiClass.isInterface()) {
|
||||
return facade.findClass(CommonClassNames.JAVA_LANG_OBJECT, resolveScope);
|
||||
String className = CommonClassNames.JAVA_LANG_OBJECT;
|
||||
return findSpecialSuperClass(psiClass, className);
|
||||
}
|
||||
if (psiClass.isEnum()) {
|
||||
return facade.findClass(CommonClassNames.JAVA_LANG_ENUM, resolveScope);
|
||||
return findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_ENUM);
|
||||
}
|
||||
|
||||
if (psiClass instanceof PsiAnonymousClass) {
|
||||
PsiClassType baseClassReference = ((PsiAnonymousClass)psiClass).getBaseClassType();
|
||||
PsiClass baseClass = baseClassReference.resolve();
|
||||
if (baseClass == null || baseClass.isInterface()) return facade.findClass(CommonClassNames.JAVA_LANG_OBJECT, resolveScope);
|
||||
if (baseClass == null || baseClass.isInterface()) return findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_OBJECT);
|
||||
return baseClass;
|
||||
}
|
||||
|
||||
@@ -812,10 +810,15 @@ public class PsiClassImplUtil {
|
||||
|
||||
final PsiClassType[] referenceElements = psiClass.getExtendsListTypes();
|
||||
|
||||
if (referenceElements.length == 0) return facade.findClass(CommonClassNames.JAVA_LANG_OBJECT, resolveScope);
|
||||
if (referenceElements.length == 0) return findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_OBJECT);
|
||||
|
||||
PsiClass psiResoved = referenceElements[0].resolve();
|
||||
return psiResoved == null ? facade.findClass(CommonClassNames.JAVA_LANG_OBJECT, resolveScope) : psiResoved;
|
||||
PsiClass psiResolved = referenceElements[0].resolve();
|
||||
return psiResolved == null ? findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_OBJECT) : psiResolved;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiClass findSpecialSuperClass(@NotNull PsiClass psiClass, String className) {
|
||||
return JavaPsiFacade.getInstance(psiClass.getProject()).findClass(className, psiClass.getResolveScope());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -832,7 +835,7 @@ public class PsiClassImplUtil {
|
||||
PsiClassType[] extendsListTypes = psiClass.getExtendsListTypes();
|
||||
|
||||
if (psiClass.isInterface()) {
|
||||
return resolveClassReferenceList(extendsListTypes, psiClass.getManager(), psiClass.getResolveScope(), true);
|
||||
return resolveClassReferenceList(extendsListTypes, psiClass, true);
|
||||
}
|
||||
|
||||
if (psiClass instanceof PsiAnonymousClass) {
|
||||
@@ -841,28 +844,25 @@ public class PsiClassImplUtil {
|
||||
PsiClass baseClass = baseClassReference.resolve();
|
||||
if (baseClass != null) {
|
||||
if (baseClass.isInterface()) {
|
||||
PsiClass objectClass =
|
||||
JavaPsiFacade.getInstance(psiClass.getProject()).findClass(CommonClassNames.JAVA_LANG_OBJECT, psiClass.getResolveScope());
|
||||
PsiClass objectClass = findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_OBJECT);
|
||||
return objectClass != null ? new PsiClass[]{objectClass, baseClass} : new PsiClass[]{baseClass};
|
||||
}
|
||||
return new PsiClass[]{baseClass};
|
||||
}
|
||||
|
||||
PsiClass objectClass =
|
||||
JavaPsiFacade.getInstance(psiClass.getProject()).findClass(CommonClassNames.JAVA_LANG_OBJECT, psiClass.getResolveScope());
|
||||
PsiClass objectClass = findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_OBJECT);
|
||||
return objectClass != null ? new PsiClass[]{objectClass} : PsiClass.EMPTY_ARRAY;
|
||||
}
|
||||
if (psiClass instanceof PsiTypeParameter) {
|
||||
if (extendsListTypes.length == 0) {
|
||||
final PsiClass objectClass =
|
||||
JavaPsiFacade.getInstance(psiClass.getProject()).findClass(CommonClassNames.JAVA_LANG_OBJECT, psiClass.getResolveScope());
|
||||
final PsiClass objectClass = findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_OBJECT);
|
||||
return objectClass != null ? new PsiClass[]{objectClass} : PsiClass.EMPTY_ARRAY;
|
||||
}
|
||||
return resolveClassReferenceList(extendsListTypes, psiClass.getManager(), psiClass.getResolveScope(), false);
|
||||
return resolveClassReferenceList(extendsListTypes, psiClass, false);
|
||||
}
|
||||
|
||||
PsiClassType[] implementsListTypes = psiClass.getImplementsListTypes();
|
||||
PsiClass[] interfaces = resolveClassReferenceList(implementsListTypes, psiClass.getManager(), psiClass.getResolveScope(), false);
|
||||
PsiClass[] interfaces = resolveClassReferenceList(implementsListTypes, psiClass, false);
|
||||
|
||||
PsiClass superClass = getSuperClass(psiClass);
|
||||
if (superClass == null) return interfaces;
|
||||
@@ -917,11 +917,10 @@ public class PsiClassImplUtil {
|
||||
|
||||
private static PsiClassType getEnumSuperType(@NotNull PsiClass psiClass, @NotNull PsiElementFactory factory) {
|
||||
PsiClassType superType;
|
||||
final PsiManager manager = psiClass.getManager();
|
||||
final PsiClass enumClass = JavaPsiFacade.getInstance(manager.getProject()).findClass("java.lang.Enum", psiClass.getResolveScope());
|
||||
final PsiClass enumClass = findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_ENUM);
|
||||
if (enumClass == null) {
|
||||
try {
|
||||
superType = (PsiClassType)factory.createTypeFromText("java.lang.Enum", null);
|
||||
superType = (PsiClassType)factory.createTypeFromText(CommonClassNames.JAVA_LANG_ENUM, null);
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
superType = null;
|
||||
@@ -957,8 +956,7 @@ public class PsiClassImplUtil {
|
||||
@NotNull
|
||||
public static PsiClass[] getInterfaces(@NotNull PsiClass psiClass) {
|
||||
if (psiClass.isInterface()) {
|
||||
final PsiClassType[] extendsListTypes = psiClass.getExtendsListTypes();
|
||||
return resolveClassReferenceList(extendsListTypes, psiClass.getManager(), psiClass.getResolveScope(), false);
|
||||
return resolveClassReferenceList(psiClass.getExtendsListTypes(), psiClass, false);
|
||||
}
|
||||
|
||||
if (psiClass instanceof PsiAnonymousClass) {
|
||||
@@ -968,17 +966,16 @@ public class PsiClassImplUtil {
|
||||
}
|
||||
|
||||
final PsiClassType[] implementsListTypes = psiClass.getImplementsListTypes();
|
||||
return resolveClassReferenceList(implementsListTypes, psiClass.getManager(), psiClass.getResolveScope(), false);
|
||||
return resolveClassReferenceList(implementsListTypes, psiClass, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiClass[] resolveClassReferenceList(@NotNull PsiClassType[] listOfTypes,
|
||||
@NotNull PsiManager manager,
|
||||
@NotNull GlobalSearchScope resolveScope,
|
||||
@NotNull PsiClass psiClass,
|
||||
boolean includeObject) {
|
||||
PsiClass objectClass = null;
|
||||
if (includeObject) {
|
||||
objectClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(CommonClassNames.JAVA_LANG_OBJECT, resolveScope);
|
||||
objectClass = findSpecialSuperClass(psiClass, CommonClassNames.JAVA_LANG_OBJECT);
|
||||
if (objectClass == null) includeObject = false;
|
||||
}
|
||||
if (listOfTypes.length == 0) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -101,13 +102,16 @@ public abstract class SetEditorSettingsAction extends ActionGroup implements Dum
|
||||
}
|
||||
},
|
||||
new EditorSettingToggleAction("EditorToggleUseSoftWraps") {
|
||||
private boolean myForcedSoftWrap;
|
||||
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return myTextSettings.isUseSoftWraps();
|
||||
return myForcedSoftWrap || myTextSettings.isUseSoftWraps();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(boolean state) {
|
||||
myForcedSoftWrap = false;
|
||||
myTextSettings.setUseSoftWraps(state);
|
||||
}
|
||||
|
||||
@@ -117,15 +121,21 @@ public abstract class SetEditorSettingsAction extends ActionGroup implements Dum
|
||||
editor.getSettings().setUseSoftWraps(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyDefaults(@NotNull List<? extends Editor> editors) {
|
||||
for (Editor editor : editors) {
|
||||
if (editor.getUserData(EditorImpl.FORCED_SOFT_WRAPS) != null) myForcedSoftWrap = true;
|
||||
}
|
||||
super.applyDefaults(editors);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public void applyDefaults() {
|
||||
for (Editor editor : myEditors) {
|
||||
for (EditorSettingToggleAction action : myActions) {
|
||||
action.apply(editor, action.isSelected());
|
||||
}
|
||||
for (EditorSettingToggleAction action : myActions) {
|
||||
action.applyDefaults(myEditors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,5 +168,11 @@ public abstract class SetEditorSettingsAction extends ActionGroup implements Dum
|
||||
public abstract void setSelected(boolean value);
|
||||
|
||||
public abstract void apply(@NotNull Editor editor, boolean value);
|
||||
|
||||
public void applyDefaults(@NotNull List<? extends Editor> editors) {
|
||||
for (Editor editor : editors) {
|
||||
apply(editor, isSelected());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class DiffLineSeparatorRenderer implements LineMarkerRenderer, LineSepara
|
||||
int interval = getStepSize(lineHeight) * 2;
|
||||
|
||||
int shiftX = -interval; // skip zero index painting
|
||||
if (((EditorEx)myEditor).getVerticalScrollbarOrientation() == EditorEx.VERTICAL_SCROLLBAR_LEFT) {
|
||||
if (DiffUtil.isMirrored(myEditor)) {
|
||||
int contentWidth = ((EditorEx)myEditor).getScrollPane().getViewport().getWidth();
|
||||
shiftX += contentWidth % interval - interval;
|
||||
shiftX += gutterWidth % interval - interval;
|
||||
|
||||
@@ -189,6 +189,13 @@ public class DiffUtil {
|
||||
editor.reinitSettings();
|
||||
}
|
||||
|
||||
public static boolean isMirrored(@NotNull Editor editor) {
|
||||
if (editor instanceof EditorEx) {
|
||||
return ((EditorEx)editor).getVerticalScrollbarOrientation() == EditorEx.VERTICAL_SCROLLBAR_LEFT;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Scrolling
|
||||
//
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
<orderEntry type="module" module-name="images" />
|
||||
<orderEntry type="module" module-name="lang-impl" />
|
||||
<orderEntry type="module" module-name="dvcs-api" />
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
<orderEntry type="module" module-name="testFramework" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package com.intellij.dvcs.push.ui;
|
||||
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.spellchecker.ui.SpellCheckingEditorCustomization;
|
||||
import com.intellij.ui.EditorCustomization;
|
||||
import com.intellij.ui.TextFieldWithAutoCompletion;
|
||||
import com.intellij.ui.TextFieldWithAutoCompletionListProvider;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -49,7 +50,10 @@ public class PushTargetTextField extends TextFieldWithAutoCompletion<String> {
|
||||
protected EditorEx createEditor() {
|
||||
// editor created lazy, so we need to update editor customization after initialization
|
||||
EditorEx editorEx = super.createEditor();
|
||||
SpellCheckingEditorCustomization.DISABLED.customize(editorEx);
|
||||
EditorCustomization customization = SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization();
|
||||
if (customization != null) {
|
||||
customization.customize(editorEx);
|
||||
}
|
||||
return editorEx;
|
||||
}
|
||||
|
||||
|
||||
+6
-12
@@ -37,13 +37,15 @@ import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.SimpleToolWindowPanel;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.AsyncResult;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.StubBasedPsiElement;
|
||||
import com.intellij.psi.impl.source.tree.CompositeElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.treeStructure.actions.CollapseAllAction;
|
||||
@@ -824,15 +826,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
|
||||
modificationCountForChildren = ourSettingsModificationCount;
|
||||
}
|
||||
|
||||
final Object o = unwrapValue(getValue());
|
||||
long currentStamp = -1;
|
||||
if (o instanceof StubBasedPsiElement && ((StubBasedPsiElement)o).getStub() != null) {
|
||||
currentStamp = ((StubBasedPsiElement)o).getContainingFile().getModificationStamp();
|
||||
} else if (o instanceof PsiElement && ((PsiElement)o).getNode() instanceof CompositeElement) {
|
||||
currentStamp = ((CompositeElement)((PsiElement)o).getNode()).getModificationCount();
|
||||
} else if (o instanceof ModificationTracker) {
|
||||
currentStamp = ((ModificationTracker)o).getModificationCount();
|
||||
}
|
||||
final long currentStamp = myProject != null ? PsiManager.getInstance(myProject).getModificationTracker().getModificationCount() : -1;
|
||||
if (childrenStamp != currentStamp) {
|
||||
resetChildren();
|
||||
childrenStamp = currentStamp;
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2000-2015 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.openapi.editor;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.ui.EditorCustomization;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class SpellCheckingEditorCustomizationProvider {
|
||||
@NotNull
|
||||
public static SpellCheckingEditorCustomizationProvider getInstance() {
|
||||
return ServiceManager.getService(SpellCheckingEditorCustomizationProvider.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final EditorCustomization getCustomization(boolean enabled) {
|
||||
return enabled ? getEnabledCustomization() : getDisabledCustomization();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EditorCustomization getEnabledCustomization() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EditorCustomization getDisabledCustomization() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -604,11 +604,6 @@
|
||||
<editorOptionsProvider instance="com.intellij.application.options.editor.EditorAppearanceConfigurable"
|
||||
id="editor.preferences.appearance"
|
||||
key="tab.editor.settings.appearance" bundle="messages.ApplicationBundle"/>
|
||||
<editorCustomization implementation="com.intellij.ui.SoftWrapsEditorCustomization"/>
|
||||
<editorCustomization implementation="com.intellij.ui.HorizontalScrollBarEditorCustomization"/>
|
||||
<editorCustomization implementation="com.intellij.ui.AdditionalPageAtBottomEditorCustomization"/>
|
||||
<editorCustomization implementation="com.intellij.ui.OneLineEditorCustomization"/>
|
||||
<editorCustomization implementation="com.intellij.ui.RightMarginEditorCustomization"/>
|
||||
|
||||
<!-- Colors & Fonts-->
|
||||
<applicationConfigurable groupId="editor" groupWeight="180" dynamic="true" instance="com.intellij.application.options.colors.ColorAndFontOptions"
|
||||
|
||||
@@ -181,7 +181,6 @@
|
||||
<extensionPoint name="featureStatBundle" interface="com.intellij.featureStatistics.FeatureStatisticsBundleProvider"/>
|
||||
<extensionPoint name="featureStatisticsBundle" beanClass="com.intellij.featureStatistics.FeatureStatisticsBundleEP"/>
|
||||
|
||||
<extensionPoint name="editorCustomization" area="IDEA_PROJECT" interface="com.intellij.ui.EditorCustomization"/>
|
||||
<extensionPoint name="editorNavigation" interface="com.intellij.openapi.editor.EditorNavigationDelegate"/>
|
||||
|
||||
<extensionPoint name="statistics.usagesCollector" interface="com.intellij.internal.statistic.UsagesCollector"/>
|
||||
|
||||
@@ -292,6 +292,7 @@
|
||||
serviceImplementation="com.intellij.openapi.actionSystem.impl.AbbreviationManagerImpl"/>
|
||||
|
||||
<applicationService serviceImplementation="com.intellij.openapi.editor.ex.EditorSettingsExternalizable"/>
|
||||
<applicationService serviceImplementation="com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider"/>
|
||||
|
||||
<scopeParserExtension implementation="com.intellij.psi.search.scope.packageSet.FilePackageSetParserExtension"/>
|
||||
<applicationService serviceInterface="com.intellij.openapi.ui.popup.StackingPopupDispatcher" serviceImplementation="com.intellij.ui.popup.StackingPopupDispatcherImpl"/>
|
||||
|
||||
@@ -363,7 +363,7 @@ ui.no.bangs.and.whistles=false
|
||||
|
||||
comment.by.line.bulk.lines.trigger=100
|
||||
|
||||
junit_sm_runner=false
|
||||
junit_sm_runner=true
|
||||
testng_sm_runner=false
|
||||
show.flex.debug.design.view=false
|
||||
|
||||
|
||||
+2
-2
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.vcs.changes.ui;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.event.DocumentListener;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -25,7 +26,6 @@ import com.intellij.openapi.vcs.VcsBundle;
|
||||
import com.intellij.openapi.vcs.VcsConfiguration;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.changes.LocalChangeList;
|
||||
import com.intellij.spellchecker.ui.SpellCheckingEditorCustomization;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -164,7 +164,7 @@ public abstract class NewEditChangelistPanel extends JPanel {
|
||||
final EditorTextField editorField;
|
||||
|
||||
final Set<EditorCustomization> editorFeatures = ContainerUtil.newHashSet();
|
||||
editorFeatures.add(SpellCheckingEditorCustomization.ENABLED);
|
||||
ContainerUtil.addIfNotNull(editorFeatures, SpellCheckingEditorCustomizationProvider.getInstance().getEnabledCustomization());
|
||||
|
||||
if (defaultLines == 1) {
|
||||
editorFeatures.add(HorizontalScrollBarEditorCustomization.DISABLED);
|
||||
|
||||
@@ -20,15 +20,16 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.*;
|
||||
import com.intellij.spellchecker.ui.SpellCheckingEditorCustomization;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -119,11 +120,11 @@ public class CommitMessage extends AbstractDataProviderPanel implements Disposab
|
||||
VcsConfiguration configuration = VcsConfiguration.getInstance(project);
|
||||
if (configuration != null) {
|
||||
boolean enableSpellChecking = forceSpellCheckOn || configuration.CHECK_COMMIT_MESSAGE_SPELLING;
|
||||
features.add(SpellCheckingEditorCustomization.getInstance(enableSpellChecking));
|
||||
ContainerUtil.addIfNotNull(features, SpellCheckingEditorCustomizationProvider.getInstance().getCustomization(enableSpellChecking));
|
||||
features.add(new RightMarginEditorCustomization(configuration.USE_COMMIT_MESSAGE_MARGIN, configuration.COMMIT_MESSAGE_MARGIN_SIZE));
|
||||
features.add(WrapWhenTypingReachesRightMarginCustomization.getInstance(configuration.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN));
|
||||
} else {
|
||||
features.add(SpellCheckingEditorCustomization.ENABLED);
|
||||
ContainerUtil.addIfNotNull(features, SpellCheckingEditorCustomizationProvider.getInstance().getEnabledCustomization());
|
||||
features.add(new RightMarginEditorCustomization(false, -1));
|
||||
}
|
||||
|
||||
@@ -177,7 +178,10 @@ public class CommitMessage extends AbstractDataProviderPanel implements Disposab
|
||||
return;
|
||||
}
|
||||
EditorEx editorEx = (EditorEx)editor;
|
||||
SpellCheckingEditorCustomization.getInstance(check).customize(editorEx);
|
||||
EditorCustomization customization = SpellCheckingEditorCustomizationProvider.getInstance().getCustomization(check);
|
||||
if (customization != null) {
|
||||
customization.customize(editorEx);
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.intellij.openapi.vcs;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.changes.ContentRevision;
|
||||
import com.intellij.openapi.vcs.changes.committed.MockAbstractVcs;
|
||||
import com.intellij.testFramework.vcs.MockContentRevision;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesComparator;
|
||||
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
|
||||
import com.intellij.openapi.vcs.impl.LocalChangesUnderRoots;
|
||||
import com.intellij.openapi.vcs.impl.projectlevelman.AllVcses;
|
||||
import com.intellij.openapi.vcs.impl.projectlevelman.AllVcsesI;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.VfsTestUtil;
|
||||
import com.intellij.testFramework.vcs.MockChangeListManager;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public class LocalChangesUnderRootsTest extends PlatformTestCase {
|
||||
|
||||
private LocalChangesUnderRoots myLocalChangesUnderRoots;
|
||||
private MockChangeListManager myChangeListManager;
|
||||
private VirtualFile myBaseDir;
|
||||
|
||||
@Before
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
myChangeListManager = new MockChangeListManager();
|
||||
myBaseDir = myProject.getBaseDir();
|
||||
myLocalChangesUnderRoots = new LocalChangesUnderRoots(ChangeListManager.getInstance(myProject),
|
||||
ProjectLevelVcsManager.getInstance(myProject));
|
||||
|
||||
substituteChangeListManager();
|
||||
}
|
||||
|
||||
// This is not good, but declaring MockChangeListManager might break other tests
|
||||
private void substituteChangeListManager() throws NoSuchFieldException, IllegalAccessException {
|
||||
Field myChangeManager = LocalChangesUnderRoots.class.getDeclaredField("myChangeManager");
|
||||
myChangeManager.setAccessible(true);
|
||||
myChangeManager.set(myLocalChangesUnderRoots, myChangeListManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangesInTwoGitRoots() {
|
||||
AllVcsesI myVcses = AllVcses.getInstance(myProject);
|
||||
myVcses.registerManually(new MockAbstractVcs(myProject, "Mock"));
|
||||
|
||||
List<VirtualFile> roots = createRootStructure(
|
||||
Pair.create(myBaseDir.getPath(), "Mock"),
|
||||
Pair.create("community", "Mock")
|
||||
);
|
||||
|
||||
Change changeBeforeCommunity = createChangeForPath("a.txt");
|
||||
Change changeAfterCommunity = createChangeForPath("readme.txt");
|
||||
Change changeInCommunity = createChangeForPath("community/com.txt");
|
||||
myChangeListManager.addChanges(changeBeforeCommunity, changeAfterCommunity, changeInCommunity);
|
||||
|
||||
Map<VirtualFile, Collection<Change>> expected = new HashMap<VirtualFile, Collection<Change>>();
|
||||
expected.put(roots.get(0), Arrays.asList(changeBeforeCommunity, changeAfterCommunity));
|
||||
expected.put(roots.get(1), Arrays.asList(changeInCommunity));
|
||||
|
||||
Map<VirtualFile, Collection<Change>> changesUnderRoots = myLocalChangesUnderRoots.getChangesUnderRoots(roots);
|
||||
assertEqualMaps(expected, changesUnderRoots);
|
||||
}
|
||||
|
||||
private static void assertEqualMaps(Map<VirtualFile, Collection<Change>> expected, Map<VirtualFile, Collection<Change>> actual) {
|
||||
assertEquals("Maps size is different. " + expectedActualMessage(expected, actual), expected.size(), actual.size());
|
||||
for (Map.Entry<VirtualFile, Collection<Change>> expectedEntry : expected.entrySet()) {
|
||||
VirtualFile root = expectedEntry.getKey();
|
||||
if (!actual.containsKey(root)) {
|
||||
fail("Didn't find root [" + root + "]. " + expectedActualMessage(expected, actual));
|
||||
}
|
||||
List<Change> expectedChanges = new ArrayList<Change>(expectedEntry.getValue());
|
||||
List<Change> actualChanges = new ArrayList<Change>(actual.get(root));
|
||||
Collections.sort(expectedChanges, ChangesComparator.getInstance(false));
|
||||
Collections.sort(actualChanges, ChangesComparator.getInstance(false));
|
||||
assertEquals("Changes not equal for root [" + root + "]. " + expectedActualMessage(expected, actual), expectedChanges, actualChanges);
|
||||
}
|
||||
}
|
||||
|
||||
private static String expectedActualMessage(Object expected, Object actual) {
|
||||
return "\nExpected:\n " + expected + "\nActual:\n" + actual;
|
||||
}
|
||||
|
||||
private List<VirtualFile> createRootStructure(Pair<String, String>... pathAndVcs) {
|
||||
List<VirtualFile> roots = new ArrayList<VirtualFile>();
|
||||
List<VcsDirectoryMapping> mappings = new ArrayList<VcsDirectoryMapping>();
|
||||
for (Pair<String, String> pathAndVc : pathAndVcs) {
|
||||
String path = pathAndVc.first;
|
||||
String vcs = pathAndVc.second;
|
||||
|
||||
VirtualFile vf;
|
||||
if (path.equals(myBaseDir.getPath())) {
|
||||
vf = myBaseDir;
|
||||
} else {
|
||||
vf = VfsTestUtil.createDir(myBaseDir, path);
|
||||
}
|
||||
|
||||
mappings.add(new VcsDirectoryMapping(vf.getPath(), vcs));
|
||||
roots.add(vf);
|
||||
}
|
||||
ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings(mappings);
|
||||
return roots;
|
||||
}
|
||||
|
||||
private Change createChangeForPath(String path) {
|
||||
VirtualFile file = VfsTestUtil.createFile(myBaseDir, path);
|
||||
FilePath filePath = new FilePathImpl(file);
|
||||
ContentRevision beforeRevision = new MockContentRevision(filePath, new VcsRevisionNumber.Int(1));
|
||||
ContentRevision afterRevision = new MockContentRevision(filePath, new VcsRevisionNumber.Int(2));
|
||||
return new Change(beforeRevision, afterRevision);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
<orderEntry type="module" module-name="jps-model-serialization" />
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="module" module-name="lang-impl" />
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
<orderEntry type="module" module-name="testFramework" scope="TEST" />
|
||||
<orderEntry type="library" name="gson" level="project" />
|
||||
|
||||
+6
-10
@@ -15,26 +15,19 @@
|
||||
*/
|
||||
package com.intellij.vcs.log.ui.actions;
|
||||
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.progress.PerformInBackgroundOption;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.spellchecker.ui.SpellCheckingEditorCustomization;
|
||||
import com.intellij.ui.EditorCustomization;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.TextFieldWithAutoCompletion;
|
||||
import com.intellij.util.ui.AsyncProcessIcon;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public abstract class TextFieldWithProgress extends JPanel {
|
||||
@NotNull private final TextFieldWithAutoCompletion<String> myTextField;
|
||||
@@ -58,7 +51,10 @@ public abstract class TextFieldWithProgress extends JPanel {
|
||||
protected EditorEx createEditor() {
|
||||
// spell check is not needed
|
||||
EditorEx editor = super.createEditor();
|
||||
SpellCheckingEditorCustomization.getInstance(false).customize(editor);
|
||||
EditorCustomization customization = SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization();
|
||||
if (customization != null) {
|
||||
customization.customize(editor);
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonShortcuts;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
@@ -29,7 +30,6 @@ import com.intellij.openapi.ui.popup.ComponentPopupBuilder;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.spellchecker.ui.SpellCheckingEditorCustomization;
|
||||
import com.intellij.ui.EditorCustomization;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.EditorTextFieldProvider;
|
||||
@@ -42,7 +42,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -61,8 +60,8 @@ class MultilinePopupBuilder {
|
||||
@NotNull
|
||||
private static EditorTextField createTextField(@NotNull Project project) {
|
||||
final EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class);
|
||||
List<EditorCustomization>
|
||||
features = Arrays.<EditorCustomization>asList(SoftWrapsEditorCustomization.ENABLED, SpellCheckingEditorCustomization.DISABLED);
|
||||
List<EditorCustomization> features = ContainerUtil.packNullables(SoftWrapsEditorCustomization.ENABLED,
|
||||
SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization());
|
||||
EditorTextField textField = service.getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, features);
|
||||
textField.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), textField.getBorder()));
|
||||
textField.setOneLineMode(false);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
<orderEntry type="module" module-name="lang-impl" />
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
<orderEntry type="module" module-name="vcs-log-graph-api" />
|
||||
<orderEntry type="module" module-name="testFramework" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="KotlinJavaRuntime" level="project" />
|
||||
|
||||
+6
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011 Bas Leijdekkers
|
||||
* Copyright 2011-2015 Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,6 +60,11 @@ public class EmptyDirectoryInspection extends BaseGlobalInspection {
|
||||
"onlyReportDirectoriesUnderSourceRoots");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGraphNeeded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runInspection(@NotNull final AnalysisScope scope, @NotNull final InspectionManager manager,
|
||||
@NotNull final GlobalInspectionContext context,
|
||||
|
||||
+6
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2011 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2006-2015 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.
|
||||
@@ -58,12 +58,16 @@ public class PackageWithTooFewClassesInspection extends BaseGlobalInspection {
|
||||
return null;
|
||||
}
|
||||
int numClasses = 0;
|
||||
boolean subpackage = false;
|
||||
for (RefEntity child : children) {
|
||||
if (child instanceof RefClass) {
|
||||
numClasses++;
|
||||
}
|
||||
else if (child instanceof RefPackage) {
|
||||
subpackage = true;
|
||||
}
|
||||
}
|
||||
if (numClasses >= limit || numClasses == 0) {
|
||||
if (numClasses >= limit || (numClasses == 0 && subpackage)) {
|
||||
return null;
|
||||
}
|
||||
final String errorString = InspectionGadgetsBundle.message(
|
||||
|
||||
+4
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2010 Bas Leijdekkers
|
||||
* Copyright 2006-2015 Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,16 +25,14 @@ public class SynchronizationUtil {
|
||||
|
||||
public static boolean isInSynchronizedContext(PsiElement element) {
|
||||
final PsiElement context =
|
||||
PsiTreeUtil.getParentOfType(element, PsiMethod.class,
|
||||
PsiSynchronizedStatement.class);
|
||||
PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiSynchronizedStatement.class, PsiClass.class, PsiLambdaExpression.class);
|
||||
if (context instanceof PsiSynchronizedStatement) {
|
||||
return true;
|
||||
}
|
||||
if (context == null) {
|
||||
if (!(context instanceof PsiMethod)) {
|
||||
return false;
|
||||
}
|
||||
final PsiModifierListOwner modifierListOwner =
|
||||
(PsiModifierListOwner)context;
|
||||
final PsiModifierListOwner modifierListOwner = (PsiModifierListOwner)context;
|
||||
return modifierListOwner.hasModifierProperty(PsiModifier.SYNCHRONIZED);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.siyeh.igtest.threading.call_to_native_method_while_locked;
|
||||
|
||||
public class CallToNativeMethodWhileLocked {
|
||||
|
||||
synchronized void a() {
|
||||
Double.<warning descr="Call to native method 'doubleToLongBits()' in a synchronized context">doubleToLongBits</warning>(9.7);
|
||||
Runnable r = () -> {
|
||||
Double.doubleToLongBits(123.4);
|
||||
};
|
||||
new Object() {
|
||||
long l = Double.doubleToLongBits(42.0);
|
||||
};
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2000-2015 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.siyeh.ig.threading;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class CallToNativeMethodWhileLockedInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void testCallToNativeMethodWhileLocked() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new CallToNativeMethodWhileLockedInspection();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,5 @@
|
||||
<orderEntry type="module" module-name="openapi" />
|
||||
<orderEntry type="library" name="Velocity" level="project" />
|
||||
<orderEntry type="module" module-name="xml" />
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -17,14 +17,7 @@
|
||||
package com.maddyhome.idea.copyright.ui;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.EditorSettings;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.EditorFontType;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -32,10 +25,9 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.NamedConfigurable;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.VcsConfiguration;
|
||||
import com.intellij.spellchecker.ui.SpellCheckingEditorCustomization;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.util.DocumentUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.maddyhome.idea.copyright.CopyrightManager;
|
||||
import com.maddyhome.idea.copyright.CopyrightProfile;
|
||||
import com.maddyhome.idea.copyright.pattern.EntityUtil;
|
||||
@@ -73,7 +65,7 @@ public class CopyrightConfigurable extends NamedConfigurable<CopyrightProfile> {
|
||||
myCopyrightProfile = copyrightProfile;
|
||||
myDisplayName = myCopyrightProfile.getName();
|
||||
final Set<EditorCustomization> features = new HashSet<EditorCustomization>();
|
||||
features.add(SpellCheckingEditorCustomization.ENABLED);
|
||||
ContainerUtil.addIfNotNull(features, SpellCheckingEditorCustomizationProvider.getInstance().getEnabledCustomization());
|
||||
features.add(SoftWrapsEditorCustomization.ENABLED);
|
||||
features.add(AdditionalPageAtBottomEditorCustomization.DISABLED);
|
||||
EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class);
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
<orderEntry type="library" scope="TEST" name="cucumber-jvm" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="cucumber-java" level="project" />
|
||||
<orderEntry type="library" name="JSch" level="project" />
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
<orderEntry type="module" module-name="cucumber-test-runner" scope="TEST" />
|
||||
<orderEntry type="module" module-name="vcs-log-api" />
|
||||
<orderEntry type="module" module-name="vcs-log-impl" />
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.dvcs.DvcsUtil;
|
||||
import com.intellij.dvcs.push.ui.VcsPushDialog;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -37,7 +38,7 @@ import com.intellij.openapi.vcs.checkin.CheckinChangeListSpecificComponent;
|
||||
import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
|
||||
import com.intellij.openapi.vcs.ui.RefreshableOnComponent;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.spellchecker.ui.SpellCheckingEditorCustomization;
|
||||
import com.intellij.ui.EditorCustomization;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import com.intellij.ui.StringComboboxEditor;
|
||||
import com.intellij.util.*;
|
||||
@@ -616,7 +617,10 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
|
||||
myAuthorField.setEditor(comboboxEditor);
|
||||
EditorEx editor = (EditorEx)comboboxEditor.getEditor();
|
||||
assert editor != null;
|
||||
SpellCheckingEditorCustomization.getInstance(false).customize(editor);
|
||||
EditorCustomization customization = SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization();
|
||||
if (customization != null) {
|
||||
customization.customize(editor);
|
||||
}
|
||||
}
|
||||
};
|
||||
myAuthorField.setMinimumAndPreferredWidth(100);
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
|
||||
*/
|
||||
public class GroovySpellcheckingStrategy extends SpellcheckingStrategy {
|
||||
private final GrDocCommentTokenizer myDocCommentTokenizer = new GrDocCommentTokenizer();
|
||||
private final Tokenizer<PsiElement> myStringTokenizer = new Tokenizer<PsiElement>() {
|
||||
private final Tokenizer<PsiElement> myStringTokenizer = new EscapeSequenceTokenizer<PsiElement>() {
|
||||
@Override
|
||||
public void tokenize(@NotNull PsiElement literal, TokenConsumer consumer) {
|
||||
String text = GrStringUtil.removeQuotes(literal.getText());
|
||||
@@ -43,7 +43,7 @@ public class GroovySpellcheckingStrategy extends SpellcheckingStrategy {
|
||||
StringBuilder unescapedText = new StringBuilder();
|
||||
int[] offsets = new int[text.length() + 1];
|
||||
GrStringUtil.parseStringCharacters(text, unescapedText, offsets);
|
||||
EscapeSequenceTokenizer.processTextWithOffsets(literal, consumer, unescapedText, offsets, GrStringUtil.getStartQuote(literal.getText()).length());
|
||||
processTextWithOffsets(literal, consumer, unescapedText, offsets, GrStringUtil.getStartQuote(literal.getText()).length());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+18
-15
@@ -43,19 +43,22 @@ import java.util.*;
|
||||
public class InconsistentResourceBundleInspection extends GlobalSimpleInspectionTool {
|
||||
private static final Key<Set<ResourceBundle>> VISITED_BUNDLES_KEY = Key.create("VISITED_BUNDLES_KEY");
|
||||
|
||||
private final InconsistentResourceBundleInspectionProvider[] myInspectionProviders;
|
||||
private final NotNullLazyValue<InconsistentResourceBundleInspectionProvider[]> myInspectionProviders =
|
||||
new NotNullLazyValue<InconsistentResourceBundleInspectionProvider[]>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected InconsistentResourceBundleInspectionProvider[] compute() {
|
||||
return new InconsistentResourceBundleInspectionProvider[] {
|
||||
new PropertiesKeysConsistencyInspectionProvider(),
|
||||
new DuplicatedPropertiesInspectionProvider(),
|
||||
new MissingTranslationsInspectionProvider(),
|
||||
new PropertiesPlaceholdersInspectionProvider(),
|
||||
new InconsistentPropertiesEndsInspectionProvider(),
|
||||
};
|
||||
}
|
||||
};
|
||||
private final Map<String, Boolean> mySettings = new LinkedHashMap<String, Boolean>();
|
||||
|
||||
public InconsistentResourceBundleInspection() {
|
||||
myInspectionProviders = new InconsistentResourceBundleInspectionProvider[] {
|
||||
new PropertiesKeysConsistencyInspectionProvider(),
|
||||
new DuplicatedPropertiesInspectionProvider(),
|
||||
new MissingTranslationsInspectionProvider(),
|
||||
new PropertiesPlaceholdersInspectionProvider(),
|
||||
new InconsistentPropertiesEndsInspectionProvider(),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getGroupDisplayName() {
|
||||
@@ -99,7 +102,7 @@ public class InconsistentResourceBundleInspection extends GlobalSimpleInspection
|
||||
}
|
||||
}
|
||||
});
|
||||
for (final InconsistentResourceBundleInspectionProvider provider : myInspectionProviders) {
|
||||
for (final InconsistentResourceBundleInspectionProvider provider : myInspectionProviders.getValue()) {
|
||||
panel.addCheckbox(provider.getPresentableName(), provider.getName());
|
||||
}
|
||||
return panel;
|
||||
@@ -170,7 +173,7 @@ public class InconsistentResourceBundleInspection extends GlobalSimpleInspection
|
||||
}
|
||||
keysUpToParent.put(f, keys);
|
||||
}
|
||||
for (final InconsistentResourceBundleInspectionProvider provider : myInspectionProviders) {
|
||||
for (final InconsistentResourceBundleInspectionProvider provider : myInspectionProviders.getValue()) {
|
||||
if (isProviderEnabled(provider.getName())) {
|
||||
provider.check(parents, files, keysUpToParent, propertiesFilesNamesMaps, manager, globalContext.getRefManager(),
|
||||
problemDescriptionsProcessor);
|
||||
@@ -185,7 +188,7 @@ public class InconsistentResourceBundleInspection extends GlobalSimpleInspection
|
||||
@TestOnly
|
||||
public void enableProviders(final Class<? extends InconsistentResourceBundleInspectionProvider>... providerClasses) {
|
||||
Set<Class<? extends InconsistentResourceBundleInspectionProvider>> providersToEnable = ContainerUtil.newHashSet(providerClasses);
|
||||
for (InconsistentResourceBundleInspectionProvider inspectionProvider : myInspectionProviders) {
|
||||
for (InconsistentResourceBundleInspectionProvider inspectionProvider : myInspectionProviders.getValue()) {
|
||||
if (providersToEnable.contains(inspectionProvider.getClass())) {
|
||||
mySettings.put(inspectionProvider.getName(), true);
|
||||
}
|
||||
@@ -194,7 +197,7 @@ public class InconsistentResourceBundleInspection extends GlobalSimpleInspection
|
||||
|
||||
@TestOnly
|
||||
public void disableAllProviders() {
|
||||
for (InconsistentResourceBundleInspectionProvider inspectionProvider : myInspectionProviders) {
|
||||
for (InconsistentResourceBundleInspectionProvider inspectionProvider : myInspectionProviders.getValue()) {
|
||||
mySettings.put(inspectionProvider.getName(), false);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-8
@@ -20,36 +20,40 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.spellchecker.LiteralExpressionTokenizer;
|
||||
import com.intellij.spellchecker.inspections.Splitter;
|
||||
import com.intellij.spellchecker.tokenizer.TokenConsumer;
|
||||
import org.junit.Test;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.Consumer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.testFramework.UsefulTestCase.assertOrderedEquals;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class LiteralExpressionTokenizerTest {
|
||||
private static class TokenCollector extends TokenConsumer {
|
||||
public class LiteralExpressionTokenizerTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
private static class TokenCollector extends TokenConsumer implements Consumer<TextRange> {
|
||||
private final List<String> myTokenTexts = new ArrayList<String>();
|
||||
private String myText;
|
||||
|
||||
@Override
|
||||
public void consumeToken(PsiElement element, String text, boolean useRename, int offset, TextRange rangeToCheck, Splitter splitter) {
|
||||
myTokenTexts.add(text);
|
||||
myText = text;
|
||||
splitter.split(myText, rangeToCheck, this);
|
||||
}
|
||||
|
||||
public List<String> getTokenTexts() {
|
||||
return myTokenTexts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(TextRange range) {
|
||||
myTokenTexts.add(myText.substring(range.getStartOffset(), range.getEndOffset()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEscapeSequences() {
|
||||
doTest("hello\\nworld", "hello", "world");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEscapeSequences2() {
|
||||
doTest("\\nhello\\nworld\\n", "hello", "world");
|
||||
}
|
||||
|
||||
+12
-2
@@ -40,8 +40,18 @@ public class JUnitConsoleProperties extends JavaAwareTestConsoleProperties<JUnit
|
||||
@NotNull
|
||||
@Override
|
||||
protected GlobalSearchScope initScope() {
|
||||
final SourceScope sourceScope = myConfiguration.getPersistentData().getScope().getSourceScope(myConfiguration);
|
||||
return sourceScope != null ? sourceScope.getGlobalSearchScope() : GlobalSearchScope.allScope(getProject());
|
||||
final JUnitConfiguration.Data persistentData = myConfiguration.getPersistentData();
|
||||
final String testObject = persistentData.TEST_OBJECT;
|
||||
//ignore invisible setting
|
||||
if (JUnitConfiguration.TEST_CATEGORY.equals(testObject) ||
|
||||
JUnitConfiguration.TEST_PATTERN.equals(testObject) ||
|
||||
JUnitConfiguration.TEST_PACKAGE.equals(testObject)) {
|
||||
final SourceScope sourceScope = persistentData.getScope().getSourceScope(myConfiguration);
|
||||
return sourceScope != null ? sourceScope.getGlobalSearchScope() : GlobalSearchScope.allScope(getProject());
|
||||
}
|
||||
else {
|
||||
return super.initScope();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-24
@@ -64,9 +64,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
|
||||
|
||||
"##teamcity[enteredTheMatrix]\n" +
|
||||
"\n" +
|
||||
"##teamcity[rootName name = 'root']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='root']\n" +
|
||||
"##teamcity[testSuiteStarted name ='TestA']\n" +
|
||||
"##teamcity[testSuiteStarted name ='|[0|]']\n" +
|
||||
@@ -91,9 +89,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='testName|[1|]']\n" +
|
||||
"##teamcity[testSuiteFinished name='|[1|]']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='TestB']\n" +
|
||||
"\n");
|
||||
"##teamcity[testSuiteFinished name='TestB']\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -112,9 +108,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
"##teamcity[suiteTreeEnded name='|[1|]']\n",
|
||||
//start
|
||||
"##teamcity[enteredTheMatrix]\n" +
|
||||
"\n" +
|
||||
"##teamcity[rootName name = 'TestA' comment = 'a']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteStarted name ='|[0|]']\n" +
|
||||
"##teamcity[testStarted name='testName|[0|]' locationHint='java:test://a.TestA.testName|[0|]']\n" +
|
||||
"\n" +
|
||||
@@ -125,9 +119,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='testName|[1|]']\n" +
|
||||
"##teamcity[testSuiteFinished name='|[1|]']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='TestA']\n" +
|
||||
"\n");
|
||||
"##teamcity[testSuiteFinished name='TestA']\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -161,9 +153,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
|
||||
//started
|
||||
"##teamcity[enteredTheMatrix]\n" +
|
||||
"\n" +
|
||||
"##teamcity[rootName name = 'root']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='root']\n" +
|
||||
"##teamcity[testSuiteStarted name ='ASuite1']\n" +
|
||||
"##teamcity[testSuiteStarted name ='ATest']\n" +
|
||||
@@ -178,9 +168,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='test1']\n" +
|
||||
"##teamcity[testSuiteFinished name='ATest']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='ASuite2']\n" +
|
||||
"\n");
|
||||
"##teamcity[testSuiteFinished name='ASuite2']\n");
|
||||
}
|
||||
|
||||
private static void doTest(Description root, List<Description> tests, String expectedTree, String expectedStart) throws Exception {
|
||||
@@ -244,9 +232,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
|
||||
//start
|
||||
"##teamcity[enteredTheMatrix]\n" +
|
||||
"\n" +
|
||||
"##teamcity[rootName name = 'root']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='root']\n" +
|
||||
"##teamcity[testSuiteStarted name ='ATest']\n" +
|
||||
"##teamcity[testSuiteStarted name ='|[0|]']\n" +
|
||||
@@ -266,9 +252,7 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='test']\n" +
|
||||
"##teamcity[testSuiteFinished name='ATest']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testSuiteFinished name='suite']\n" +
|
||||
"\n");
|
||||
"##teamcity[testSuiteFinished name='suite']\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -304,13 +288,10 @@ public class JUnitTreeByDescriptionHierarchyTest {
|
||||
|
||||
|
||||
"##teamcity[enteredTheMatrix]\n" +
|
||||
"\n" +
|
||||
"##teamcity[rootName name = 'TestA']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testStarted name='warning' locationHint='java:test://junit.framework.TestSuite$1.warning']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='warning']\n" +
|
||||
"##teamcity[testSuiteFinished name='TestA']\n" +
|
||||
"\n");
|
||||
"##teamcity[testSuiteFinished name='TestA']\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class JUnit3IdeaTestRunner extends TestRunner implements IdeaTestRunner {
|
||||
public int startRunnerWithArgs(String[] args, ArrayList listeners, String name, int count, boolean sendTree) {
|
||||
myListeners = listeners;
|
||||
mySendTree = sendTree && !(myTestsListener instanceof SMTestListener);
|
||||
if (sendTree) {
|
||||
if (mySendTree) {
|
||||
setPrinter(new TimeSender(myRegistry));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -51,9 +51,14 @@ public class JUnit4IdeaTestRunner implements IdeaTestRunner {
|
||||
else if (request instanceof FilterRequest) {
|
||||
description = getFilteredDescription(request, description);
|
||||
}
|
||||
TreeSender.sendTree(this, description, sendTree);
|
||||
if (myTestsListener instanceof SMTestSender && sendTree) {
|
||||
((SMTestSender)myTestsListener).sendTree(description);
|
||||
|
||||
if (myTestsListener instanceof SMTestSender) {
|
||||
if (sendTree) {
|
||||
((SMTestSender)myTestsListener).sendTree(description);
|
||||
}
|
||||
sendTree = false;
|
||||
} else {
|
||||
TreeSender.sendTree(this, description, sendTree);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SMTestSender extends RunListener {
|
||||
}
|
||||
|
||||
public void testRunStarted(Description description) throws Exception {
|
||||
myPrintStream.println("##teamcity[enteredTheMatrix]\n");
|
||||
myPrintStream.println("##teamcity[enteredTheMatrix]");
|
||||
if (myCurrentClassName != null && !myCurrentClassName.startsWith("[")) {
|
||||
int lastPointIdx = myCurrentClassName.lastIndexOf('.');
|
||||
String name = myCurrentClassName;
|
||||
@@ -73,20 +73,20 @@ public class SMTestSender extends RunListener {
|
||||
|
||||
myPrintStream.println("##teamcity[rootName name = \'" + escapeName(name) +
|
||||
(comment != null ? ("\' comment = \'" + escapeName(comment)) : "") +
|
||||
"\']\n");
|
||||
"\']");
|
||||
myCurrentClassName = getShortName(myCurrentClassName);
|
||||
}
|
||||
}
|
||||
|
||||
public void testRunFinished(Result result) throws Exception {
|
||||
if (myParamName != null) {
|
||||
myPrintStream.println("##teamcity[testSuiteFinished name=\'" + escapeName(myParamName) + "\']\n");
|
||||
myPrintStream.println("##teamcity[testSuiteFinished name=\'" + escapeName(myParamName) + "\']");
|
||||
}
|
||||
if (myCurrentClassName != null) {
|
||||
myPrintStream.println("##teamcity[testSuiteFinished name=\'" + escapeName(myCurrentClassName) + "\']\n");
|
||||
myPrintStream.println("##teamcity[testSuiteFinished name=\'" + escapeName(myCurrentClassName) + "\']");
|
||||
}
|
||||
if (myCurrentSuiteName != null) {
|
||||
myPrintStream.println("##teamcity[testSuiteFinished name=\'" + escapeName(getShortName(myCurrentSuiteName)) + "\']\n");
|
||||
myPrintStream.println("##teamcity[testSuiteFinished name=\'" + escapeName(getShortName(myCurrentSuiteName)) + "\']");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ public class JUnitStarter {
|
||||
}
|
||||
}
|
||||
testRunner.setStreams(out, err, 0);
|
||||
return testRunner.startRunnerWithArgs(args, listeners, name, ourCount, !SM_RUNNER);
|
||||
return testRunner.startRunnerWithArgs(args, listeners, name, ourCount, true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
|
||||
@@ -39,7 +39,14 @@ public class TestNGConsoleProperties extends JavaAwareTestConsoleProperties<Test
|
||||
@NotNull
|
||||
@Override
|
||||
protected GlobalSearchScope initScope() {
|
||||
return myConfiguration.getPersistantData().getScope().getSourceScope(myConfiguration).getGlobalSearchScope();
|
||||
final String testObject = myConfiguration.getPersistantData().TEST_OBJECT;
|
||||
if (TestType.CLASS.getType().equals(testObject) ||
|
||||
TestType.METHOD.getType().equals(testObject)) {
|
||||
return super.initScope();
|
||||
}
|
||||
else {
|
||||
return myConfiguration.getPersistantData().getScope().getSourceScope(myConfiguration).getGlobalSearchScope();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+11
-2
@@ -40,7 +40,9 @@ public class TestNGTreeHierarchyTest {
|
||||
test.getClasses().add(xmlClass);
|
||||
suite.getTests().add(test);
|
||||
|
||||
doTest(suite, "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
|
||||
doTest(suite, "\n" +
|
||||
"##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testStarted name='test1' locationHint='java:test://a.ATest.test1']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='test1']\n");
|
||||
@@ -60,22 +62,29 @@ public class TestNGTreeHierarchyTest {
|
||||
}
|
||||
listener.onSuiteFinish(className);
|
||||
|
||||
Assert.assertEquals("output: " + buf, "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
|
||||
Assert.assertEquals("output: " + buf, "\n" +
|
||||
"##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testStarted name='setUp' locationHint='java:test://a.ATest.setUp']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='setUp']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testStarted name='test1' locationHint='java:test://a.ATest.test1']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='test1']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testStarted name='tearDown' locationHint='java:test://a.ATest.tearDown']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='tearDown']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testStarted name='setUp' locationHint='java:test://a.ATest.setUp']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='setUp']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testStarted name='test2' locationHint='java:test://a.ATest.test2']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='test2']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testStarted name='tearDown' locationHint='java:test://a.ATest.tearDown']\n" +
|
||||
"\n" +
|
||||
"##teamcity[testFinished name='tearDown']\n" +
|
||||
|
||||
@@ -106,7 +106,7 @@ public class IDEATestNGRemoteListener implements ISuiteListener, IResultListener
|
||||
if (myCurrentClassName != null) {
|
||||
onSuiteFinish(myCurrentClassName);
|
||||
}
|
||||
myPrintStream.print("##teamcity[testSuiteStarted name =\'" + escapeName(provideLocation ? getShortName(suiteName) : suiteName));
|
||||
myPrintStream.print("\n##teamcity[testSuiteStarted name =\'" + escapeName(provideLocation ? getShortName(suiteName) : suiteName));
|
||||
if (provideLocation) {
|
||||
myPrintStream.print("\' locationHint = \'java:suite://" + suiteName);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class IDEATestNGRemoteListener implements ISuiteListener, IResultListener
|
||||
}
|
||||
|
||||
private void fireTestStarted(String methodName, String className) {
|
||||
myPrintStream.println("##teamcity[testStarted name=\'" + escapeName(methodName) +
|
||||
myPrintStream.println("\n##teamcity[testStarted name=\'" + escapeName(methodName) +
|
||||
"\' locationHint=\'java:test://" + escapeName(className + "." + methodName) + "\']");
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,14 @@
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider"
|
||||
serviceImplementation="com.intellij.spellchecker.ui.SpellCheckingEditorCustomizationProviderImpl"
|
||||
overrides="true"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.spellchecker.settings.SpellCheckerSettings"
|
||||
serviceImplementation="com.intellij.spellchecker.settings.SpellCheckerSettings"/>
|
||||
<projectService serviceInterface="com.intellij.spellchecker.SpellCheckerManager"
|
||||
serviceImplementation="com.intellij.spellchecker.SpellCheckerManager"/>
|
||||
<editorCustomization implementation="com.intellij.spellchecker.ui.SpellCheckingEditorCustomization"/>
|
||||
<projectConfigurable groupId="editor" instance="com.intellij.spellchecker.settings.SpellCheckerSettingsManager" id="reference.settings.ide.settings.spelling" key="spelling" bundle="com.intellij.spellchecker.util.SpellCheckerBundle" />
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.spellchecker.inspections;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jdom.Verifier;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -53,21 +52,6 @@ public class PlainTextSplitter extends BaseSplitter {
|
||||
if (text == null || StringUtil.isEmpty(text)) {
|
||||
return;
|
||||
}
|
||||
String substring = range.substring(text);
|
||||
if (Verifier.checkCharacterData(substring) != null) {
|
||||
return;
|
||||
}
|
||||
//for(int i = 0; i < text.length(); ++i) {
|
||||
// final char ch = text.charAt(i);
|
||||
// if (ch >= '\u3040' && ch <= '\u309f' || // Hiragana
|
||||
// ch >= '\u30A0' && ch <= '\u30ff' || // Katakana
|
||||
// ch >= '\u4E00' && ch <= '\u9FFF' || // CJK Unified ideographs
|
||||
// ch >= '\uF900' && ch <= '\uFAFF' || // CJK Compatibility Ideographs
|
||||
// ch >= '\uFF00' && ch <= '\uFFEF' //Halfwidth and Fullwidth Forms of Katakana & Fullwidth ASCII variants
|
||||
// ) {
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
final TextSplitter ws = TextSplitter.getInstance();
|
||||
int from = range.getStartOffset();
|
||||
|
||||
+17
-9
@@ -160,9 +160,13 @@ public class SpellCheckingInspection extends LocalInspectionTool {
|
||||
tokenizer.tokenize(element, consumer);
|
||||
}
|
||||
|
||||
private static void addBatchDescriptor(PsiElement element, int offset, @NotNull TextRange textRange, @NotNull ProblemsHolder holder) {
|
||||
private static void addBatchDescriptor(PsiElement element,
|
||||
int offset,
|
||||
@NotNull TextRange textRange,
|
||||
@NotNull ProblemsHolder holder,
|
||||
String wordWithTypo) {
|
||||
SpellCheckerQuickFix[] fixes = SpellcheckingStrategy.getDefaultBatchFixes();
|
||||
ProblemDescriptor problemDescriptor = createProblemDescriptor(element, offset, textRange, holder, fixes, false);
|
||||
ProblemDescriptor problemDescriptor = createProblemDescriptor(element, offset, textRange, holder, fixes, false, wordWithTypo);
|
||||
holder.registerProblem(problemDescriptor);
|
||||
}
|
||||
|
||||
@@ -174,19 +178,23 @@ public class SpellCheckingInspection extends LocalInspectionTool {
|
||||
? strategy.getRegularFixes(element, offset, textRange, useRename, wordWithTypo)
|
||||
: SpellcheckingStrategy.getDefaultRegularFixes(useRename, wordWithTypo);
|
||||
|
||||
final ProblemDescriptor problemDescriptor = createProblemDescriptor(element, offset, textRange, holder, fixes, true);
|
||||
final ProblemDescriptor problemDescriptor = createProblemDescriptor(element, offset, textRange, holder, fixes, true, wordWithTypo);
|
||||
holder.registerProblem(problemDescriptor);
|
||||
}
|
||||
|
||||
private static ProblemDescriptor createProblemDescriptor(PsiElement element, int offset, TextRange textRange, ProblemsHolder holder,
|
||||
SpellCheckerQuickFix[] fixes,
|
||||
boolean onTheFly) {
|
||||
final String description = SpellCheckerBundle.message("typo.in.word.ref");
|
||||
final TextRange highlightRange = TextRange.from(offset + textRange.getStartOffset(), textRange.getLength());
|
||||
assert highlightRange.getStartOffset()>=0;
|
||||
boolean onTheFly, String wordWithTypo) {
|
||||
SpellcheckingStrategy strategy = getSpellcheckingStrategy(element, element.getLanguage());
|
||||
final Tokenizer tokenizer = strategy != null ? strategy.getTokenizer(element) : null;
|
||||
if (tokenizer != null) {
|
||||
textRange = tokenizer.getHighlightingRange(element, offset, textRange);
|
||||
}
|
||||
assert textRange.getStartOffset() >= 0;
|
||||
|
||||
final String description = SpellCheckerBundle.message("typo.in.word.ref", wordWithTypo);
|
||||
return holder.getManager()
|
||||
.createProblemDescriptor(element, highlightRange, description, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, onTheFly, fixes);
|
||||
.createProblemDescriptor(element, textRange, description, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, onTheFly, fixes);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"PublicField"})
|
||||
@@ -266,7 +274,7 @@ public class SpellCheckingInspection extends LocalInspectionTool {
|
||||
}
|
||||
else {
|
||||
myAlreadyChecked.add(word);
|
||||
addBatchDescriptor(myElement, myOffset, textRange, myHolder);
|
||||
addBatchDescriptor(myElement, myOffset, textRange, myHolder, word);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,42 +15,35 @@
|
||||
*/
|
||||
package com.intellij.spellchecker.tokenizer;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.spellchecker.inspections.PlainTextSplitter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class EscapeSequenceTokenizer {
|
||||
public abstract class EscapeSequenceTokenizer<T extends PsiElement> extends Tokenizer<T> {
|
||||
private static Key<int[]> ESCAPE_OFFSETS = Key.create("escape.tokenizer.offsets");
|
||||
|
||||
public static void processTextWithOffsets(PsiElement element, TokenConsumer consumer, StringBuilder unescapedText,
|
||||
int[] offsets, int startOffset) {
|
||||
StringBuilder currentToken = new StringBuilder();
|
||||
int currentTokenStart = startOffset;
|
||||
for (int i = 0; i < unescapedText.length(); i++) {
|
||||
if (offsets[i+1]-offsets[i] == 1 || !Character.isWhitespace(unescapedText.charAt(i))) {
|
||||
if (currentToken.length() == 0) {
|
||||
currentTokenStart = offsets[i] + startOffset;
|
||||
}
|
||||
currentToken.append(unescapedText.charAt(i));
|
||||
}
|
||||
else {
|
||||
if (currentToken.length() > 0) {
|
||||
processCurrentToken(element, currentToken, currentTokenStart, consumer);
|
||||
currentToken.setLength(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentToken.length() > 0) {
|
||||
processCurrentToken(element, currentToken, currentTokenStart, consumer);
|
||||
}
|
||||
if (element != null) element.putUserData(ESCAPE_OFFSETS, offsets);
|
||||
final String text = unescapedText.toString();
|
||||
consumer.consumeToken(element, text, false, startOffset, TextRange.allOf(text), PlainTextSplitter.getInstance());
|
||||
if (element != null) element.putUserData(ESCAPE_OFFSETS, null);
|
||||
}
|
||||
|
||||
private static void processCurrentToken(PsiElement element,
|
||||
StringBuilder currentToken,
|
||||
int currentTokenStart, TokenConsumer consumer) {
|
||||
final String token = currentToken.toString();
|
||||
// +1 for the starting quote of the string literal
|
||||
consumer.consumeToken(element, token, false, currentTokenStart, TextRange.allOf(token), PlainTextSplitter.getInstance());
|
||||
@NotNull
|
||||
public TextRange getHighlightingRange(PsiElement element, int offset, TextRange range) {
|
||||
final int[] offsets = element.getUserData(ESCAPE_OFFSETS);
|
||||
if (offsets != null) {
|
||||
int start = offsets[range.getStartOffset()];
|
||||
int end = offsets[range.getEndOffset()];
|
||||
|
||||
return new TextRange(offset + start, offset + end);
|
||||
}
|
||||
return super.getHighlightingRange(element, offset, range);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,16 @@
|
||||
*/
|
||||
package com.intellij.spellchecker.tokenizer;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class Tokenizer<T extends PsiElement> {
|
||||
|
||||
public abstract void tokenize(@NotNull T element, TokenConsumer consumer);
|
||||
|
||||
@NotNull
|
||||
public TextRange getHighlightingRange(PsiElement element, int offset, TextRange textRange) {
|
||||
return TextRange.from(offset + textRange.getStartOffset(), textRange.getLength());
|
||||
}
|
||||
}
|
||||
|
||||
+11
-4
@@ -22,6 +22,7 @@ import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.ex.InspectionProfileImpl;
|
||||
import com.intellij.codeInspection.ex.InspectionProfileWrapper;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
@@ -45,19 +46,25 @@ import java.util.Map;
|
||||
* @since Aug 20, 2010 3:54:42 PM
|
||||
*/
|
||||
public class SpellCheckingEditorCustomization extends SimpleEditorCustomization {
|
||||
/**
|
||||
* @deprecated use {@link SpellCheckingEditorCustomizationProvider#getEnabledCustomization()} instead
|
||||
*/
|
||||
public static final SpellCheckingEditorCustomization ENABLED = (SpellCheckingEditorCustomization)SpellCheckingEditorCustomizationProvider.getInstance().getEnabledCustomization();
|
||||
|
||||
public static final SpellCheckingEditorCustomization ENABLED = new SpellCheckingEditorCustomization(true);
|
||||
public static final SpellCheckingEditorCustomization DISABLED = new SpellCheckingEditorCustomization(false);
|
||||
/**
|
||||
* @deprecated use {@link SpellCheckingEditorCustomizationProvider#getDisabledCustomization()} instead
|
||||
*/
|
||||
public static final SpellCheckingEditorCustomization DISABLED = (SpellCheckingEditorCustomization)SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization();
|
||||
|
||||
private static final Map<String, LocalInspectionToolWrapper> SPELL_CHECK_TOOLS = new HashMap<String, LocalInspectionToolWrapper>();
|
||||
private static final boolean READY = init();
|
||||
|
||||
@NotNull
|
||||
public static SpellCheckingEditorCustomization getInstance(boolean enabled) {
|
||||
return enabled ? ENABLED : DISABLED;
|
||||
return (SpellCheckingEditorCustomization)SpellCheckingEditorCustomizationProvider.getInstance().getCustomization(enabled);
|
||||
}
|
||||
|
||||
private SpellCheckingEditorCustomization(boolean enabled) {
|
||||
SpellCheckingEditorCustomization(boolean enabled) {
|
||||
super(enabled);
|
||||
}
|
||||
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2000-2015 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.spellchecker.ui;
|
||||
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.ui.EditorCustomization;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class SpellCheckingEditorCustomizationProviderImpl extends SpellCheckingEditorCustomizationProvider {
|
||||
private static final SpellCheckingEditorCustomization ENABLED = new SpellCheckingEditorCustomization(true);
|
||||
private static final SpellCheckingEditorCustomization DISABLED = new SpellCheckingEditorCustomization(false);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EditorCustomization getEnabledCustomization() {
|
||||
return ENABLED;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EditorCustomization getDisabledCustomization() {
|
||||
return DISABLED;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ rename.to=Typo: Rename to...
|
||||
spelling=Spelling
|
||||
spellchecking.inspection.name=Typo
|
||||
comments.with.mistakes=Comments with mistakes
|
||||
typo.in.word.ref=Typo: In word '#ref'
|
||||
typo.in.word.ref=Typo: In word ''{0}''
|
||||
add.0.to.dictionary=Typo: Save ''{0}'' to dictionary
|
||||
add.to.dictionary=Save to dictionary
|
||||
class.name.with.mistakes=Class name with mistakes
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@
|
||||
package com.intellij.spellchecker.ui;
|
||||
|
||||
import com.intellij.codeInspection.ex.InspectionProfileImpl;
|
||||
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.fileTypes.PlainTextFileType;
|
||||
import com.intellij.spellchecker.inspections.SpellCheckingInspection;
|
||||
@@ -47,7 +48,7 @@ public class SpellCheckingEditorCustomizationTest extends LightPlatformCodeInsig
|
||||
myFixture.configureByText(PlainTextFileType.INSTANCE, document);
|
||||
myFixture.enableInspections(new SpellCheckingInspection());
|
||||
|
||||
SpellCheckingEditorCustomization.getInstance(enabled).customize((EditorEx)myFixture.getEditor());
|
||||
SpellCheckingEditorCustomizationProvider.getInstance().getCustomization(enabled).customize((EditorEx)myFixture.getEditor());
|
||||
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user