mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
@Override
This commit is contained in:
+15
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -72,16 +72,19 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
public AttachSourcesNotificationProvider(Project project, final EditorNotifications notifications) {
|
||||
myProject = project;
|
||||
myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
|
||||
@Override
|
||||
public void rootsChanged(ModuleRootEvent event) {
|
||||
notifications.updateAllNotifications();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key<EditorNotificationPanel> getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditorNotificationPanel createNotificationPanel(final VirtualFile file, FileEditor fileEditor) {
|
||||
if (file.getFileType() != JavaClassFileType.INSTANCE) return null;
|
||||
final List<LibraryOrderEntry> libraries = findOrderEntriesContainingFile(file);
|
||||
@@ -129,6 +132,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
}
|
||||
|
||||
Collections.sort(actions, new Comparator<AttachSourcesProvider.AttachSourcesAction>() {
|
||||
@Override
|
||||
public int compare(AttachSourcesProvider.AttachSourcesAction o1, AttachSourcesProvider.AttachSourcesAction o2) {
|
||||
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||
}
|
||||
@@ -138,6 +142,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
|
||||
for (final AttachSourcesProvider.AttachSourcesAction each : actions) {
|
||||
panel.createActionLabel(GuiUtils.getTextWithoutMnemonicEscaping(each.getName()), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Comparing.equal(libraries, findOrderEntriesContainingFile(file))) {
|
||||
Messages.showErrorDialog(myProject, "Cannot find library for " + StringUtil.getShortName(fqn), "Error");
|
||||
@@ -147,8 +152,10 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
panel.setText(each.getBusyText());
|
||||
|
||||
Runnable onFinish = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
panel.setText(ProjectBundle.message("library.sources.not.found"));
|
||||
}
|
||||
@@ -178,6 +185,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
|
||||
private static void appendSources(final Library library, final VirtualFile[] files) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Library.ModifiableModel model = library.getModifiableModel();
|
||||
for (VirtualFile virtualFile : files) {
|
||||
@@ -207,10 +215,12 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
myClassFile = classFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ProjectBundle.message("module.libraries.attach.sources.immediately.button");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBusyText() {
|
||||
return ProjectBundle.message("library.attach.sources.action.busy.text");
|
||||
}
|
||||
@@ -229,6 +239,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
}
|
||||
if (modelsToCommit.isEmpty()) return new ActionCallback.Rejected();
|
||||
new WriteAction() {
|
||||
@Override
|
||||
protected void run(final Result result) {
|
||||
for (Library.ModifiableModel model : modelsToCommit) {
|
||||
model.commit();
|
||||
@@ -259,14 +270,17 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
myParentComponent = parentComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ProjectBundle.message("module.libraries.attach.sources.button");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBusyText() {
|
||||
return ProjectBundle.message("library.attach.sources.action.busy.text");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback perform(final List<LibraryOrderEntry> libraries) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createMultipleJavaPathDescriptor();
|
||||
descriptor.setTitle(ProjectBundle.message("library.attach.sources.action"));
|
||||
|
||||
+2
-1
@@ -49,6 +49,7 @@ public class SetupSDKNotificationProvider extends EditorNotifications.Provider<E
|
||||
public SetupSDKNotificationProvider(Project project, final EditorNotifications notifications) {
|
||||
myProject = project;
|
||||
myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
|
||||
@Override
|
||||
public void rootsChanged(ModuleRootEvent event) {
|
||||
notifications.updateAllNotifications();
|
||||
}
|
||||
@@ -81,7 +82,7 @@ public class SetupSDKNotificationProvider extends EditorNotifications.Provider<E
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static EditorNotificationPanel createPanel(final @NotNull Project project, final @NotNull PsiFile file) {
|
||||
private static EditorNotificationPanel createPanel(@NotNull final Project project, @NotNull final PsiFile file) {
|
||||
final EditorNotificationPanel panel = new EditorNotificationPanel();
|
||||
panel.setText(ProjectBundle.message("project.sdk.not.defined"));
|
||||
panel.createActionLabel(ProjectBundle.message("project.sdk.setup"), new Runnable() {
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -123,21 +123,21 @@ public class RemoveSuppressWarningAction implements LocalQuickFix {
|
||||
}
|
||||
else {
|
||||
PsiComment newComment = JavaPsiFacade.getInstance(comment.getProject()).getElementFactory()
|
||||
.createCommentFromText("// " + SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME+" "+newText, comment);
|
||||
.createCommentFromText("// " + SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME +" "+newText, comment);
|
||||
comment.replace(newComment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFromJavaDoc(PsiDocComment docComment) throws IncorrectOperationException {
|
||||
PsiDocTag tag = docComment.findTagByName(SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME);
|
||||
PsiDocTag tag = docComment.findTagByName(SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME);
|
||||
if (tag == null) return;
|
||||
String newText = removeFromElementText(tag.getDataElements());
|
||||
if (newText != null && newText.isEmpty()) {
|
||||
tag.delete();
|
||||
}
|
||||
else if (newText != null) {
|
||||
newText = "@" + SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME + " " + newText;
|
||||
newText = "@" + SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME + " " + newText;
|
||||
PsiDocTag newTag = JavaPsiFacade.getInstance(tag.getProject()).getElementFactory().createDocTagFromText(newText);
|
||||
tag.replace(newTag);
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class RemoveSuppressWarningAction implements LocalQuickFix {
|
||||
text += StringUtil.trimStart(element.getText(), "//").trim();
|
||||
}
|
||||
text = StringUtil.trimStart(text, "@").trim();
|
||||
text = StringUtil.trimStart(text, SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME).trim();
|
||||
text = StringUtil.trimStart(text, SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME).trim();
|
||||
List<String> ids = StringUtil.split(text, ",");
|
||||
int i = ArrayUtil.find(ids.toArray(), myID);
|
||||
if (i==-1) return null;
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.JavaSuppressionUtil;
|
||||
import com.intellij.codeInspection.SuppressionUtil;
|
||||
import com.intellij.codeInspection.SuppressionUtilCore;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
@@ -83,9 +84,9 @@ public class SuppressAllForClassFix extends SuppressFix {
|
||||
else {
|
||||
PsiDocComment docComment = container.getDocComment();
|
||||
if (docComment != null) {
|
||||
PsiDocTag noInspectionTag = docComment.findTagByName(SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME);
|
||||
PsiDocTag noInspectionTag = docComment.findTagByName(SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME);
|
||||
if (noInspectionTag != null) {
|
||||
String tagText = "@" + SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME + " " + SuppressionUtil.ALL;
|
||||
String tagText = "@" + SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME + " " + SuppressionUtil.ALL;
|
||||
noInspectionTag.replace(JavaPsiFacade.getInstance(project).getElementFactory().createDocTagFromText(tagText));
|
||||
// todo suppress
|
||||
//DaemonCodeAnalyzer.getInstance(project).restart();
|
||||
|
||||
+4
-3
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.JavaSuppressionUtil;
|
||||
import com.intellij.codeInspection.SuppressionUtil;
|
||||
import com.intellij.codeInspection.SuppressionUtilCore;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.command.undo.UndoUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -113,19 +114,19 @@ public class SuppressFix extends AbstractBatchSuppressByNoInspectionCommentFix {
|
||||
PsiDocComment docComment = container.getDocComment();
|
||||
PsiManager manager = PsiManager.getInstance(project);
|
||||
if (docComment == null) {
|
||||
String commentText = "/** @" + SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME + " " + getID(container) + "*/";
|
||||
String commentText = "/** @" + SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME + " " + getID(container) + "*/";
|
||||
docComment = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createDocCommentFromText(commentText);
|
||||
PsiElement firstChild = container.getFirstChild();
|
||||
container.addBefore(docComment, firstChild);
|
||||
}
|
||||
else {
|
||||
PsiDocTag noInspectionTag = docComment.findTagByName(SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME);
|
||||
PsiDocTag noInspectionTag = docComment.findTagByName(SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME);
|
||||
if (noInspectionTag != null) {
|
||||
String tagText = noInspectionTag.getText() + ", " + getID(container);
|
||||
noInspectionTag.replace(JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createDocTagFromText(tagText));
|
||||
}
|
||||
else {
|
||||
String tagText = "@" + SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME + " " + getID(container);
|
||||
String tagText = "@" + SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME + " " + getID(container);
|
||||
docComment.add(JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createDocTagFromText(tagText));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -23,6 +23,7 @@ package com.intellij.codeInsight.daemon;
|
||||
import com.intellij.codeInspection.ModifiableModel;
|
||||
import com.intellij.codeInspection.ex.InspectionToolWrapper;
|
||||
import com.intellij.codeInspection.javaDoc.JavaDocLocalInspection;
|
||||
import com.intellij.codeInspection.javaDoc.JavaDocLocalInspectionBase;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -52,7 +53,7 @@ public class JavaAwareInspectionProfileCoverter extends InspectionProfileConvert
|
||||
super.fillErrorLevels(profile);
|
||||
|
||||
//javadoc attributes
|
||||
final InspectionToolWrapper toolWrapper = profile.getInspectionTool(JavaDocLocalInspection.SHORT_NAME, null);
|
||||
final InspectionToolWrapper toolWrapper = profile.getInspectionTool(JavaDocLocalInspectionBase.SHORT_NAME, null);
|
||||
JavaDocLocalInspection inspection = (JavaDocLocalInspection)toolWrapper.getTool();
|
||||
inspection.myAdditionalJavadocTags = myAdditionalJavadocTags;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -50,7 +50,7 @@ import java.util.*;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class IconLineMarkerProvider implements LineMarkerProvider {
|
||||
private static final @NonNls String JAVAX_SWING_ICON = "javax.swing.Icon";
|
||||
@NonNls private static final String JAVAX_SWING_ICON = "javax.swing.Icon";
|
||||
private static final int ICON_MAX_WEIGHT = 16;
|
||||
private static final int ICON_MAX_HEIGHT = 16;
|
||||
private static final int ICON_MAX_SIZE = 2 * 1024 * 1024; //2Kb
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -298,8 +298,8 @@ public class MarkerType {
|
||||
}
|
||||
|
||||
private static class OverridingMethodsUpdater extends ListBackgroundUpdaterTask {
|
||||
private PsiMethod myMethod;
|
||||
private PsiElementListCellRenderer myRenderer;
|
||||
private final PsiMethod myMethod;
|
||||
private final PsiElementListCellRenderer myRenderer;
|
||||
|
||||
public OverridingMethodsUpdater(PsiMethod method, PsiElementListCellRenderer renderer) {
|
||||
super(method.getProject(), SEARCHING_FOR_OVERRIDING_METHODS);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -44,7 +44,7 @@ public abstract class CreateClassFromUsageBaseFix extends BaseIntentionAction {
|
||||
|
||||
protected abstract String getText(String varName);
|
||||
|
||||
private boolean isAvailableInContext(final @NotNull PsiJavaCodeReferenceElement element) {
|
||||
private boolean isAvailableInContext(@NotNull final PsiJavaCodeReferenceElement element) {
|
||||
PsiElement parent = element.getParent();
|
||||
|
||||
if (myKind == CreateClassKind.ANNOTATION) {
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ public abstract class CreateConstructorFromThisOrSuperFix extends CreateFromUsag
|
||||
PsiMethod method = (PsiMethod) methodCall.getMethodExpression().resolve();
|
||||
PsiExpressionList argumentList = methodCall.getArgumentList();
|
||||
List<PsiClass> classes = getTargetClasses(element);
|
||||
return classes.size() > 0 && !CreateFromUsageUtils.shouldCreateConstructor(classes.get(0), argumentList, method);
|
||||
return !classes.isEmpty() && !CreateFromUsageUtils.shouldCreateConstructor(classes.get(0), argumentList, method);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -198,6 +198,7 @@ public class CreateConstructorParameterFromFieldFix implements IntentionAction {
|
||||
return finalFields.put(psiVariable, Boolean.TRUE) == null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<SmartPsiElementPointer<PsiField>> iterator() {
|
||||
return finalFields.keySet().iterator();
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -82,7 +82,7 @@ public class CreatePropertyFromUsageFix extends CreateFromUsageBaseFix implement
|
||||
String methodName = myMethodCall.getMethodExpression().getReferenceName();
|
||||
LOG.assertTrue(methodName != null);
|
||||
String propertyName = PropertyUtil.getPropertyName(methodName);
|
||||
if (propertyName == null || propertyName.length() == 0) return false;
|
||||
if (propertyName == null || propertyName.isEmpty()) return false;
|
||||
|
||||
String getterOrSetter = null;
|
||||
if (methodName.startsWith(GET_PREFIX) || methodName.startsWith(IS_PREFIX)) {
|
||||
@@ -326,7 +326,7 @@ public class CreatePropertyFromUsageFix extends CreateFromUsageBaseFix implement
|
||||
JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(methodCall.getProject());
|
||||
String methodName = methodCall.getMethodExpression().getReferenceName();
|
||||
String propertyName = PropertyUtil.getPropertyName(methodName);
|
||||
if (propertyName != null && propertyName.length() > 0) {
|
||||
if (propertyName != null && !propertyName.isEmpty()) {
|
||||
VariableKind kind = isStatic ? VariableKind.STATIC_FIELD : VariableKind.FIELD;
|
||||
return codeStyleManager.propertyNameToVariableName(propertyName, kind);
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -52,7 +52,7 @@ public class LocateLibraryDialog extends DialogWrapper {
|
||||
return myResultingLibraryPath;
|
||||
}
|
||||
|
||||
public LocateLibraryDialog(Module module, String libraryPath, final @NonNls String libraryName, final String libraryDescription ) {
|
||||
public LocateLibraryDialog(Module module, String libraryPath, @NonNls final String libraryName, final String libraryDescription ) {
|
||||
super (module.getProject(), true);
|
||||
setTitle ( QuickFixBundle.message("add.library.title.dialog"));
|
||||
|
||||
@@ -108,7 +108,7 @@ public class LocateLibraryDialog extends DialogWrapper {
|
||||
if ( copyEnabled ) {
|
||||
myCopyToDir.getTextField().requestFocusInWindow();
|
||||
}
|
||||
setOKActionEnabled(! copyEnabled || myCopyToDir.getText().length() != 0 );
|
||||
setOKActionEnabled(! copyEnabled || !myCopyToDir.getText().isEmpty());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,7 +147,7 @@ public class LocateLibraryDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
final String dstDir = myCopyToDir.getText();
|
||||
if ( dstDir.length() == 0 ) {
|
||||
if (dstDir.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -91,7 +91,7 @@ public class PullAsAbstractUpFix extends LocalQuickFixAndIntentionActionOnPsiEle
|
||||
collectClassesToPullUp(manager, classesToPullUp, containingClass.getExtendsListTypes());
|
||||
collectClassesToPullUp(manager, classesToPullUp, containingClass.getImplementsListTypes());
|
||||
|
||||
if (classesToPullUp.size() == 0) {
|
||||
if (classesToPullUp.isEmpty()) {
|
||||
//check visibility
|
||||
new ExtractInterfaceHandler().invoke(project, new PsiElement[]{containingClass}, null);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class PullAsAbstractUpFix extends LocalQuickFixAndIntentionActionOnPsiEle
|
||||
final LinkedHashSet<PsiClass> classesToPullUp = new LinkedHashSet<PsiClass>();
|
||||
collectClassesToPullUp(manager, classesToPullUp, containingClass.getExtendsListTypes());
|
||||
collectClassesToPullUp(manager, classesToPullUp, containingClass.getImplementsListTypes());
|
||||
if (classesToPullUp.size() == 0) {
|
||||
if (classesToPullUp.isEmpty()) {
|
||||
name = "Extract method \'" + methodWithOverrides.getName() + "\' to new interface";
|
||||
canBePulledUp = false;
|
||||
} else if (classesToPullUp.size() == 1) {
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -139,6 +139,7 @@ public class VariableAccessFromInnerClassFix implements IntentionAction {
|
||||
return finalVars.put(psiVariable, Boolean.TRUE) == null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<PsiVariable> iterator() {
|
||||
return finalVars.keySet().iterator();
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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,11 +15,11 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiKeyword;
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiKeyword;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
|
||||
+2
-2
@@ -24,14 +24,12 @@ import com.intellij.openapi.ui.popup.PopupChooserBuilder;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.ui.ListSpeedSearch;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.Function;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -165,6 +163,7 @@ public class HighlightImportedElementsHandler extends HighlightUsagesHandlerBase
|
||||
this.myImportStatic = importStatic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
|
||||
super.visitReferenceElement(reference);
|
||||
if (!myImportStatic && reference.getText().equals(reference.getQualifiedName())) {
|
||||
@@ -283,6 +282,7 @@ public class HighlightImportedElementsHandler extends HighlightUsagesHandlerBase
|
||||
|
||||
static class PsiMemberComparator implements Comparator<PsiMember> {
|
||||
|
||||
@Override
|
||||
public int compare(PsiMember member1, PsiMember member2) {
|
||||
final String name1 = member1.getName();
|
||||
if (name1 == null) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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,9 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.refactoring.RefactorJBundle;
|
||||
import com.intellij.refactoring.psi.MyUsageViewUtil;
|
||||
import com.intellij.refactoring.ui.UsageViewDescriptorAdapter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class IntroduceParameterObjectUsageViewDescriptor extends UsageViewDescriptorAdapter {
|
||||
|
||||
@@ -30,6 +31,7 @@ class IntroduceParameterObjectUsageViewDescriptor extends UsageViewDescriptorAda
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiElement[] getElements() {
|
||||
return new PsiElement[]{method};
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -39,6 +39,7 @@ class RemoveMiddlemanUsageViewDescriptor implements UsageViewDescriptor {
|
||||
return RefactorJBundle.message("remove.middleman.field.header");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiElement[] getElements() {
|
||||
return new PsiElement[]{field};
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -34,6 +34,7 @@ class WrapReturnValueUsageViewDescriptor implements UsageViewDescriptor {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PsiElement[] getElements(){
|
||||
return new PsiElement[]{method};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,12 +18,14 @@ package com.intellij.usageView;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.lang.LangBundle;
|
||||
import com.intellij.psi.util.PsiFormatUtilBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaUsageViewDescriptionProvider implements ElementDescriptionProvider {
|
||||
@Override
|
||||
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
|
||||
if (location instanceof UsageViewShortNameLocation) {
|
||||
if (element instanceof PsiThrowStatement) {
|
||||
@@ -53,7 +55,7 @@ public class JavaUsageViewDescriptionProvider implements ElementDescriptionProvi
|
||||
else if (element instanceof PsiMethod) {
|
||||
PsiMethod psiMethod = (PsiMethod)element;
|
||||
return PsiFormatUtil.formatMethod(psiMethod, PsiSubstitutor.EMPTY,
|
||||
PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS, PsiFormatUtil.SHOW_TYPE);
|
||||
PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS, PsiFormatUtilBase.SHOW_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -20,7 +20,6 @@ import com.intellij.navigation.NavigationItemFileStatus;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.TypeSafeDataProvider;
|
||||
import com.intellij.openapi.util.Iconable;
|
||||
import com.intellij.openapi.vcs.FileStatus;
|
||||
@@ -181,7 +180,7 @@ public class ClassGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
return getText(null).compareToIgnoreCase(usageGroup.getText(null));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Date: Jan 17, 2005
|
||||
*/
|
||||
public class ImportFilteringRule extends com.intellij.usages.rules.ImportFilteringRule {
|
||||
@Override
|
||||
public boolean isVisible(@NotNull Usage usage) {
|
||||
if (usage instanceof PsiElementUsage) {
|
||||
final PsiElement psiElement = ((PsiElementUsage)usage).getElement();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaClassGroupRuleProvider implements FileStructureGroupRuleProvider {
|
||||
@Override
|
||||
public UsageGroupingRule getUsageGroupingRule(final Project project) {
|
||||
return new ClassGroupingRule();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaMethodGroupRuleProvider implements FileStructureGroupRuleProvider {
|
||||
@Override
|
||||
public UsageGroupingRule getUsageGroupingRule(final Project project) {
|
||||
return new MethodGroupingRule();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -35,6 +35,7 @@ import java.util.Set;
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaUsageTypeProvider implements UsageTypeProviderEx {
|
||||
@Override
|
||||
public UsageType getUsageType(final PsiElement element) {
|
||||
return getUsageType(element, UsageTarget.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -20,7 +20,6 @@ import com.intellij.navigation.NavigationItemFileStatus;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.TypeSafeDataProvider;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -159,7 +158,7 @@ public class MethodGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
if (!(usageGroup instanceof MethodUsageGroup)) {
|
||||
LOG.error("MethodUsageGroup expected but " + usageGroup.getClass() + " found");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
|
||||
* @author yole
|
||||
*/
|
||||
public class NonJavaFileGroupRuleProvider implements FileStructureGroupRuleProvider {
|
||||
@Override
|
||||
public UsageGroupingRule getUsageGroupingRule(final Project project) {
|
||||
return new NonJavaFileGroupingRule(project);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.usages.impl.rules;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.TypeSafeDataProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.FileStatus;
|
||||
@@ -42,6 +41,7 @@ public class PackageGroupingRule extends DirectoryGroupingRule {
|
||||
super(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UsageGroup getGroupForFile(final VirtualFile dir) {
|
||||
PsiDirectory psiDirectory = PsiManager.getInstance(myProject).findDirectory(dir);
|
||||
if (psiDirectory != null) {
|
||||
@@ -60,44 +60,53 @@ public class PackageGroupingRule extends DirectoryGroupingRule {
|
||||
update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (isValid()) {
|
||||
myIcon = myPackage.getIcon(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(boolean isOpen) {
|
||||
return myIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getText(UsageView view) {
|
||||
return myPackage.getQualifiedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileStatus getFileStatus() {
|
||||
if (!isValid()) return null;
|
||||
PsiDirectory[] dirs = myPackage.getDirectories();
|
||||
return dirs.length == 1 ? FileStatusManager.getInstance(myProject).getStatus(dirs[0].getVirtualFile()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return myPackage.isValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigate(boolean focus) throws UnsupportedOperationException {
|
||||
myPackage.navigate(focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNavigate() {
|
||||
return myPackage.canNavigate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNavigateToSource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
@Override
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
return getText(null).compareToIgnoreCase(usageGroup.getText(null));
|
||||
}
|
||||
|
||||
@@ -112,6 +121,7 @@ public class PackageGroupingRule extends DirectoryGroupingRule {
|
||||
return myPackage.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calcData(final DataKey key, final DataSink sink) {
|
||||
if (!isValid()) return;
|
||||
if (CommonDataKeys.PSI_ELEMENT == key) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -28,7 +28,6 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.*;
|
||||
import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SmartList;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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,9 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
|
||||
import com.intellij.lang.LangBundle;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.lang.LangBundle;
|
||||
import com.intellij.psi.util.PsiFormatUtilBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -49,7 +49,7 @@ public class CoreJavaFileManager implements JavaFileManager {
|
||||
@Override
|
||||
public PsiPackage findPackage(@NotNull String packageName) {
|
||||
final List<VirtualFile> files = findDirectoriesByPackageName(packageName);
|
||||
if (files.size() > 0) {
|
||||
if (!files.isEmpty()) {
|
||||
return new PsiPackageImpl(myPsiManager, packageName);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User: anna
|
||||
* Date: 27-Jun-2007
|
||||
@@ -85,7 +101,7 @@ public class AddAnnotationFixTest extends UsefulTestCase {
|
||||
addLibrary("/content/anno");
|
||||
}
|
||||
|
||||
private void addLibrary(final @NotNull String... annotationsDirs) {
|
||||
private void addLibrary(@NotNull final String... annotationsDirs) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.codeInsight.generation.actions.GenerateCreateUIAction;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -17,7 +17,8 @@ package com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.ChangeNewOperatorTypeTest;
|
||||
import com.intellij.codeInsight.daemon.quickFix.Simplify2DiamondInspectionsTest;
|
||||
import com.intellij.refactoring.*;
|
||||
import com.intellij.refactoring.IntroduceParameterTest;
|
||||
import com.intellij.refactoring.IntroduceVariableTest;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
|
||||
@@ -226,6 +226,7 @@ public class HighlightStressTest extends LightDaemonAnalyzerTestCase {
|
||||
}
|
||||
final String text = imports + "\n class X {{\n" + usages + "}}";
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getEditor().getDocument().setText(text);
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.ExtensionPoints;
|
||||
import com.intellij.ToolExtensionPoints;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.compiler.JavacQuirksInspection;
|
||||
@@ -106,7 +106,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
}
|
||||
|
||||
public void testDynamicallyAddIgnoredAnnotations() throws Exception {
|
||||
ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ExtensionPoints.DEAD_CODE_TOOL);
|
||||
ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ToolExtensionPoints.DEAD_CODE_TOOL);
|
||||
EntryPoint extension = new EntryPoint() {
|
||||
@NotNull @Override public String getDisplayName() { return "duh"; }
|
||||
@Override public boolean isEntryPoint(RefElement refElement, PsiElement psiElement) { return false; }
|
||||
|
||||
+1
-1
@@ -389,6 +389,6 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testInsane() throws IOException {
|
||||
configureFromFileText("x.java", "class X { \nxxxx\n }");
|
||||
List<HighlightInfo> infos = highlightErrors();
|
||||
assertTrue(infos.size() != 0);
|
||||
assertTrue(!infos.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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,8 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon
|
||||
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
|
||||
+5
-6
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.lambda;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.completion.LightFixtureCompletionTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
package com.intellij.codeInsight.daemon.lambda
|
||||
|
||||
import com.intellij.JavaTestUtil
|
||||
import com.intellij.codeInsight.completion.LightFixtureCompletionTestCase
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import org.jetbrains.annotations.NotNull
|
||||
/**
|
||||
* User: anna
|
||||
*/
|
||||
|
||||
+16
-1
@@ -1,8 +1,23 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
|
||||
import org.jdom.Element;
|
||||
|
||||
/**
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -21,7 +21,9 @@
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.DefaultHighlightVisitorBasedInspection;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.LanguageAnnotators;
|
||||
import com.intellij.lang.annotation.Annotation;
|
||||
|
||||
+15
-1
@@ -1,6 +1,20 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFix15TestCase;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.i18n.I18nInspection;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.codeInspection.i18n.I18nQuickFixHandler;
|
||||
@@ -32,7 +47,7 @@ public class I18nizeTest extends LightCodeInsightTestCase {
|
||||
action.update(event);
|
||||
@NonNls String afterFile = getBasePath() + "/after" + getTestName(false) + "." + ext;
|
||||
boolean afterFileExists = new File(PathManagerEx.getTestDataPath() + afterFile).exists();
|
||||
I18nQuickFixHandler handler = action.getHandler(event);
|
||||
I18nQuickFixHandler handler = I18nizeAction.getHandler(event);
|
||||
try {
|
||||
if (handler != null) {
|
||||
handler.checkApplicability(getFile(), getEditor());
|
||||
|
||||
+19
-5
@@ -1,12 +1,26 @@
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.highlighting
|
||||
|
||||
import com.intellij.JavaTestUtil
|
||||
import com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPassFactory
|
||||
import com.intellij.codeInspection.sillyAssignment.SillyAssignmentInspection
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import com.intellij.lang.annotation.HighlightSeverity
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import org.jetbrains.annotations.NonNls
|
||||
/**
|
||||
* @author cdr
|
||||
*/
|
||||
|
||||
@@ -419,6 +419,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
|
||||
protected void setupCursorAndSelection(final Editor editor) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Document document = editor.getDocument();
|
||||
final String text = document.getText();
|
||||
|
||||
+1
-1
@@ -16,8 +16,8 @@
|
||||
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author spleaner
|
||||
|
||||
@@ -88,7 +88,7 @@ public class HighlightInfo implements Segment {
|
||||
public List<Pair<IntentionActionDescriptor, TextRange>> quickFixActionRanges;
|
||||
public List<Pair<IntentionActionDescriptor, RangeMarker>> quickFixActionMarkers;
|
||||
|
||||
private GutterMark gutterIconRenderer;
|
||||
private final GutterMark gutterIconRenderer;
|
||||
private final ProblemGroup myProblemGroup;
|
||||
|
||||
private volatile byte myFlags; // bit packed flags below:
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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,7 +16,7 @@
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
|
||||
import com.intellij.codeInspection.SuppressionUtil;
|
||||
import com.intellij.codeInspection.SuppressionUtilCore;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiWhiteSpace;
|
||||
@@ -27,7 +27,7 @@ public class DefaultChangeLocalityDetector implements ChangeLocalityDetector {
|
||||
public PsiElement getChangeHighlightingDirtyScopeFor(@NotNull PsiElement changedElement) {
|
||||
if (changedElement instanceof PsiWhiteSpace ||
|
||||
changedElement instanceof PsiComment
|
||||
&& !changedElement.getText().contains(SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME)) {
|
||||
&& !changedElement.getText().contains(SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME)) {
|
||||
return changedElement;
|
||||
}
|
||||
return null;
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -73,7 +73,7 @@ public class PsiElementListNavigator {
|
||||
final String title,
|
||||
final String findUsagesTitle,
|
||||
final ListCellRenderer listRenderer,
|
||||
final @Nullable ListBackgroundUpdaterTask listUpdaterTask) {
|
||||
@Nullable final ListBackgroundUpdaterTask listUpdaterTask) {
|
||||
return navigateOrCreatePopup(targets, title, findUsagesTitle, listRenderer, listUpdaterTask, new Consumer<Object[]>() {
|
||||
@Override
|
||||
public void consume(Object[] selectedElements) {
|
||||
@@ -91,7 +91,7 @@ public class PsiElementListNavigator {
|
||||
final String title,
|
||||
final String findUsagesTitle,
|
||||
final ListCellRenderer listRenderer,
|
||||
final @Nullable ListBackgroundUpdaterTask listUpdaterTask,
|
||||
@Nullable final ListBackgroundUpdaterTask listUpdaterTask,
|
||||
final Consumer<Object[]> consumer) {
|
||||
if (targets.length == 0) return null;
|
||||
if (targets.length == 1) {
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class FileReferenceQuickFixProvider {
|
||||
final String newFileName = reference.getFileNameToCreate();
|
||||
|
||||
// check if we could create file
|
||||
if (newFileName.length() == 0 ||
|
||||
if (newFileName.isEmpty() ||
|
||||
newFileName.indexOf('\\') != -1 ||
|
||||
newFileName.indexOf('*') != -1 ||
|
||||
newFileName.indexOf('?') != -1 ||
|
||||
|
||||
@@ -17,8 +17,8 @@ package com.intellij.codeInsight.highlighting;
|
||||
|
||||
import com.intellij.find.FindManager;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
@@ -39,7 +39,7 @@ public class EscapeHandler extends EditorActionHandler {
|
||||
public void execute(Editor editor, DataContext dataContext){
|
||||
editor.setHeaderComponent(null);
|
||||
|
||||
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
if (project != null) {
|
||||
HighlightManagerImpl highlightManager = (HighlightManagerImpl)HighlightManager.getInstance(project);
|
||||
if (highlightManager != null && highlightManager.hideHighlights(editor, HighlightManager.HIDE_BY_ESCAPE | HighlightManager.HIDE_BY_ANY_KEY)) {
|
||||
@@ -68,7 +68,7 @@ public class EscapeHandler extends EditorActionHandler {
|
||||
@Override
|
||||
public boolean isEnabled(Editor editor, DataContext dataContext) {
|
||||
if (editor.hasHeaderComponent()) return true;
|
||||
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
|
||||
if (project != null) {
|
||||
HighlightManagerImpl highlightManager = (HighlightManagerImpl)HighlightManager.getInstance(project);
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -22,7 +22,6 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
import com.intellij.openapi.actionSystem.ex.AnActionListener;
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
|
||||
+8
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -35,19 +35,19 @@ public abstract class TemplateLanguageErrorFilter extends HighlightErrorFilter {
|
||||
|
||||
private final Set<Language> knownLanguageSet;
|
||||
|
||||
private final static Key<Class> TEMPLATE_VIEW_PROVIDER_CLASS_KEY = Key.create("TEMPLATE_VIEW_PROVIDER_CLASS");
|
||||
private static final Key<Class> TEMPLATE_VIEW_PROVIDER_CLASS_KEY = Key.create("TEMPLATE_VIEW_PROVIDER_CLASS");
|
||||
|
||||
protected TemplateLanguageErrorFilter(
|
||||
final @NotNull TokenSet templateExpressionStartTokens,
|
||||
final @NotNull Class templateFileViewProviderClass)
|
||||
@NotNull final TokenSet templateExpressionStartTokens,
|
||||
@NotNull final Class templateFileViewProviderClass)
|
||||
{
|
||||
this(templateExpressionStartTokens, templateFileViewProviderClass, new String[0]);
|
||||
}
|
||||
|
||||
protected TemplateLanguageErrorFilter(
|
||||
final @NotNull TokenSet templateExpressionStartTokens,
|
||||
final @NotNull Class templateFileViewProviderClass,
|
||||
final @NotNull String... knownSubLanguageNames)
|
||||
@NotNull final TokenSet templateExpressionStartTokens,
|
||||
@NotNull final Class templateFileViewProviderClass,
|
||||
@NotNull final String... knownSubLanguageNames)
|
||||
{
|
||||
myTemplateExpressionStartTokens = TokenSet.create(templateExpressionStartTokens.getTypes());
|
||||
myTemplateFileViewProviderClass = templateFileViewProviderClass;
|
||||
@@ -105,7 +105,7 @@ public abstract class TemplateLanguageErrorFilter extends HighlightErrorFilter {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isKnownSubLanguage(final @NotNull Language language) {
|
||||
protected boolean isKnownSubLanguage(@NotNull final Language language) {
|
||||
for (Language knownLanguage : knownLanguageSet) {
|
||||
if (language.is(knownLanguage)) {
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.psi.ElementDescriptionProvider;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.impl.file.PsiDirectoryFactory;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.hierarchy.actions.BrowseHierarchyActionBase;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.usages;
|
||||
|
||||
import com.intellij.navigation.NavigationItem;
|
||||
@@ -5,7 +20,6 @@ import com.intellij.navigation.NavigationItemFileStatus;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.vcs.FileStatus;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
@@ -85,7 +99,7 @@ public class PsiNamedElementUsageGroupBase<T extends PsiNamedElement & Navigatio
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(final UsageGroup o) {
|
||||
public int compareTo(@NotNull final UsageGroup o) {
|
||||
String name;
|
||||
if (o instanceof NamedPresentably) {
|
||||
name = ((NamedPresentably)o).getPresentableName();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -367,7 +367,7 @@ public class UsageInfo2UsageAdapter implements UsageInModule,
|
||||
|
||||
// by start offset
|
||||
@Override
|
||||
public int compareTo(final UsageInfo2UsageAdapter o) {
|
||||
public int compareTo(@NotNull final UsageInfo2UsageAdapter o) {
|
||||
VirtualFile containingFile = getFile();
|
||||
int shift1 = 0;
|
||||
if (containingFile instanceof VirtualFileWindow) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -17,8 +17,6 @@ package com.intellij.usages;
|
||||
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -331,7 +331,7 @@ public class GroupNode extends Node implements Navigatable, Comparable<GroupNode
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(GroupNode groupNode) {
|
||||
public int compareTo(@NotNull GroupNode groupNode) {
|
||||
if (myRuleIndex == groupNode.myRuleIndex) {
|
||||
return myGroup.compareTo(groupNode.myGroup);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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,6 +16,7 @@
|
||||
package com.intellij.usages.impl;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -54,7 +55,7 @@ abstract class RuleAction extends ToggleAction implements DumbAware {
|
||||
setOptionValue(state);
|
||||
myState = state;
|
||||
|
||||
Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
if (project != null) {
|
||||
project.getMessageBus().syncPublisher(UsageFilteringRuleProvider.RULES_CHANGED).run();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -49,7 +49,7 @@ public class UsageNode extends Node implements Comparable<UsageNode>, Navigatabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageNode usageNode) {
|
||||
public int compareTo(@NotNull UsageNode usageNode) {
|
||||
return UsageViewImpl.USAGE_COMPARATOR.compare(myUsage, usageNode.getUsage());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -127,7 +127,7 @@ public class DirectoryGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
return getText(null).compareToIgnoreCase(usageGroup.getText(null));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -131,7 +131,7 @@ public class FileGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
return getText(null).compareToIgnoreCase(usageGroup.getText(null));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -90,7 +90,7 @@ public class ModuleGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
if (usageGroup instanceof ModuleUsageGroup) return 1;
|
||||
return getText(null).compareToIgnoreCase(usageGroup.getText(null));
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public class ModuleGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageGroup o) {
|
||||
public int compareTo(@NotNull UsageGroup o) {
|
||||
if (o instanceof LibraryUsageGroup) return -1;
|
||||
return getText(null).compareToIgnoreCase(o.getText(null));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -58,7 +58,7 @@ public class NonCodeUsageGroupingRule implements UsageGroupingRule {
|
||||
@Override
|
||||
public boolean isValid() { return true; }
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
if (usageGroup instanceof DynamicUsageGroup) {
|
||||
return -1;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class NonCodeUsageGroupingRule implements UsageGroupingRule {
|
||||
@Override
|
||||
public boolean isValid() { return true; }
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) { return usageGroup == this ? 0 : -1; }
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) { return usageGroup == this ? 0 : -1; }
|
||||
@Override
|
||||
public void navigate(boolean requestFocus) { }
|
||||
@Override
|
||||
@@ -142,7 +142,7 @@ public class NonCodeUsageGroupingRule implements UsageGroupingRule {
|
||||
@Override
|
||||
public boolean isValid() { return true; }
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) { return usageGroup == this ? 0 : 1; }
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) { return usageGroup == this ? 0 : 1; }
|
||||
@Override
|
||||
public void navigate(boolean requestFocus) { }
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -121,7 +121,7 @@ public class UsageScopeGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
return getText(null).compareTo(usageGroup.getText(null));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -121,7 +121,7 @@ public class UsageTypeGroupingRule implements UsageGroupingRuleEx {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
public int compareTo(@NotNull UsageGroup usageGroup) {
|
||||
return getText(null).compareTo(usageGroup.getText(null));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -86,7 +86,7 @@ public class AddSchemaPrefixIntention extends PsiElementBaseIntentionAction {
|
||||
tag.accept(new XmlRecursiveElementVisitor() {
|
||||
@Override
|
||||
public void visitXmlTag(XmlTag tag) {
|
||||
if (tag.getNamespace().equals(namespace) && tag.getNamespacePrefix().length() == 0) {
|
||||
if (tag.getNamespace().equals(namespace) && tag.getNamespacePrefix().isEmpty()) {
|
||||
tags.add(tag);
|
||||
}
|
||||
super.visitXmlTag(tag);
|
||||
@@ -141,7 +141,7 @@ public class AddSchemaPrefixIntention extends PsiElementBaseIntentionAction {
|
||||
final PsiElement parent = element.getParent();
|
||||
if (parent instanceof XmlTag) {
|
||||
XmlTag tag = (XmlTag)parent;
|
||||
if (tag.getNamespacePrefix().length() == 0) {
|
||||
if (tag.getNamespacePrefix().isEmpty()) {
|
||||
while (tag != null) {
|
||||
final XmlAttribute attr = tag.getAttribute("xmlns");
|
||||
if (attr != null) return attr;
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class ConvertSchemaPrefixToDefaultIntention extends PsiElementBaseIntenti
|
||||
final int index = ns.length() + 1;
|
||||
for (XmlTag tag : tags) {
|
||||
final String s = tag.getName().substring(index);
|
||||
if (s.length() > 0) {
|
||||
if (!s.isEmpty()) {
|
||||
tag.setName(s);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ abstract class BaseExtResourceAction extends BaseIntentionAction {
|
||||
doInvoke(file, offset, uri, editor);
|
||||
}
|
||||
|
||||
protected abstract void doInvoke(final @NotNull PsiFile file, final int offset, final @NotNull String uri, final Editor editor)
|
||||
protected abstract void doInvoke(@NotNull final PsiFile file, final int offset, @NotNull final String uri, final Editor editor)
|
||||
throws IncorrectOperationException;
|
||||
|
||||
@Nullable
|
||||
|
||||
+6
-6
@@ -67,11 +67,11 @@ import java.util.*;
|
||||
*/
|
||||
public class FetchExtResourceAction extends BaseExtResourceAction implements WatchedRootsProvider {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.FetchDtdAction");
|
||||
private static final @NonNls String HTML_MIME = "text/html";
|
||||
private static final @NonNls String HTTP_PROTOCOL = "http://";
|
||||
private static final @NonNls String HTTPS_PROTOCOL = "https://";
|
||||
private static final @NonNls String FTP_PROTOCOL = "ftp://";
|
||||
private static final @NonNls String EXT_RESOURCES_FOLDER = "extResources";
|
||||
@NonNls private static final String HTML_MIME = "text/html";
|
||||
@NonNls private static final String HTTP_PROTOCOL = "http://";
|
||||
@NonNls private static final String HTTPS_PROTOCOL = "https://";
|
||||
@NonNls private static final String FTP_PROTOCOL = "ftp://";
|
||||
@NonNls private static final String EXT_RESOURCES_FOLDER = "extResources";
|
||||
private final boolean myForceResultIsValid;
|
||||
|
||||
public FetchExtResourceAction() {
|
||||
@@ -281,7 +281,7 @@ public class FetchExtResourceAction extends BaseExtResourceAction implements Wat
|
||||
}
|
||||
}
|
||||
|
||||
private static VirtualFile findFileByPath(final String resPath, final @Nullable String dtdUrl, ProgressIndicator indicator) {
|
||||
private static VirtualFile findFileByPath(final String resPath, @Nullable final String dtdUrl, ProgressIndicator indicator) {
|
||||
final Ref<VirtualFile> ref = new Ref<VirtualFile>();
|
||||
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -18,9 +18,9 @@ package com.intellij.codeInsight.highlighting;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.xml.XmlAttributeValue;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.psi.xml.XmlElementDecl;
|
||||
import com.intellij.psi.xml.XmlComment;
|
||||
import com.intellij.psi.xml.XmlElementDecl;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -26,6 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author yole
|
||||
*/
|
||||
public class XmlUsageViewDescriptionProvider implements ElementDescriptionProvider {
|
||||
@Override
|
||||
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
|
||||
if (location instanceof UsageViewShortNameLocation) {
|
||||
if (element instanceof XmlAttributeValue) {
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -32,6 +47,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase {
|
||||
model.addModelListener(listener);
|
||||
final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a/>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tagFromText.setAttribute("a", "b");
|
||||
}
|
||||
@@ -48,6 +64,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase {
|
||||
final XmlTag otherTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a/>");
|
||||
final XmlText xmlText = tagFromText.getValue().getTextElements()[0];
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
xmlText.insertAtOffset(otherTag, 2);
|
||||
}
|
||||
@@ -63,6 +80,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase {
|
||||
final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>aaa</a>");
|
||||
final XmlText xmlText = tagFromText.getValue().getTextElements()[0];
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
xmlText.insertText("bb", 2);
|
||||
}
|
||||
@@ -77,6 +95,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase {
|
||||
model.addModelListener(listener);
|
||||
final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>a </a>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tagFromText.addAfter(tagFromText.getValue().getTextElements()[0], tagFromText.getValue().getTextElements()[0]);
|
||||
}
|
||||
@@ -91,6 +110,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase {
|
||||
model.addModelListener(listener);
|
||||
final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>aaa</a>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tagFromText.delete();
|
||||
}
|
||||
@@ -152,6 +172,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase {
|
||||
final XmlAttribute attribute = tag.getAttribute("name", null);
|
||||
assert attribute != null;
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
attribute.setValue("new");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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,6 +88,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
assertEquals("bNamespace", childTag.getNamespace());
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XmlTag beanTag = (XmlTag)rootTag.add(childTag);
|
||||
assertEquals("bNamespace", beanTag.getNamespace());
|
||||
@@ -99,6 +100,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a><b/> </a>");
|
||||
final XmlTag bTag = aTag.findFirstSubTag("b");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
bTag.delete();
|
||||
}
|
||||
@@ -111,6 +113,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a><b/></a>");
|
||||
final XmlTag bTag = aTag.findFirstSubTag("b");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PsiElement cTag = bTag.replace(XmlElementFactory.getInstance(getProject()).createTagFromText("<c/>"));
|
||||
assertEquals(1, aTag.getSubTags().length);
|
||||
@@ -125,6 +128,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlText displayText = elementFactory.createDisplayText("2");
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final PsiElement psiElement = aTag.addAfter(displayText, aTag.getValue().getChildren()[0]);
|
||||
assertEquals(psiElement.getContainingFile(), aTag.getContainingFile());
|
||||
@@ -134,6 +138,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
|
||||
public void testWhitespaceInsideTag() throws Exception {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XmlElementFactory.getInstance(getProject()).createTagFromText("<p/>").getValue().setText("\n");
|
||||
}
|
||||
@@ -145,6 +150,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTag rootTag = xhtmlFile.getDocument().getRootTag();
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootTag.setAttribute("foo", "bar");
|
||||
}
|
||||
@@ -158,6 +164,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testSetAttribute() throws Exception {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootTag.setAttribute("foo", "bar");
|
||||
}
|
||||
@@ -173,6 +180,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>");
|
||||
final String value = "a \"b\" c";
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootTag.setAttribute("foo", value);
|
||||
}
|
||||
@@ -188,6 +196,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>");
|
||||
final String value = "'a \"b\" c'";
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootTag.setAttribute("foo", value);
|
||||
}
|
||||
@@ -219,6 +228,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testSetAttributeWithNamespaces() throws Exception {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<ns:tag xmlns:ns=\"xxx\"/>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootTag.setAttribute("foo", "", "bar");
|
||||
}
|
||||
@@ -234,6 +244,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>aaa</html>");
|
||||
final XmlText xmlText = rootTag.getValue().getTextElements()[0];
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
xmlText.removeText(0, 3);
|
||||
}
|
||||
@@ -245,6 +256,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testTextEdit2() throws Exception {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a<a</html>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootTag.getValue().getTextElements()[0].removeText(0, 3);
|
||||
}
|
||||
@@ -257,6 +269,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a<a</html>");
|
||||
final XmlText xmlText = rootTag.getValue().getTextElements()[0];
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
xmlText.removeText(1, 2);
|
||||
}
|
||||
@@ -270,6 +283,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>aaa</html>");
|
||||
final XmlText xmlText = rootTag.getValue().getTextElements()[0];
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
xmlText.removeText(1, 2);
|
||||
}
|
||||
@@ -306,6 +320,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a<b>1</b>c</html>");
|
||||
final XmlTag xmlTag = rootTag.findFirstSubTag("b");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
xmlTag.delete();
|
||||
}
|
||||
@@ -317,6 +332,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testBrace() throws Exception {
|
||||
final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a/>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tagFromText.getValue().setText("<");
|
||||
}
|
||||
@@ -421,6 +437,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
assertTrue(child instanceof XmlText && child.getText().equals("234"));
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
assertNotNull(tag.getParent().addBefore(child, tag));
|
||||
tag.delete();
|
||||
@@ -440,6 +457,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
assertTrue(child instanceof XmlText && child.getText().equals("234"));
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
assertNotNull(tag.getParent().addBefore(child, tag));
|
||||
tag.delete();
|
||||
@@ -454,6 +472,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testDisplayText() throws Throwable {
|
||||
final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText(" <foo/>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tag.add(XmlElementFactory.getInstance(getProject()).createDisplayText("aaa\nbbb"));
|
||||
}
|
||||
@@ -471,6 +490,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final PsiElement parent = tagB.getParent();
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PsiElement first = parent.addBefore(tagElements[0], tagB);
|
||||
assertNotNull(first);
|
||||
@@ -512,6 +532,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
"<a>\n <a/>\n</a>");
|
||||
final XmlTag tagB = file.getDocument().getRootTag();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tagB.getSubTags()[0].delete();
|
||||
}
|
||||
@@ -525,6 +546,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
.createFileFromText("test.xml", "<a>\n <a>\n <b>\n hasgdgasjdgasdg asgdjhasgd</b>\n </a>\n</a>");
|
||||
final XmlTag tagB = file.getDocument().getRootTag();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tagB.getSubTags()[0].getSubTags()[0].delete();
|
||||
}
|
||||
@@ -562,6 +584,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testXHTMLTextInsert() throws Exception {
|
||||
final XmlTag tag = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText("<a>xyz</a>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tag.getValue().getTextElements()[0].insertText("<", 1);
|
||||
}
|
||||
@@ -605,6 +628,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
|
||||
private static void doTestSimpleDeletion(final String text) throws IncorrectOperationException {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
for (int j = i; j < text.length(); j++) {
|
||||
@@ -625,6 +649,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
|
||||
private static void doTestSimpleInsertion(final String text, final String textToInsert) throws IncorrectOperationException {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i <= text.length(); i++) {
|
||||
XmlTag tag = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText("<a>" + text + "</a>");
|
||||
@@ -712,6 +737,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
|
||||
private static void doTestEscapedDeletion(final String text) throws IncorrectOperationException {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String tagText = toEscapedText(text);
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
@@ -737,6 +763,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testWhitespacesInEmptyXHTMLTag() throws Exception{
|
||||
final XmlTag tag = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText("<a> <b/> </a>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tag.findFirstSubTag("b").delete();
|
||||
}
|
||||
@@ -836,6 +863,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
final XmlTagChild nbsp = tagB.getValue().getChildren()[0];
|
||||
assertEquals(" ", nbsp.getText());
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tagA.addBefore(nbsp.copy(), tagB);
|
||||
}
|
||||
@@ -870,6 +898,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
|
||||
public void testStrangeCharactesInText() throws Throwable {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XmlElementFactory.getInstance(getProject()).createTagFromText("<a/>").getValue().setText("@#$%@$%$${${''}");
|
||||
}
|
||||
@@ -917,6 +946,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testXmlFormattingException() throws Throwable {
|
||||
final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo>bar</foo>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tag.add(XmlElementFactory.getInstance(getProject()).createTagFromText("<bar/>"));
|
||||
}
|
||||
@@ -932,6 +962,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
rootTag.getSubTags()[0].getNamespace(); // fill the cache
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rootTag.setAttribute("xmlns", "http://www.ru");
|
||||
}
|
||||
@@ -948,6 +979,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
|
||||
final XmlText text = XmlElementFactory.getInstance(getProject()).createDisplayText("p");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PsiElement element = hr.getParentTag().addAfter(text, hr);
|
||||
assertEquals(element.getParent(), hr.getParentTag());
|
||||
@@ -958,6 +990,7 @@ public class XmlTagTest extends LightCodeInsightTestCase {
|
||||
public void testCollapse() throws IncorrectOperationException {
|
||||
final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo></foo>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tag.collapseIfEmpty();
|
||||
assertEquals("<foo/>", tag.getText());
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -16,6 +31,7 @@ public class XmlTagWriteTest extends LightCodeInsightTestCase{
|
||||
XmlElementFactory elementFactory = XmlElementFactory.getInstance(getProject());
|
||||
final XmlTag xmlTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<tag1/>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
xmlTag.add(xmlTag.createChildTag("tag2", XmlUtil.EMPTY_URI, null, false));
|
||||
}
|
||||
@@ -32,6 +48,7 @@ public class XmlTagWriteTest extends LightCodeInsightTestCase{
|
||||
public void test2() throws IncorrectOperationException {
|
||||
final XmlTag xmlTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<tag1></tag1>");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
xmlTag.add(xmlTag.createChildTag("tag2", XmlUtil.EMPTY_URI, null, false));
|
||||
}
|
||||
@@ -50,6 +67,7 @@ public class XmlTagWriteTest extends LightCodeInsightTestCase{
|
||||
final XmlText text = (XmlText) tag.getValue().getChildren()[0];
|
||||
String textS = text.getText();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
text.insertText("lala", 2);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.application.options.XmlSettings;
|
||||
@@ -373,6 +388,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
try {
|
||||
doDoTest(true,true);
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myEditor.getDocument().insertString(myEditor.getDocument().getCharsSequence().toString().indexOf("?>") + 2, "\n");
|
||||
}
|
||||
@@ -532,6 +548,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
final XmlAttributeValue valueElement = attribute.getValueElement();
|
||||
final PsiReference nameReference = valueElement.getReferences()[0];
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
nameReference.handleElementRename("zzz");
|
||||
}
|
||||
@@ -546,6 +563,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
public void testExternalValidatorOnValidXmlWithNamespacesNotSetup() throws Exception {
|
||||
final ExternalResourceManagerEx instanceEx = ExternalResourceManagerEx.getInstanceEx();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
instanceEx.addIgnoredResource("http://xml.apache.org/axis/wsdd2/");
|
||||
instanceEx.addIgnoredResource("http://xml.apache.org/axis/wsdd2/providers/java");
|
||||
@@ -561,6 +579,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
final ExternalResourceManagerEx instanceEx = ExternalResourceManagerEx.getInstanceEx();
|
||||
try {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
instanceEx.addIgnoredResource("");
|
||||
}
|
||||
@@ -569,6 +588,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
doTest(getFullRelativeTestName(".xml"), true, false);
|
||||
} finally {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
instanceEx.removeIgnoredResource("");
|
||||
}
|
||||
@@ -1045,6 +1065,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
|
||||
public void testIgnoredNamespaceHighlighting() throws Exception {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("http://ignored/uri");
|
||||
}
|
||||
@@ -1052,6 +1073,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
|
||||
doTest();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExternalResourceManagerEx.getInstanceEx().removeIgnoredResource("http://ignored/uri");
|
||||
}
|
||||
@@ -1221,6 +1243,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
|
||||
final String text = myEditor.getDocument().getText();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength());
|
||||
}
|
||||
@@ -1397,6 +1420,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
final String text = schemaEditor.getDocument().getText();
|
||||
final String newText = text.replaceAll("xsd","xs");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
schemaEditor.getDocument().replaceString(0, text.length(), newText);
|
||||
}
|
||||
@@ -1555,6 +1579,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
assertEquals(2, infos.size());
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EditorModificationUtil.deleteSelectedText(myEditor);
|
||||
}
|
||||
@@ -1565,6 +1590,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
assertEquals(11, infos.size());
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EditorModificationUtil.insertStringAtCaret(myEditor, "<");
|
||||
}
|
||||
@@ -1635,6 +1661,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
BASE_PATH +testName +"TestSchema.xsd"
|
||||
);
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("oxf:/apps/somefile.xml");
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
|
||||
import com.intellij.codeInsight.daemon.XmlErrorMessages;
|
||||
import com.intellij.lang.html.HTMLLanguage;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.xml.XmlToken;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import com.intellij.codeInsight.daemon.XmlErrorMessages;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user