From d745b1a7f7cee3c25f21bcedc1fa3b409033ab24 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 19 Apr 2012 09:31:52 +0200 Subject: [PATCH 01/36] unchecked generics array creation: subst should be applied before isReifiable check (IDEA-79052) --- .../daemon/impl/analysis/GenericsHighlightUtil.java | 7 ++++--- .../UncheckedWarningLocalInspection.java | 5 +++-- .../advHighlighting7/UncheckedGenericsArrayCreation.java | 9 +++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java index 23eb2f2969cc..824f5bd18e32 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java @@ -1075,7 +1075,8 @@ public class GenericsHighlightUtil { } } - public static boolean isUncheckedWarning(PsiJavaCodeReferenceElement expression, PsiElement resolve) { + public static boolean isUncheckedWarning(PsiJavaCodeReferenceElement expression, JavaResolveResult resolveResult) { + final PsiElement resolve = resolveResult.getElement(); if (resolve instanceof PsiMethod) { final PsiMethod psiMethod = (PsiMethod)resolve; @@ -1087,7 +1088,7 @@ public class GenericsHighlightUtil { final PsiParameter varargParameter = psiMethod.getParameterList().getParameters()[parametersCount - 1]; final PsiType componentType = ((PsiEllipsisType)varargParameter.getType()).getComponentType(); - if (!isReifiableType(componentType)) { + if (!isReifiableType(resolveResult.getSubstitutor().substitute(componentType))) { final PsiElement parent = expression.getParent(); if (parent instanceof PsiCall) { final PsiExpressionList argumentList = ((PsiCall)parent).getArgumentList(); @@ -1109,7 +1110,7 @@ public class GenericsHighlightUtil { } } for (int i = parametersCount - 1; i < args.length; i++) { - if (!isReifiableType(args[i].getType())){ + if (!isReifiableType(resolveResult.getSubstitutor().substitute(args[i].getType()))){ return true; } } diff --git a/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java b/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java index 31e4394f29d1..8c77301bf660 100644 --- a/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspection.java @@ -188,7 +188,8 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool public void visitReferenceExpression(PsiReferenceExpression expression) { if (IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION) return; if (!PsiUtil.isLanguageLevel5OrHigher(expression)) return; - if (GenericsHighlightUtil.isUncheckedWarning(expression, expression.resolve())) { + final JavaResolveResult result = expression.advancedResolve(false); + if (GenericsHighlightUtil.isUncheckedWarning(expression, result)) { registerProblem("Unchecked generics array creation for varargs parameter", expression, LocalQuickFix.EMPTY_ARRAY); } } @@ -199,7 +200,7 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool if (IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION) return; if (!PsiUtil.isLanguageLevel5OrHigher(expression)) return; final PsiJavaCodeReferenceElement classReference = expression.getClassOrAnonymousClassReference(); - if (GenericsHighlightUtil.isUncheckedWarning(classReference, expression.resolveConstructor())) { + if (GenericsHighlightUtil.isUncheckedWarning(classReference, expression.resolveMethodGenerics())) { registerProblem("Unchecked generics array creation for varargs parameter", classReference, LocalQuickFix.EMPTY_ARRAY); } } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedGenericsArrayCreation.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedGenericsArrayCreation.java index 06ff29ce7b48..31d207fc3dda 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedGenericsArrayCreation.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedGenericsArrayCreation.java @@ -119,3 +119,12 @@ class OCM { this(s, false, c); } } + +class TPSubstitution { + public void f(T... args) { + } + + public void g() { + new TPSubstitution().f(); + } +} \ No newline at end of file From ad492ed4a75a864ae0a761ecf25354fb942c5203 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 19 Apr 2012 11:28:58 +0400 Subject: [PATCH 02/36] cleanup --- .../intellij/tasks/actions/TaskRenderer.java | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 plugins/tasks/tasks-core/src/com/intellij/tasks/actions/TaskRenderer.java diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/TaskRenderer.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/TaskRenderer.java deleted file mode 100644 index 46e0ea879136..000000000000 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/TaskRenderer.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2000-2009 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.tasks.actions; - -import com.intellij.tasks.Task; -import com.intellij.ui.SimpleColoredComponent; -import com.intellij.ui.SimpleTextAttributes; -import com.intellij.ide.BrowserUtil; - -/** - * @author Dmitry Avdeev - */ -public class TaskRenderer extends SimpleColoredComponent { - - public void setTask(Task task) { - setIcon(task.getIcon()); - if (task.isIssue()) { - final String url = task.getIssueUrl(); - if (url == null) { - append(task.getId()); - } else { - append(task.getId(), SimpleTextAttributes.LINK_ATTRIBUTES, new Runnable() { - public void run() { - BrowserUtil.launchBrowser(url); - } - }); - } - append(": " + task.getSummary()); - } else { - append(task.getSummary()); - } - } -} From bc375c273e957f8f5b82f9482235bda556ec9b47 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 19 Apr 2012 11:56:10 +0400 Subject: [PATCH 03/36] be test friendly --- .../src/com/intellij/openapi/vcs/ZipperUpdater.java | 1 + .../openapi/vcs/changes/ui/CommitChangeListDialog.java | 9 +++++++-- .../openapi/vcs/impl/ProjectLevelVcsManagerImpl.java | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ZipperUpdater.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ZipperUpdater.java index 7a2283039639..0ab7a86c4e6f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ZipperUpdater.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ZipperUpdater.java @@ -41,6 +41,7 @@ public class ZipperUpdater { public void queue(final Runnable runnable, final boolean urgent) { synchronized (myLock) { + if (myAlarm.isDisposed()) return; final boolean wasRaised = myRaised; myRaised = true; if (! wasRaised) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java index e0fce56a2897..70779b8b6882 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java @@ -155,7 +155,12 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj CommitChangeListDialog dialog = new CommitChangeListDialog(project, changes, initialSelection, executors, showVcsCommit, defaultList, changeLists, null, false, comment); - dialog.show(); + if (!ApplicationManager.getApplication().isUnitTestMode()) { + dialog.show(); + } + else { + dialog.doOKAction(); + } return dialog.isOK(); } @@ -193,7 +198,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj public static boolean commitChanges(final Project project, final Collection changes, final LocalChangeList initialSelection, final List executors, final boolean showVcsCommit, final String comment) { - if (changes.isEmpty()) { + if (changes.isEmpty() && !ApplicationManager.getApplication().isUnitTestMode()) { Messages.showInfoMessage(project, VcsBundle.message("commit.dialog.no.changes.detected.text") , VcsBundle.message("commit.dialog.no.changes.detected.title")); return false; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java index 6235e6de625d..ccfee33b4a11 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java @@ -581,8 +581,8 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes } public void stopBackgroundVcsOperation() { - // in fact, the condition is "should not be called under ApplicationManager.invokeLater() and similiar" - assert ! ApplicationManager.getApplication().isDispatchThread(); + // in fact, the condition is "should not be called under ApplicationManager.invokeLater() and similar" + assert !ApplicationManager.getApplication().isDispatchThread() || ApplicationManager.getApplication().isUnitTestMode(); LOG.assertTrue(myBackgroundOperationCounter > 0, "myBackgroundOperationCounter > 0"); myBackgroundOperationCounter--; } From beb3e3e68e86e5492df5928824d814336c8f1ce9 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 19 Apr 2012 11:57:01 +0400 Subject: [PATCH 04/36] IDEA-84619 Changelist becomes dissociated with a task on commit --- .../src/com/intellij/tasks/TaskManager.java | 3 +++ .../intellij/tasks/impl/BaseRepository.java | 11 +++++++++ .../tasks/impl/BaseRepositoryImpl.java | 10 -------- .../tasks/impl/TaskCheckinHandlerFactory.java | 7 ++++-- .../intellij/tasks/impl/TaskManagerImpl.java | 5 ++++ .../intellij/tasks/TaskManagerTestCase.java | 5 ++++ .../test/com/intellij/tasks/TaskVcsTest.java | 24 +++++++++++++++++++ .../com/intellij/tasks/TestRepository.java | 5 ---- 8 files changed, 53 insertions(+), 17 deletions(-) diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskManager.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskManager.java index c7c6889c5750..35f821dd92a9 100644 --- a/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskManager.java +++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskManager.java @@ -66,6 +66,9 @@ public abstract class TaskManager { @NotNull public abstract LocalTask getActiveTask(); + @Nullable + public abstract LocalTask findTask(String id); + /** * Update issue cache asynchronously * @param onComplete callback to be invoked after updating diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepository.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepository.java index b7d259e1bcaf..a438ce266dd5 100644 --- a/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepository.java +++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepository.java @@ -20,11 +20,16 @@ import com.intellij.tasks.TaskRepository; import com.intellij.tasks.TaskRepositoryType; import com.intellij.util.xmlb.annotations.Tag; import com.intellij.util.xmlb.annotations.Transient; +import org.jetbrains.annotations.Nullable; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * @author Dmitry Avdeev */ public abstract class BaseRepository extends TaskRepository { + private static final Pattern PATTERN = Pattern.compile("[A-Z]+\\-\\d+"); protected String myUsername = ""; protected String myPassword = ""; protected boolean myUseProxy; @@ -110,4 +115,10 @@ public abstract class BaseRepository extends TaskRepository { public void setUseHttpAuthentication(boolean useHttpAuthentication) { myUseHttpAuthentication = useHttpAuthentication; } + + @Nullable + public String extractId(String taskName) { + Matcher matcher = PATTERN.matcher(taskName); + return matcher.find() ? matcher.group() : null; + } } diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java index a316b3a26fbe..7b9d70c0e2b8 100644 --- a/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java +++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/impl/BaseRepositoryImpl.java @@ -11,8 +11,6 @@ import org.jetbrains.annotations.Nullable; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** * Base class for HTTP-based repositories. @@ -26,8 +24,6 @@ public abstract class BaseRepositoryImpl extends BaseRepository { Protocol.registerProtocol(EASY_HTTPS, new Protocol(EASY_HTTPS, (ProtocolSocketFactory)new EasySSLProtocolSocketFactory(), 443)); } - private static final Pattern PATTERN = Pattern.compile("[A-Z]+\\-\\d+"); - protected BaseRepositoryImpl() { } @@ -39,12 +35,6 @@ public abstract class BaseRepositoryImpl extends BaseRepository { super(other); } - @Nullable - public String extractId(String taskName) { - Matcher matcher = PATTERN.matcher(taskName); - return matcher.find() ? matcher.group() : null; - } - protected static String encodeUrl(String s) { try { return URLEncoder.encode(s, "UTF-8"); diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java index e1c0f7214a88..77f4cf7f3115 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskCheckinHandlerFactory.java @@ -69,14 +69,17 @@ public class TaskCheckinHandlerFactory extends CheckinHandlerFactory { } @Nullable - private static Task findTask(String message, TaskManager manager) { + private static LocalTask findTask(String message, TaskManager manager) { TaskRepository[] repositories = manager.getAllRepositories(); for (TaskRepository repository : repositories) { String id = repository.extractId(message); + if (id == null) continue; + LocalTask localTask = manager.findTask(id); + if (localTask != null) return localTask; try { Task task = repository.findTask(id); if (task != null) { - return task; + return manager.addTask(task); } } catch (Exception ignore) { diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java index 74fb0ee91648..a4e1714c3822 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/impl/TaskManagerImpl.java @@ -226,6 +226,11 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe return myActiveTask; } + @Override + public LocalTask findTask(String id) { + return myTasks.get(id); + } + @Override public List getIssues(String query) { return getIssues(query, true); diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTestCase.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTestCase.java index 453c130d248f..9fe25eead4cb 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTestCase.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTestCase.java @@ -1,5 +1,6 @@ package com.intellij.tasks; +import com.intellij.tasks.impl.LocalTaskImpl; import com.intellij.tasks.impl.TaskManagerImpl; import com.intellij.testFramework.UsefulTestCase; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; @@ -26,6 +27,10 @@ public abstract class TaskManagerTestCase extends LightCodeInsightFixtureTestCas @Override protected void tearDown() throws Exception { myManager.setRepositories(Collections.emptyList()); + LocalTaskImpl[] tasks = myManager.getLocalTasks(); + for (LocalTaskImpl task : tasks) { + myManager.removeTask(task); + } super.tearDown(); } } diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskVcsTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskVcsTest.java index 52d955f914c9..25f210f1c290 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskVcsTest.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskVcsTest.java @@ -16,10 +16,12 @@ package com.intellij.tasks; import com.intellij.openapi.vcs.ProjectLevelVcsManager; +import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; import com.intellij.openapi.vcs.changes.LocalChangeList; import com.intellij.openapi.vcs.changes.committed.MockAbstractVcs; +import com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog; import com.intellij.openapi.vcs.impl.projectlevelman.AllVcses; import com.intellij.tasks.impl.LocalTaskImpl; import org.jetbrains.annotations.NotNull; @@ -70,6 +72,28 @@ public class TaskVcsTest extends TaskManagerTestCase { assertEquals("TEST-001 Summary 001 TEST", info.comment); } + public void testSaveContextOnCommit() throws Exception { + Task task = myRepository.findTask("TEST-001"); + assertNotNull(task); + myManager.activateTask(task, false, true); + + assertEquals(2, myManager.getLocalTasks().length); // default + new one + LocalTask localTask = myManager.getActiveTask(); + List changelists = myManager.getOpenChangelists(localTask); + + ChangeListInfo info = changelists.get(0); + LocalChangeList changeList = ChangeListManager.getInstance(getProject()).getChangeList(info.id); + assertNotNull(changeList); + assertEquals(changeList.getId(), localTask.getAssociatedChangelistId()); + + CommitChangeListDialog.commitChanges(getProject(), Collections.emptyList(), changeList, null, changeList.getName()); + + assertEquals(2, myManager.getLocalTasks().length); // no extra task created + + LocalTask associatedTask = myManager.getAssociatedTask(changeList); + assertNotNull(associatedTask); // association should survive + } + private ChangeListInfo createChangelist(Task task) { clearChangeLists(); LocalTaskImpl localTask = new LocalTaskImpl(task); diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TestRepository.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TestRepository.java index 98c1b5f364d1..7731a833aba5 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TestRepository.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TestRepository.java @@ -43,11 +43,6 @@ class TestRepository extends BaseRepository { }); } - @Override - public String extractId(String taskName) { - return null; - } - @Override public boolean isConfigured() { return true; From b272e82f2d87bdd389c2950e1b0711435d0b1143 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 19 Apr 2012 10:05:26 +0200 Subject: [PATCH 05/36] IDEA-84860 NPE at com.intellij.codeInsight.lookup.impl.CompletionExtender.recalculateLocation --- .../lookup/impl/CompletionExtender.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/CompletionExtender.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/CompletionExtender.java index 99e9b05e7517..f8285cb2eea5 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/CompletionExtender.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/CompletionExtender.java @@ -92,12 +92,17 @@ public class CompletionExtender extends HeavyweightHint { if (!isVisible()) return; final JList list = myLookup.getList(); final Point p = list.getLocationOnScreen(); - p.y += list.indexToLocation(list.getSelectedIndex()).y; - final JComponent rootPane = UIUtil.getRootPane(myLookup.getEditor().getContentComponent()); - if (rootPane != null) { - SwingUtilities.convertPointFromScreen(p, rootPane); - setLocation(new RelativePoint(rootPane, p)); + final Point point = list.indexToLocation(list.getSelectedIndex()); + if (point != null) { + p.y += point.y; + final JComponent rootPane = UIUtil.getRootPane(myLookup.getEditor().getContentComponent()); + if (rootPane != null) { + SwingUtilities.convertPointFromScreen(p, rootPane); + setLocation(new RelativePoint(rootPane, p)); + return; + } } + hide(); } @Override From c24a004ee56e443c5575be3452a953beda257210 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Thu, 19 Apr 2012 12:35:45 +0400 Subject: [PATCH 06/36] Help IDs for Groovy, PHP, JS injection support settings (IDEA-84831, WI-7913) --- .../inject/java/JavaLanguageInjectionSupport.java | 5 +++++ .../inject/AbstractLanguageInjectionSupport.java | 10 +++++++++- .../inject/groovy/GroovyLanguageInjectionSupport.java | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java index 27ed1945bbd5..22a84364d416 100644 --- a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java +++ b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java @@ -489,4 +489,9 @@ public class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSuppo super.setupPresentation(injection, presentation, isSelected); } } + + @Override + public String getHelpId() { + return "reference.settings.injection.language.injection.settings.java.parameter"; + } } diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/AbstractLanguageInjectionSupport.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/AbstractLanguageInjectionSupport.java index 584cb1ecc36b..6ba500af8a10 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/AbstractLanguageInjectionSupport.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/AbstractLanguageInjectionSupport.java @@ -116,7 +116,10 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection final BaseInjectionPanel panel = new BaseInjectionPanel(injection, project); panel.reset(); final DialogBuilder builder = new DialogBuilder(project); - builder.setHelpId("reference.settings.injection.language.injection.settings.java.parameter"); + LanguageInjectionSupport support = InjectorUtils.findInjectionSupport(injection.getSupportId()); + if (support != null && support instanceof AbstractLanguageInjectionSupport) { + builder.setHelpId(((AbstractLanguageInjectionSupport)support).getHelpId()); + } builder.addOkAction(); builder.addCancelAction(); builder.setDimensionServiceKey("#org.intellij.plugins.intelliLang.inject.config.ui.BaseInjectionDialog"); @@ -150,4 +153,9 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection public boolean equals(Object obj) { return obj instanceof LanguageInjectionSupport && getId().equals(((LanguageInjectionSupport)obj).getId()); } + + @Nullable + public String getHelpId() { + return null; + } } diff --git a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GroovyLanguageInjectionSupport.java b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GroovyLanguageInjectionSupport.java index 2da7f3819ddc..f19c1bf888f7 100644 --- a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GroovyLanguageInjectionSupport.java +++ b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GroovyLanguageInjectionSupport.java @@ -42,4 +42,9 @@ public class GroovyLanguageInjectionSupport extends AbstractLanguageInjectionSup public boolean useDefaultInjector(final PsiElement host) { return host instanceof GroovyPsiElement; } + + @Override + public String getHelpId() { + return "reference.settings.language.injection.groovy"; + } } From d54fe95204c96bfd2517a400b4bf0a8b1c48f1f1 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 19 Apr 2012 10:30:31 +0200 Subject: [PATCH 07/36] show extender iff focused --- .../src/com/intellij/codeInsight/lookup/impl/LookupImpl.java | 3 ++- platform/platform-resources-en/src/misc/registry.properties | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index 5b9d61aa4584..945019807690 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java @@ -46,6 +46,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.util.*; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtilRt; import com.intellij.openapi.wm.IdeFocusManager; @@ -1042,7 +1043,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable } oldItem = item; - if (item != null && LookupImpl.this.isVisible()) { + if (item != null && LookupImpl.this.isVisible() && LookupImpl.this.isFocused() && !Registry.is("jeka")) { if (extender == null || !extender.isVisible() || !extender.sameAsFor(item)) { if (extender != null) extender.hide(); extender = new CompletionExtender(item, LookupImpl.this); diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index 00a592aaff6a..2a0dc42366f9 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -214,4 +214,5 @@ ide.goto.implementation.show.interfaces=false ide.goto.implementation.show.interfaces.description=Whether to show sub-interfaces when invoking Goto Implementation (Ctrl+Alt+B) on an interface ide.open.editors.asynchronously=false -ide.open.editors.asynchronously.description=Prepare editors in background thread \ No newline at end of file +ide.open.editors.asynchronously.description=Prepare editors in background thread +jeka=false \ No newline at end of file From 42ac547c0708196146a54f504933b8cb5bcd45ea Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 19 Apr 2012 10:55:19 +0200 Subject: [PATCH 08/36] testdata fixed --- .../advHighlighting7/UncheckedGenericsArrayCreation.java | 1 + 1 file changed, 1 insertion(+) diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedGenericsArrayCreation.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedGenericsArrayCreation.java index 31d207fc3dda..89028875bb17 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedGenericsArrayCreation.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/UncheckedGenericsArrayCreation.java @@ -122,6 +122,7 @@ class OCM { class TPSubstitution { public void f(T... args) { + System.out.println(args); } public void g() { From 408a33b376275588ce54dd64df97f75ef5f7990b Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 19 Apr 2012 11:12:24 +0200 Subject: [PATCH 09/36] IDEA-84688 'Recent files': preselect the last closed file --- .../src/com/intellij/ide/actions/ShowRecentFilesAction.java | 2 +- .../platform-impl/src/com/intellij/ide/actions/Switcher.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowRecentFilesAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowRecentFilesAction.java index 2849ed3f3dd2..c4ecf96177de 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ShowRecentFilesAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowRecentFilesAction.java @@ -35,7 +35,7 @@ public class ShowRecentFilesAction extends DumbAwareAction { final Project project = e.getData(PlatformDataKeys.PROJECT); if (project != null) { FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.recent.files"); - Switcher.createAndShowSwitcher(project, IdeBundle.message("title.popup.recent.files"), true).goForward(); + Switcher.createAndShowSwitcher(project, IdeBundle.message("title.popup.recent.files"), true); } } } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java index 0a63f7899462..7df79527f900 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java @@ -327,9 +327,9 @@ public class Switcher extends AnAction implements DumbAware { } } } + if (editors.size() == 1) selectionIndex++; if (editors.size() == 1 && (filesData.isEmpty() || !editors.get(0).getFirst().equals(filesData.get(0).getFirst()))) { filesData.add(0, editors.get(0)); - selectionIndex--; } } else { for (int i = 0; i < Math.min(MAX_FILES_IN_SWITCHER, editors.size()); i++) { @@ -397,7 +397,7 @@ public class Switcher extends AnAction implements DumbAware { }, mySpeedSearch); } - files.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + files.setSelectionMode(pinned ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION); files.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!files.isSelectionEmpty() && !toolWindows.isSelectionEmpty()) { From bf800f633d5030ec1bdff4fa9434c6818441bf45 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 18 Apr 2012 17:28:20 +0400 Subject: [PATCH 10/36] cleanup --- .../com/intellij/psi/impl/source/resolve/FileContextUtil.java | 2 +- .../intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/resolve/FileContextUtil.java b/platform/core-impl/src/com/intellij/psi/impl/source/resolve/FileContextUtil.java index a7f0d87cded2..e507e7010e32 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/resolve/FileContextUtil.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/resolve/FileContextUtil.java @@ -32,7 +32,7 @@ public class FileContextUtil { private FileContextUtil() { } @Nullable - public static PsiElement getFileContext(PsiFile file) { + public static PsiElement getFileContext(@NotNull PsiFile file) { SmartPsiElementPointer pointer = file.getUserData(INJECTED_IN_ELEMENT); return pointer == null ? null : pointer.getElement(); } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java index 3f9232a12461..9d24f7232f72 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java @@ -146,6 +146,7 @@ public class OrderRootsEnumeratorImpl implements OrderRootsEnumerator { return result; } + @NotNull private Collection computeRootsUrls() { final Collection result = new LinkedHashSet(); myOrderEnumerator.forEach(new Processor() { From 1b2e011470a5bb20ab12c0c8637ea53f786cb982 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 19 Apr 2012 13:11:35 +0400 Subject: [PATCH 11/36] notnull --- .../src/com/intellij/openapi/vfs/VirtualFile.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java index 202d0476bf57..6ff4f2cd9a2d 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java @@ -316,7 +316,7 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica */ @Nullable public VirtualFile findFileByRelativePath(@NotNull @NonNls String relPath) { - if (relPath.length() == 0) return this; + if (relPath.isEmpty()) return this; relPath = StringUtil.trimStart(relPath, "/"); int index = relPath.indexOf('/'); @@ -498,15 +498,15 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica return getUserData(CHARSET_KEY) != null; } - public final void setBinaryContent(byte[] content) throws IOException { + public final void setBinaryContent(@NotNull byte[] content) throws IOException { setBinaryContent(content, -1, -1); } - public void setBinaryContent(final byte[] content, long newModificationStamp, long newTimeStamp) throws IOException { + public void setBinaryContent(@NotNull byte[] content, long newModificationStamp, long newTimeStamp) throws IOException { setBinaryContent(content, newModificationStamp, newTimeStamp, this); } - public void setBinaryContent(final byte[] content, long newModificationStamp, long newTimeStamp, Object requestor) throws IOException { + public void setBinaryContent(@NotNull byte[] content, long newModificationStamp, long newTimeStamp, Object requestor) throws IOException { OutputStream outputStream = null; try { outputStream = getOutputStream(requestor, newModificationStamp, newTimeStamp); From 0b9b776867538daf7b9edd88b4f693640ae23fd8 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 19 Apr 2012 13:32:56 +0400 Subject: [PATCH 12/36] test fixed --- .../test/com/intellij/tasks/TaskManagerTestCase.java | 7 ++++++- .../tasks-tests/test/com/intellij/tasks/TaskVcsTest.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTestCase.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTestCase.java index 9fe25eead4cb..1a35980888ac 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTestCase.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTestCase.java @@ -22,15 +22,20 @@ public abstract class TaskManagerTestCase extends LightCodeInsightFixtureTestCas protected void setUp() throws Exception { super.setUp(); myManager = (TaskManagerImpl)TaskManager.getManager(getProject()); + removeAllTasks(); } @Override protected void tearDown() throws Exception { myManager.setRepositories(Collections.emptyList()); + removeAllTasks(); + super.tearDown(); + } + + private void removeAllTasks() { LocalTaskImpl[] tasks = myManager.getLocalTasks(); for (LocalTaskImpl task : tasks) { myManager.removeTask(task); } - super.tearDown(); } } diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskVcsTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskVcsTest.java index 25f210f1c290..1d24d12fd6bf 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskVcsTest.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskVcsTest.java @@ -77,7 +77,7 @@ public class TaskVcsTest extends TaskManagerTestCase { assertNotNull(task); myManager.activateTask(task, false, true); - assertEquals(2, myManager.getLocalTasks().length); // default + new one + assertEquals(1, myManager.getLocalTasks().length); LocalTask localTask = myManager.getActiveTask(); List changelists = myManager.getOpenChangelists(localTask); @@ -88,7 +88,7 @@ public class TaskVcsTest extends TaskManagerTestCase { CommitChangeListDialog.commitChanges(getProject(), Collections.emptyList(), changeList, null, changeList.getName()); - assertEquals(2, myManager.getLocalTasks().length); // no extra task created + assertEquals(1, myManager.getLocalTasks().length); // no extra task created LocalTask associatedTask = myManager.getAssociatedTask(changeList); assertNotNull(associatedTask); // association should survive From c14146bdaae9401aa9b1f7d111b89e380744e18a Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 19 Apr 2012 11:40:53 +0200 Subject: [PATCH 13/36] multiselection for files --- .../com/intellij/ide/actions/Switcher.java | 76 ++++++++++++------- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java index 7df79527f900..a9b881dd6fbc 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java @@ -175,8 +175,8 @@ public class Switcher extends AnAction implements DumbAware { private final int MAX_FILES_IN_SWITCHER; final JBPopup myPopup; final Map ids = new HashMap(); - final JList toolWindows; - final JList files; + final MyList toolWindows; + final MyList files; final JPanel separator; final ToolWindowManager twManager; final JLabel pathLabel = new JLabel(" "); @@ -237,7 +237,7 @@ public class Switcher extends AnAction implements DumbAware { twModel.addElement(window); } - toolWindows = new JBList(twModel); + toolWindows = new MyList(twModel); if (pinned) { new NameFilteringListModel(toolWindows, new Function() { @Override @@ -380,7 +380,7 @@ public class Switcher extends AnAction implements DumbAware { } }; - files = new JBList(filesModel); + files = new MyList(filesModel); if (pinned) { new NameFilteringListModel(files, new Function() { @Override @@ -511,7 +511,7 @@ public class Switcher extends AnAction implements DumbAware { return keymap; } - private int getModifiers(ShortcutSet shortcutSet) { + private static int getModifiers(ShortcutSet shortcutSet) { if (shortcutSet == null || shortcutSet.getShortcuts().length == 0 || !(shortcutSet.getShortcuts()[0] instanceof KeyboardShortcut)) return Event.CTRL_MASK; @@ -533,15 +533,24 @@ public class Switcher extends AnAction implements DumbAware { } } + KeyEvent lastEvent; public void keyPressed(KeyEvent e) { - if (mySpeedSearch != null && mySpeedSearch.isPopupActive()) return; - + if ((mySpeedSearch != null && mySpeedSearch.isPopupActive()) || lastEvent == e) return; + lastEvent = e; switch (e.getKeyCode()) { case VK_UP: - goBack(); + if (!isPinnedMode()) { + goBack(); + } else { + getSelectedList().processKeyEvent(e); + } break; case VK_DOWN: - goForward(); + if (!isPinnedMode()) { + goForward(); + } else { + getSelectedList().processKeyEvent(e); + } break; case VK_ESCAPE: cancel(); @@ -690,11 +699,11 @@ public class Switcher extends AnAction implements DumbAware { list.ensureIndexIsVisible(index); } - public JList getSelectedList() { + public MyList getSelectedList() { return getSelectedList(files); } - JList getSelectedList(JList preferable) { + MyList getSelectedList(MyList preferable) { if (toolWindows.isSelectionEmpty() && files.isSelectionEmpty()) { if (preferable != null && preferable.getModel().getSize() > 0) { preferable.setSelectedIndex(0); @@ -715,25 +724,29 @@ public class Switcher extends AnAction implements DumbAware { } void navigate() { - final Object value = getSelectedList().getSelectedValue(); + final Object[] values = getSelectedList().getSelectedValues(); myPopup.closeOk(null); - if (value instanceof ToolWindow) { - ((ToolWindow)value).activate(null, true, true); - } - else if (value instanceof FileInfo) { - final FileInfo info = (FileInfo)value; + if (values.length > 0 && values[0] instanceof ToolWindow) { + ((ToolWindow)values[0]).activate(null, true, true); + } else{ IdeFocusManager.getInstance(project).doWhenFocusSettlesDown(new Runnable() { @Override public void run() { final FileEditorManagerImpl manager = (FileEditorManagerImpl)FileEditorManager.getInstance(project); - if (info.second != null) { - EditorWindow wnd = findAppropriateWindow(info); - if (wnd != null) { - manager.openFileImpl2(wnd, info.first, true); - manager.addSelectionRecord(info.first, wnd); + for (Object value : values) { + if (value instanceof FileInfo) { + final FileInfo info = (FileInfo)value; + + if (info.second != null) { + EditorWindow wnd = findAppropriateWindow(info); + if (wnd != null) { + manager.openFileImpl2(wnd, info.first, true); + manager.addSelectionRecord(info.first, wnd); + } + } else { + manager.openFile(info.first, true); + } } - } else { - manager.openFile(info.first, true); } } }); @@ -741,7 +754,7 @@ public class Switcher extends AnAction implements DumbAware { } @Nullable - private EditorWindow findAppropriateWindow(FileInfo info) { + private static EditorWindow findAppropriateWindow(FileInfo info) { if (info.second == null) return null; final EditorWindow[] windows = info.second.getOwner().getWindows(); return ArrayUtil.contains(info.second, windows) ? info.second : windows.length > 0 ? windows[0] : null; @@ -863,7 +876,7 @@ public class Switcher extends AnAction implements DumbAware { @Override public void propertyChange(PropertyChangeEvent evt) { - final JList list = getSelectedList(); + final MyList list = getSelectedList(); final Object value = list.getSelectedValue(); ((NameFilteringListModel)files.getModel()).refilter(); ((NameFilteringListModel)toolWindows.getModel()).refilter(); @@ -912,4 +925,15 @@ public class Switcher extends AnAction implements DumbAware { super(first, second); } } + + private static class MyList extends JBList { + public MyList(DefaultListModel model) { + super(model); + } + + @Override + public void processKeyEvent(KeyEvent e) { + super.processKeyEvent(e); + } + } } From 011acc736b5f894d692a52aa7f4e416f205ed96b Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 19 Apr 2012 13:51:58 +0400 Subject: [PATCH 14/36] running tests on their own classpath --- .../android/testSrc/org/jetbrains/android/AndroidTestCase.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/android/testSrc/org/jetbrains/android/AndroidTestCase.java b/plugins/android/testSrc/org/jetbrains/android/AndroidTestCase.java index 563eb772b0ff..644b260dd43d 100644 --- a/plugins/android/testSrc/org/jetbrains/android/AndroidTestCase.java +++ b/plugins/android/testSrc/org/jetbrains/android/AndroidTestCase.java @@ -32,6 +32,7 @@ import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.testFramework.IdeaTestCase; import com.intellij.testFramework.UsefulTestCase; import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; import com.intellij.testFramework.fixtures.*; @@ -56,6 +57,7 @@ public abstract class AndroidTestCase extends UsefulTestCase { public AndroidTestCase(boolean createManifest) { this.myCreateManifest = createManifest; + IdeaTestCase.initPlatformPrefix(); } public AndroidTestCase() { From 4027275217e157869795fb08554b2c88fd2d40f9 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 19 Apr 2012 14:14:18 +0400 Subject: [PATCH 15/36] fixed inspection wrapping in tests --- .../fixtures/impl/CodeInsightTestFixtureImpl.java | 15 ++++++--------- .../testData/intentions/SwitchOnResourceId.java | 2 +- plugins/devkit/resources/META-INF/plugin.xml | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index e5617331c742..94efea1a09fa 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -146,8 +146,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig private boolean myEmptyLookup; private InspectionProfileEntry[] myInspections; - private final Map myAvailableTools = new THashMap(); - private final Map myAvailableLocalTools = new THashMap(); + private final Map myAvailableTools = new THashMap(); private final TempDirTestFixture myTempDirFixture; protected final IdeaProjectTestFixture myProjectFixture; @@ -272,7 +271,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig @Override public void disableInspections(InspectionProfileEntry... inspections) { myAvailableTools.clear(); - myAvailableLocalTools.clear(); final ArrayList tools = new ArrayList(Arrays.asList(myInspections)); for (Iterator i = tools.iterator(); i.hasNext();) { final InspectionProfileEntry tool = i.next(); @@ -1069,8 +1067,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig myEditor = null; myFile = null; myPsiManager = null; + myInspections = null; - myAvailableLocalTools.clear(); myAvailableTools.clear(); myProjectFixture.tearDown(); @@ -1086,7 +1084,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig String id = tool instanceof LocalInspectionTool ? ((LocalInspectionTool)tool).getID() : shortName; HighlightDisplayKey.register(shortName, tool.getDisplayName(), id); } - myAvailableTools.put(shortName, tool); InspectionTool inspectionTool; if (tool instanceof LocalInspectionTool) { LocalInspectionEP ep = myExtensions.get(tool.getShortName()); @@ -1095,7 +1092,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig else { inspectionTool = (InspectionTool)tool; } - myAvailableLocalTools.put(shortName, inspectionTool); + myAvailableTools.put(shortName, inspectionTool); } private void configureInspections(final InspectionProfileEntry[] tools) { @@ -1114,7 +1111,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig @Override @NotNull public InspectionProfileEntry[] getInspectionTools(PsiElement element) { - final Collection tools = myAvailableLocalTools.values(); + final Collection tools = myAvailableTools.values(); return tools.toArray(new InspectionTool[tools.size()]); } @@ -1148,8 +1145,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig } @Override - public InspectionTool getInspectionTool(@NotNull String shortName, @NotNull PsiElement element) { - return myAvailableLocalTools.get(shortName); + public InspectionProfileEntry getInspectionTool(@NotNull String shortName, @NotNull PsiElement element) { + return myAvailableTools.get(shortName); } }; final InspectionProfileManager inspectionProfileManager = InspectionProfileManager.getInstance(); diff --git a/plugins/android/testData/intentions/SwitchOnResourceId.java b/plugins/android/testData/intentions/SwitchOnResourceId.java index c337a882e147..6f9e7275f4fc 100644 --- a/plugins/android/testData/intentions/SwitchOnResourceId.java +++ b/plugins/android/testData/intentions/SwitchOnResourceId.java @@ -3,7 +3,7 @@ package p1.p2; public class Test1 { public void f(int n) { switch (n) { - case R.drawable.icon: + case R.drawable.icon: System.out.println("Icon"); break; } diff --git a/plugins/devkit/resources/META-INF/plugin.xml b/plugins/devkit/resources/META-INF/plugin.xml index 7a2ea5d49803..f7bd8c9d1061 100644 --- a/plugins/devkit/resources/META-INF/plugin.xml +++ b/plugins/devkit/resources/META-INF/plugin.xml @@ -69,7 +69,7 @@ groupKey="inspections.group.name" displayName="<inspection> tag consistency" enabledByDefault="true" - level="ERROR" + level="WARNING" implementationClass="org.jetbrains.idea.devkit.inspections.InspectionMappingConsistencyInspection"/> From f4cf77fb68bfa8f41a116a94827b410b00144636 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 19 Apr 2012 11:23:15 +0200 Subject: [PATCH 16/36] capture wildcard for getClass calls --- .../impl/source/tree/java/PsiMethodCallExpressionImpl.java | 3 ++- .../daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java | 7 +++++++ .../daemonCodeAnalyzer/advHighlighting7/MultiCatch.java | 4 ++-- .../codeInsight/daemon/LightAdvHighlightingJdk7Test.java | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodCallExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodCallExpressionImpl.java index 9065941b38d8..d81315273b8d 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodCallExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodCallExpressionImpl.java @@ -200,8 +200,9 @@ public class PsiMethodCallExpressionImpl extends ExpressionPsiElement implements Map map = new HashMap(); map.put(javaLangClass.getTypeParameters()[0], PsiWildcardType.createExtends(manager, qualifierType)); PsiSubstitutor substitutor = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createSubstitutor(map); - return JavaPsiFacade.getInstance(manager.getProject()).getElementFactory() + final PsiClassType classType = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory() .createType(javaLangClass, substitutor, languageLevel); + return PsiUtil.captureToplevelWildcards(classType, methodExpression); } } } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java new file mode 100644 index 000000000000..e47447315a1e --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java @@ -0,0 +1,7 @@ +import java.lang.reflect.*; + +class Example { + private void demo() { + TypeVariable>[] typeParameters = getClass().getTypeParameters(); + } +} diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/MultiCatch.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/MultiCatch.java index 84798f6d3a43..861fb4d5da27 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/MultiCatch.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/MultiCatch.java @@ -60,8 +60,8 @@ abstract class C { try { g(); } catch (IE1 | IE2 e) { Class clazz1 = e.getClass(); - Class clazz2 = e.getClass(); - Class clazz3 = e.getClass(); + Class clazz2 = e.getClass(); + Class clazz3 = e.getClass(); } } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java index b5c0c7d8ae7e..1ae74c1fee54 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java @@ -304,5 +304,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase { } public void testIDEA84533() throws Exception { doTest(false, false); } + + public void testClassLiteral() throws Exception { doTest(false, false);} } From 817fc5aae4aefbd2c18abd3de59272e8546ebd75 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 19 Apr 2012 12:38:58 +0200 Subject: [PATCH 17/36] simlify ? super ? wildcard (IDEA-63765) --- .../psi/util/TypesDistinctProver.java | 3 ++- .../intellij/psi/impl/PsiSubstitutorImpl.java | 1 + .../advHighlighting7/ClassLiteral.java | 3 ++- .../genericsHighlighting/UncheckedCasts.java | 2 +- java/mockJDK-1.7/jre/lib/rt.jar | Bin 759683 -> 760482 bytes 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java b/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java index 8c354a5daa31..89e6caad21ad 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java +++ b/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java @@ -40,7 +40,8 @@ public class TypesDistinctProver { } if (type2 instanceof PsiCapturedWildcardType) { - return provablyDistinct((PsiWildcardType)type1, ((PsiCapturedWildcardType)type2).getWildcard()); + return ((PsiWildcardType)type1).isExtends() || + provablyDistinct((PsiWildcardType)type1, ((PsiCapturedWildcardType)type2).getWildcard()); } if (type2 instanceof PsiClassType) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java index 4634c7eb8f88..feb757c54883 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java @@ -156,6 +156,7 @@ public class PsiSubstitutorImpl implements PsiSubstitutor { if (wildcardType.isExtends() != wildcard.isExtends()) { return wildcard.isBounded() ? PsiWildcardType.createUnbounded(wildcardType.getManager()) : newBound; } + if (!wildcard.isBounded()) return PsiWildcardType.createUnbounded(wildcardType.getManager()); } return PsiWildcardType.changeBound(wildcardType, newBound); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java index e47447315a1e..6dc9fd8734f3 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ClassLiteral.java @@ -2,6 +2,7 @@ import java.lang.reflect.*; class Example { private void demo() { - TypeVariable>[] typeParameters = getClass().getTypeParameters(); + TypeVariable>[] typeParameters = getClass().getTypeParameters(); + Object typeParameters1 = (TypeVariable>[]) getClass().getTypeParameters(); } } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/UncheckedCasts.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/UncheckedCasts.java index 6b00dc69bfe8..76ab83f8b925 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/UncheckedCasts.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/UncheckedCasts.java @@ -45,7 +45,7 @@ class AllPredicate } public static void foo(SortedMap sourceSortedMap) { - new TreeMap((Comparator) sourceSortedMap.comparator()); + new TreeMap((Comparator) sourceSortedMap.comparator()); } } diff --git a/java/mockJDK-1.7/jre/lib/rt.jar b/java/mockJDK-1.7/jre/lib/rt.jar index 092cc248e10cf9e10a51ac9ea892398ea797db0b..b0f53dc9a037b542ee0bf5de8dc88f8b74c9c29e 100644 GIT binary patch delta 6699 zcmZ`-2Ut}{)4q2P+_snA`=u8ZFbE1t@4Xj65JW^25fD&O5EQJSh|1VOW1>-16cuBO zCDEuMf{BT}CH7eO)K86~|D1aWT>n2m&vT#UeP?!Nc6WAm_srYvxOu;0RSkb1X)gyo zWqNPHu5yAu27gNUQ|{PRE^yS;=81UmdNaJ9iuJx~0?8xPmErlJIH)MI;e_c6>AJJ`bu(~cjtGH9i>BnM|o-l_&9z)ml_MRNM z>4!BcPX=w;uyEarRUz4PjBJd@8~A<7&GWK<@@{g}=<^fLF5la_eDvd%`z=uqRf5k% z8rV%z^$XW<*r*}+6#ug4q~P$quR~9`ic}5l=1;0|SSvg1qrB_rs^$_S4&z9zxREBzEX+yDD$dIqm!HFpu|C!_`joSJ#qUjPSMJv3Q_c4FhU%TZ zQoFgfa{vnj%k`j;A}ZD1(`lo z2Ujg>NLp(kR*MEPhiVBttsy3GHXcQ1P$cc1Pk58E%CemDraD1`0o8>nAytBFYl*rF zE>+)O$2tO!*K#(c5T#8`Nl*(EXwwk>C+N_oG0ghS1TJhMW~^5!ocWq)OaJN2<89pv zi8?fZsC@(L*mm1?xT8ZO_#ePgmu4_e+X%?ohzxe?QU|hNA6(O=flU2=0>}3eL-5q2 z4$SETa-|@KKLOFtgtf*!^E(1%=i)xN3bI_qw;R0q2?7 z{x^Xe?}$0PQ^nw%4RL^a1}Ja*2rdRRkpBv18qjdkXauJXs1LE0fyj^skwY?wF+@Di z8X66$8?(cjftyy04J2n!V^A@os^q|M&@jeGh8bbxkL17{R^?JHupPl@(Sa!tfVwfY zfYBou4VWmU(k2rO;x_$*^YwF8*Ut?hTHAV}@SW_=1 zW<?+vj{TemlBznER)@!z}S9)OyNoeW+ls9TCKqFU67f)fnzdVXfheUSwVb_6@R(4 zPwYTdAb1#!AQN`;1YSq^-~f+at3Kz#&)1s6Cliv_h8IWQ>_?Qj28NmW(9 zzm#pMo_~pz=8?shIjtk^*ro9r2d+9$4fx59T0)u!#^rs7rA=YkZA`BX9=KW!&sata zE=3}@|-HVi`g(ld@u3Bs;zJskLf1>e5nfXXZEFftf@|NVwznuAfC`ES53Z_5EpcPA(tEciTiz9FysZ%<~aAiZzj_7>uR1^mB za})}A3Cjb| z7`!lZtUA=(2DduMt zs4UYn?d)%3!ubS!&q2k1c_4h| zykqIVIsd<}hktczDe#cH?Q2=L+U$@;BHpmIY0j`B9v9)SWw1M*1~7{o1kg|~FlUc_ z`L)8Fs5OFr0u5%uR|p`sL7)piru}n`Y)`E2WnTZoB-21r z^`cLlOx0jVGTwT>`T2^(r74CW+sH$ z#zIr@NXJ{#7 ziE$C!GZ9*wuzO3J5Uw;)fA+m(%H-}9!t^HU4zCTVKAcO%`?+2x%*(*>cy+>|4C+hH zbwY0jmW+{I5IPp`*|}X%JC>#}2MHG=k<#bk=ZR z2xezcXW*v#E)yr>?i(Q#T}Hk`3+Ki^3#mP7BFN0bM@)#e2)1R>Va!zg=T;W=X7=ca zzISN zEns0bN4CxCq(E|z{SSG=C0(Sh@c6W<;Iz8gE+6{9#te*p&}8bsZ-wJi z@B$GvPNWGHNRZXFoc__tbQr0q!+1rbUyA!^W_}VoKJ_7 zeJlEbGHjkkHMzjT%RUS2{3=dsN|{IpBBr40xHTM8H-);8ahq5WN*cCsq^tl}A!C~y zG%XT|p`rlSv1*41)ar1J|1QGucNO3UI&}bE6kw$>I0Rl(vC>rE5`p@0oZR(O(MQc| z=qbcJyEzr3j(EcYeXuK}LrMEP4oqXg=?@$@#)5O7SP;tW<%_}hF6LZX5xO?S`!^yz zIR2+d2+1WlIR}a`dD$cN#C?%18xkg(SPVlSi)gR)MGrq<*ZHD>%Sc6*z#O=Jz2|NnIJ8dO31~!b%!NidVw%N}9_&0y%35 zJ~d(`Xr6(Sz9t4kZ>dD5xpQ#UJvS(7?3jb5mVP-vnZt&8m>|QeP_=9O0IvZHt1$J> z?H!=h;e8c`we~7Wm&6BJFbm2q|u0+T0V(31D zE1_SDvKJh3gITq>ys!R{%iQ4G@5K~8u?l_<=P-eNvFF8pUv7rzrLR)2|sg6dE2#2N~! zIq$`aU%T!#)nh5dQJKKj_h_?aF_z0~rv3e0xX*|3)EUH=D01Rw}x2i-93hU5S%NPB$F}o*o>1(+Dj~l2b8M}@H;@J`@*d<|v>B~{aXCq4+!RqC>iK=!< zKy4W=9!4dF7p%NsH>fwVwP}w8vKldt!bXhDx*gUx;(epwBHV7on{wMPV7mgZS&$PUwh|A$$sH06xNd+ZpRYiZx392t5c%*2B(Fpxu7AP0m3VQ#@E6=$ ziAI(@lYrp`i6K|+B3EITKcB;tRk-yWdn9nQTcQu0t8n*J3n~1)ijHvHC8WH_zy#kR np;19jk-kx(L4olJj*&qz;mQK`J+za*lb_Sbt delta 6030 zcmY*d30PFevX(wDb7q=V_JLss6=ib;lmIR$B8ZCOf*VnkfPxWJL#=4 zOH6VTm#9Ra3DN8~Y9xC!D&~3B#283iaK%?WJ>uy1jfelQ>guZM>h3z{Ux&k&?+Y(q zVReYTzqoQoDWji4KWqBgH0&tVbn9Gst5(x+t5$o!5C4s{@~w+n}%{>~HAJlF&H0;^0J#B>}i`j1t-BkXYEzY`e6@CV8jUrcWVE^{zabom`Id zt~^OOyMp1TmCT6uyt%E^8|6lN*H&VV8-IbF-iCMGNIz>Q?z!<{R<1~N=jqD9-3&+n z#eA{Pm4-!nlljAMGDq7^9sfRj1DD+SU?q4jLyxzZC*nPLDEsIw;}dp3a`^Nwe>GA2U7q5cc{Z{98PKJ&aqPJcS)QhXez8{q=c<6X%&LUNi8% z%Er44^=&K&<(}LT+=~nxXhVS)cSD>Pk7OU;7hr_4_c6o1c4ojSH=6B=7xz*0whEl= z6kp`H(9quAG<2^4>E1kn_4ma_Z=S@?`r@3x^+E79(rhP!6nq)1grL+&0iEg#M?db4 zj|6yP2Hw$%BOV&K9ejMak$Fc;9isJ^;=}v1oEQtHCRXthuG^y3m-2Ychn(2cUn&@U zc`W;RfCO`VX=r=A0G===D*hd#d|1>#L8n{g!@-Yx;M5RBhdTz|8JqpMkJUa*_v8Nf z-jDZXcao&FKz|A*dYFRvWQ9`a&qI|7$qJ?oS0ZF0|MceuMVq3)euPjE4#osf&O$~g z2ur1$l?2e3)-(leBNab*Oy&kO2k;Q~%}A($d=N{^Kx!am?&L(&2J#`wxFQ9Uixneo z2U4;Ui{Tf<6P4!I6kOY>1jYA9v+ zL7RyWgE4^zAhJJ|0PjvoDC-RWaPExQ?tB9K#~=aswssU_15g-6iWh}qMu?Qz_2A=~ zdshh}yIC8A#V+`>yR{v@?7?l>txzHJM_Uit(BWYcXh&)sP@g~^8+uvW+go}Z&{L=c z;Kwl1zt~%VJhrc&cn0D?IFa#j68J_C@E9aPjQ|6aC3q;nk&zNyO1IX@xwb}<;|s@0 zdRHdV&5=|om6Ij2e+n^aQN&!CAsM?IVvY-@I$tvWJ<0N>A_-~*_tlQ zTrw`HJOT%zNvEMvGB=|sf-g>*!6!7JHI?kFjuASaN&3R)M4yf!J8yj{nTS|&Zui#` zY!hI|83}Cq6L_^rf5&IM>~?*5I?h ztZ9SBJ*~xtIP&MrU(e(>TckXJUAt>yk^TZtXBq7h#OrPJXcSC{4o>lWCewPMVlekb z4{sZz+#u)T$tJudeIb;G%CaAnAn0I8FH7K)*jJGf{1s(mkQEl2NIJfWk}ggpoe{$& z_&bqLWMLT+BurILjloNXlqS1vfchFjFpKqf|*=ixfQX%uhhs!96GlMAc zeJdmrIhc=RYqtn6n=RNUO}x6_#sQu~NNw36!FXc*e{8I=Xb6?aystVKN8AuPJAV-g zalz4ZHg0enO^dxWiRP^O6_+q90FG@EbQ?}!=>rMs1n_MaAdj_M!D$qoO$o`|0fi|f zF={#(JDg9Uu&z0om^x>Tsqhn6qN^Z$@XiR*kN1#($~~ERc}oy))R<4tcT*|e@d1)v z5~wlNd;)tEBAN6w8a2Cz1l3_AHl3%}(`eM@o|2}TkHGL4jXkE0q{DA?w4|#>($J7N z32qB8eV_!B(+RW;mEdy$uA~Z(&lY5er#D_5MRB>z6u=o_IT{bKI0@|kawPL;mc~yw zVnC}0HC=Cxrb}kpY!QdHMKePykKk z=$}E`;&ugUGWbBYcsZIf_$ZdQ5(H3VhqB)5p^oQ??Atn|jOSU({dx_;c4*vjKc8;+)8pxe z-+n}cvqv>X@CkHvZv8}qQ=e;maNnI2v`rcpyN+wE)78@&7@9Qx*gBsYs6!KI;>q9O z>;&?2+BvvPq$j@tt4Y+86i(z(?4k*T;H!z$isarDl5uQrn|QjTa1xJHjy}?08q>Ps zgGoGD+4wf)3T1!jClk8EOvnWVlld?uwzC# z-A3;u@pQwPsl2!H`cN%?8m=`jTkJHt$G;k;#p4vMw;1h+p_8KfZX8?*5{K@Si~yYCMj-8GO9*$%mAH3v{a9TTb~hy#xF` zgBFN=0lS%$pp2ijc+#ddTF6(nJ*1c&zR8()0z>Bj(S`j~Il; z96ASQ&7$F%PqbJui{2JiF%?k(svmC5qN(TFsqhR_eMB$qh@{!vzy~_2Pfg&p4YVgK ziDfA+czrfyW}Pdp&ZbUrpgY2HDMFVZ6^(<`0Bp-8bN>^pB7F$?M#dd+FPA3H>Y_qB z^r^ds;i{wiv)W!3+A&vt1a>=-x2s;FK^5Iq^hi-Xar`B!ldN92{u1r4l0N90NBeD3 zUo6QJ<=+n<=h1#U77JZI^@>RJ+!zro}54w;SHq%tgI>}AI#e8a&GX|-6 zl1)=k8bjH-B;?JZ@YW8+dvj<3>QYoB=8;r4m!$0(=rfm&l$SHHa4z-q+cHVIRCUJq zg{tW_#1@z4Qt{VKHu1jjEfBe#VnQC6QNVjCKG|k;uz>ed^f@Nv4yBMbWJ|t^rcJ6l zQVU6Qd4U;iE96nirgE7NFl#>9qB>!npgt`zQEnJhMz1EV zo5kzSJj&?z6{ZQD;r=r3qp+1`^zk0m1-e2i-dA3x0M4#9^XvAiIyAma2LGv2vEv=p zAhhh@Jf9ntK2XtogqGAq1szkJE#6A2wxN7JAE?}FRPov+%HYNMWaaJ;Dt6zYf~PvO z#ke-r@`U^7Clx1LbnYl`Q?&>wqD8AHBAal>wDlUJRQTYNMqd4DuhHUWj0$Pj6R!b^$ zAyNDPF;QKydLb>H+Z_{%z#j|Ay3;)s6(w}4L@eTQipzZy@^mE*U(AE>poGq#MS2M)F6O=2NCyEjSyxv{ z+Lcmye&#O0{8HYF4Kqk^s+7mDMxz8ZaXJSqDdo0xOQ|r1FQJVc=?}l9G)H@aPL{Gs z^tKSC1xu0l5S`vsBqZ`-Yr6?{89UhnyOz?`?bB1>E@&C0)1dz{+Agf09Cvn{&J6<= zm}fh%j7$!Wk)pqsk&C(gB?zBFBh$->nf5{lBmKmuWmJ}f6Lq3M-0-lBJ~qsogs^hD zF2-l!z$&_{s>^B4sw{j^PA%xilLhI6UKK<>Fo7U^xm0I|^@54b7UCc@SMYx9g;^ay zi@~qZ`CmE5f(a96`s^BA5PqIYf0eJJlwEy=g1A!jyw(6VX^~_c-_coP({gfh-%<!$bxXGlIWX)9mUDdvoybmZ7a$B}t7yQjT>@mY#y2E6rIJEPtEA@VKkr#EWZVrcl{Dvq1A-1h z#A}m(&fL%Jh4Qe%ddlXhv6lZ^bUgn0F8d{j^)#Pr}pU=x|5K%+B z@E17Fxg8lGBd#4M)iS3ZS$-ozEH%!=AG+)n01Fh3g$Gl6!JJ zS?KI6WWCVRla|_)_#-iT7mLH+$AF3|s*X!Bl*QQ_D2q#cv3UcXO>3g?;|98`7xjei zM(R3UdeN)tXnlaV9&Ay+kq(xuF*v%BuJQUAaNI(D$J7;iY60g_&Z9Qb z=xsa3`>=0H1U-Q@m5Qf7s<%*UeQ=ooUO2afR`s8Cu&v{R?VD@$vR^7L%B3deNdfJo zqB?PEZPcUXfSlPD9}&f{2^Z_=a%?`RN7c7_1L8nA3OIyZP}AXbM33V?=uMx=Y;h4Z zAf^GMwvxg7KT?gDKH)}fC3^HRK_{`fpQ3&%bwY2R!iBBWmnNP@mwMW2kI!Isz4#t@ zRu8LInn#@Z__3ab?rOr_dOk?Gbxn@}+jz8x-*tVb)FBy(VaaJp5vhr3$w@=TWQ38qwyx RWA%>J{0*HtJ+R?~{vU0_W*7hf From 98daba8011d6ef98803698e275158ea9c2da7e7d Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 19 Apr 2012 14:52:50 +0400 Subject: [PATCH 18/36] test fixed --- .../com/intellij/openapi/vfs/local/LocalFileSystemTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java index 76f2f10ef1f1..ead2bc9a67ae 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java @@ -326,7 +326,10 @@ public class LocalFileSystemTest extends PlatformLangTestCase { if (!SystemInfo.isWindows) return; File file = new File("c:\\Documents and Settings\\desktop.ini"); VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); - assertNotNull("File not found: " + file, virtualFile); + if (virtualFile == null) { + System.out.println("NO LUCK: " + file); + return; + } NewVirtualFileSystem system = (NewVirtualFileSystem)virtualFile.getFileSystem(); system = PersistentFS.replaceWithNativeFS(system); From efa7f1fccf51ef1a83266e815d124c782c2a0815 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 19 Apr 2012 11:00:08 +0200 Subject: [PATCH 19/36] Typos --- .../openapi/diff/impl/DiffPanelImpl.java | 34 +++++++++---------- .../impl/incrementalMerge/ui/MergePanel2.java | 14 ++++---- ...nent.java => DiffPanelOuterComponent.java} | 16 ++++----- 3 files changed, 31 insertions(+), 33 deletions(-) rename platform/platform-impl/src/com/intellij/openapi/diff/impl/util/{DiffPanelOutterComponent.java => DiffPanelOuterComponent.java} (93%) diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java index 1c706ff80a7b..3cdc48f03a2a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -75,7 +75,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.diff.impl.DiffPanelImpl"); private final DiffSplitterI mySplitter; - private final DiffPanelOutterComponent myPanel; + private final DiffPanelOuterComponent myPanel; private final Window myOwnerWindow; private final DiffPanelOptions myOptions; @@ -91,7 +91,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid private final FontSizeSynchronizer myFontSizeSynchronizer = new FontSizeSynchronizer(); private DiffRequest myDiffRequest; private boolean myIsRequestFocus = true; - private boolean myIsSynchScroll; + private boolean myIsSyncScroll; private static final DiffRequest.ToolbarAddons TOOL_BAR = new DiffRequest.ToolbarAddons() { public void customize(DiffToolbar toolbar) { @@ -102,20 +102,19 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid private boolean myDisposed = false; private final GenericDataProvider myDataProvider; private final Project myProject; - private final boolean myIsHorisontal; + private final boolean myIsHorizontal; private CanNotCalculateDiffPanel myNotCalculateDiffPanel; - private DiffIsApproximate myDiffIsApproximate; private final VisibleAreaListener myVisibleAreaListener; - public DiffPanelImpl(final Window owner, Project project, boolean enableToolbar, boolean horisontal) { + public DiffPanelImpl(final Window owner, Project project, boolean enableToolbar, boolean horizontal) { myProject = project; - myIsHorisontal = horisontal; + myIsHorizontal = horizontal; myOptions = new DiffPanelOptions(this); - myPanel = new DiffPanelOutterComponent(TextDiffType.DIFF_TYPES, TOOL_BAR); + myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, TOOL_BAR); myPanel.disableToolbar(!enableToolbar); if (enableToolbar) myPanel.resetToolbar(); myOwnerWindow = owner; - myIsSynchScroll = true; + myIsSyncScroll = true; myLeftSide = new DiffSideView("", this); myRightSide = new DiffSideView("", this); myLeftSide.becomeMaster(); @@ -123,9 +122,9 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid myData = createDiffPanelState(this); - if (horisontal) { + if (horizontal) { mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(), - new DiffDividerPaint(this, FragmentSide.SIDE1), myData); + new DiffDividerPaint(this, FragmentSide.SIDE1), myData); } else { mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent()); @@ -164,7 +163,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid } public boolean isHorisontal() { - return myIsHorisontal; + return myIsHorizontal; } public DiffPanelState getDiffPanelState() { @@ -172,7 +171,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid } public void noSynchScroll() { - myIsSynchScroll = false; + myIsSyncScroll = false; } public DiffSplitterI getSplitter() { @@ -298,8 +297,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid public void setPatchAppliedApproximately() { if (myNotCalculateDiffPanel == null) { - myDiffIsApproximate = new DiffIsApproximate(); - myPanel.insertTopComponent(myDiffIsApproximate); + myPanel.insertTopComponent(new DiffIsApproximate()); } } @@ -402,7 +400,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid public void onContentChangedIn(EditorSource source) { myDiffUpdater.contentRemoved(source); final EditorEx editor = source.getEditor(); - if (myIsHorisontal && source.getSide() == FragmentSide.SIDE1 && editor != null) { + if (myIsHorizontal && source.getSide() == FragmentSide.SIDE1 && editor != null) { editor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT); } DiffSideView viewSide = getSideView(source.getSide()); @@ -425,7 +423,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid Editor editor1 = getEditor(FragmentSide.SIDE1); Editor editor2 = getEditor(FragmentSide.SIDE2); - if (editor1 != null && editor2 != null && myIsSynchScroll) { + if (editor1 != null && editor2 != null && myIsSyncScroll) { myScrollSupport.install(new EditingSides[]{this}); } @@ -572,7 +570,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid myIsRequestFocus = isRequestFocus; } - private class MyScrollingPanel implements DiffPanelOutterComponent.ScrollingPanel { + private class MyScrollingPanel implements DiffPanelOuterComponent.ScrollingPanel { public void scrollEditors() { getOptions().onNewContent(myCurrentSide); diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java index 45694aea4256..37bcf703b30e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -64,7 +64,7 @@ import java.util.Collection; public class MergePanel2 implements DiffViewer { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.diff.impl.incrementalMerge.ui.MergePanel2"); - private final DiffPanelOutterComponent myPanel; + private final DiffPanelOuterComponent myPanel; private DiffRequest myData; private MergeList myMergeList; private boolean myDuringCreation = false; @@ -109,7 +109,7 @@ public class MergePanel2 implements DiffViewer { myEditorsPanels[i].setComponent(editorPlace); } FontSizeSynchronizer.attachTo(editorPlaces); - myPanel = new DiffPanelOutterComponent(TextDiffType.MERGE_TYPES, TOOLBAR); + myPanel = new DiffPanelOuterComponent(TextDiffType.MERGE_TYPES, TOOLBAR); myPanel.insertDiffComponent(new ThreePanels(myEditorsPanels, myDividers), new MyScrollingPanel()); myProvider = new MyDataProvider(); myPanel.setDataProvider(myProvider); @@ -328,7 +328,7 @@ public class MergePanel2 implements DiffViewer { } } - private class MyScrollingPanel implements DiffPanelOutterComponent.ScrollingPanel { + private class MyScrollingPanel implements DiffPanelOuterComponent.ScrollingPanel { public void scrollEditors() { Editor centerEditor = getEditor(1); JComponent centerComponent = centerEditor.getContentComponent(); @@ -504,9 +504,9 @@ public class MergePanel2 implements DiffViewer { } private static class StatusUpdater implements ChangeCounter.Listener { - private final DiffPanelOutterComponent myPanel; + private final DiffPanelOuterComponent myPanel; - private StatusUpdater(DiffPanelOutterComponent panel) { + private StatusUpdater(DiffPanelOuterComponent panel) { myPanel = panel; } @@ -527,7 +527,7 @@ public class MergePanel2 implements DiffViewer { ChangeCounter.getOrCreate(mergeList).removeListener(this); } - public static StatusUpdater install(MergeList mergeList, DiffPanelOutterComponent panel) { + public static StatusUpdater install(MergeList mergeList, DiffPanelOuterComponent panel) { ChangeCounter counters = ChangeCounter.getOrCreate(mergeList); StatusUpdater updater = new StatusUpdater(panel); counters.addListener(updater); diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/DiffPanelOutterComponent.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/DiffPanelOuterComponent.java similarity index 93% rename from platform/platform-impl/src/com/intellij/openapi/diff/impl/util/DiffPanelOutterComponent.java rename to platform/platform-impl/src/com/intellij/openapi/diff/impl/util/DiffPanelOuterComponent.java index 889c5f9e8428..0e377859ca00 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/DiffPanelOutterComponent.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/DiffPanelOuterComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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,7 +29,7 @@ import javax.swing.*; import java.awt.*; import java.util.List; -public class DiffPanelOutterComponent extends JPanel implements DataProvider { +public class DiffPanelOuterComponent extends JPanel implements DataProvider { private final DiffStatusBar myStatusBar; private final DiffToolbarComponent myToolbar; private final DiffRequest.ToolbarAddons myDefaultActions; @@ -43,7 +43,7 @@ public class DiffPanelOutterComponent extends JPanel implements DataProvider { private int myPrefferedWidth; private Getter myDefaultHeight; - public DiffPanelOutterComponent(List diffTypes, DiffRequest.ToolbarAddons defaultActions) { + public DiffPanelOuterComponent(List diffTypes, DiffRequest.ToolbarAddons defaultActions) { super(new BorderLayout()); myStatusBar = new DiffStatusBar(diffTypes); myBottomContainer = new JPanel(new BorderLayout()); @@ -203,7 +203,7 @@ public class DiffPanelOutterComponent extends JPanel implements DataProvider { private interface DeferScrollToFirstDiff { DeferScrollToFirstDiff scrollNow(ScrollingPanel panel, JComponent component); - void deferScroll(DiffPanelOutterComponent outter); + void deferScroll(DiffPanelOuterComponent outer); } public interface ScrollingPanel { @@ -215,7 +215,7 @@ public class DiffPanelOutterComponent extends JPanel implements DataProvider { return NO_SCROLL_NEEDED; } - public void deferScroll(DiffPanelOutterComponent outter) { + public void deferScroll(DiffPanelOuterComponent outer) { } }; @@ -226,11 +226,11 @@ public class DiffPanelOutterComponent extends JPanel implements DataProvider { return NO_SCROLL_NEEDED; } - public void deferScroll(final DiffPanelOutterComponent outter) { - if (!outter.isDisplayable()) return; + public void deferScroll(final DiffPanelOuterComponent outer) { + if (!outer.isDisplayable()) return; SwingUtilities.invokeLater(new Runnable() { public void run() { - outter.performScroll(); + outer.performScroll(); } }); } From aa9d51ad825c372a3cea8ecf32d18f0e0f7cefb0 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 19 Apr 2012 11:11:10 +0200 Subject: [PATCH 20/36] Fix NPE in diff --- .../src/com/intellij/openapi/diff/DiffApplication.java | 7 ++++--- .../src/com/intellij/openapi/diff/SimpleDiffRequest.java | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java b/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java index e81347ff2d80..1df743e95664 100644 --- a/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java +++ b/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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. @@ -110,10 +110,11 @@ public class DiffApplication implements ApplicationStarterEx { final DirDiffSettings settings = new DirDiffSettings(); settings.showInFrame = false; diffManager.showDiff(d1, d2, settings, null); - } else { + } + else { file1.refresh(false, false); file2.refresh(false, false); - SimpleDiffRequest request = SimpleDiffRequest.compareFiles(file1, file2, null); + SimpleDiffRequest request = SimpleDiffRequest.compareFiles(file1, file2, ProjectManager.getInstance().getDefaultProject()); request.addHint(DiffTool.HINT_SHOW_MODAL_DIALOG); DiffManager.getInstance().getIdeaDiffTool().show(request); FileDocumentManager.getInstance().saveAllDocuments(); diff --git a/platform/platform-api/src/com/intellij/openapi/diff/SimpleDiffRequest.java b/platform/platform-api/src/com/intellij/openapi/diff/SimpleDiffRequest.java index fa87be32dbd2..9e71a61de0f0 100644 --- a/platform/platform-api/src/com/intellij/openapi/diff/SimpleDiffRequest.java +++ b/platform/platform-api/src/com/intellij/openapi/diff/SimpleDiffRequest.java @@ -62,9 +62,9 @@ public class SimpleDiffRequest extends DiffRequest { return result; } - public static SimpleDiffRequest compareFiles(VirtualFile file1, VirtualFile file2, Project project) { - return compareFiles(file1, file2, project, - DiffBundle.message("compare.file.vs.file.dialog.title", file1.getPresentableUrl(), file2.getPresentableUrl())); + public static SimpleDiffRequest compareFiles(@NotNull VirtualFile file1, @NotNull VirtualFile file2, @NotNull Project project) { + final String title = DiffBundle.message("compare.file.vs.file.dialog.title", file1.getPresentableUrl(), file2.getPresentableUrl()); + return compareFiles(file1, file2, project, title); } private static class FileDiffRequest extends SimpleDiffRequest { From 67a0a42d0c11658447c7eb7cb300d83516c8b9b3 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 19 Apr 2012 11:22:08 +0200 Subject: [PATCH 21/36] Cleanup and typos --- .../diff/actions/IgnoreWhiteSpacesAction.java | 14 +++++++------- .../src/messages/DiffBundle.properties | 12 ++++-------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java index 3183a619b1ff..78c5ba756923 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 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,6 +15,7 @@ */ package com.intellij.openapi.diff.actions; +import com.intellij.CommonBundle; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DefaultActionGroup; @@ -40,16 +41,15 @@ public class IgnoreWhiteSpacesAction extends ComboBoxAction implements DumbAware ComparisonPolicy.IGNORE_SPACE}; public IgnoreWhiteSpacesAction() { - myActions.put(ComparisonPolicy.DEFAULT, new IgnoringPolicyAction(DiffBundle.message("diff.acton.ignore.qhitespace.policy.do.not.ignore"), ComparisonPolicy.DEFAULT)); - myActions.put(ComparisonPolicy.TRIM_SPACE, new IgnoringPolicyAction( - DiffBundle.message("diff.acton.ignore.qhitespace.policy.leading.and.trailing"), ComparisonPolicy.TRIM_SPACE)); - myActions.put(ComparisonPolicy.IGNORE_SPACE, new IgnoringPolicyAction(DiffBundle.message("diff.acton.ignore.qhitespace.policy.all"), ComparisonPolicy.IGNORE_SPACE)); + myActions.put(ComparisonPolicy.DEFAULT, new IgnoringPolicyAction(DiffBundle.message("diff.acton.ignore.whitespace.policy.do.not.ignore"), ComparisonPolicy.DEFAULT)); + myActions.put(ComparisonPolicy.TRIM_SPACE, new IgnoringPolicyAction(DiffBundle.message("diff.acton.ignore.whitespace.policy.leading.and.trailing"), ComparisonPolicy.TRIM_SPACE)); + myActions.put(ComparisonPolicy.IGNORE_SPACE, new IgnoringPolicyAction(DiffBundle.message("diff.acton.ignore.whitespace.policy.all"), ComparisonPolicy.IGNORE_SPACE)); } @Override public JComponent createCustomComponent(final Presentation presentation) { JPanel panel = new JPanel(new BorderLayout()); - final JLabel label = new JLabel(DiffBundle.message("comparison.ignore.whitespace.acton.name")); + final JLabel label = new JLabel(CommonBundle.message("comparison.ignore.whitespace.acton.name")); label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); panel.add(label, BorderLayout.WEST); panel.add(super.createCustomComponent(presentation), BorderLayout.CENTER); @@ -77,7 +77,7 @@ public class IgnoreWhiteSpacesAction extends ComboBoxAction implements DumbAware presentation.setEnabled(true); } else { presentation.setIcon(null); - presentation.setText(DiffBundle.message("ignore.whitespace.action.not.avaliable.action.name")); + presentation.setText(DiffBundle.message("ignore.whitespace.action.not.available.action.name")); presentation.setEnabled(false); } } diff --git a/platform/platform-resources-en/src/messages/DiffBundle.properties b/platform/platform-resources-en/src/messages/DiffBundle.properties index b852cdd8f097..a8a3af2a3c47 100644 --- a/platform/platform-resources-en/src/messages/DiffBundle.properties +++ b/platform/platform-resources-en/src/messages/DiffBundle.properties @@ -23,10 +23,10 @@ diff.compare.element.type.with.editor.action.name=Compare File with Editor diff.element.qualified.name.vs.editor.dialog.title={0} vs Editor diff.element.qualified.name.vs.file.dialog.title={0} vs {1} diff.element.qualified.name.vs.element.qualified.name.dialog.title={0} vs {1} -diff.acton.ignore.qhitespace.policy.do.not.ignore=Do not ignore -diff.acton.ignore.qhitespace.policy.leading.and.trailing=Leading and trailing -diff.acton.ignore.qhitespace.policy.all=All -ignore.whitespace.action.not.avaliable.action.name= +diff.acton.ignore.whitespace.policy.do.not.ignore=Do not ignore +diff.acton.ignore.whitespace.policy.leading.and.trailing=Leading and trailing +diff.acton.ignore.whitespace.policy.all=All +ignore.whitespace.action.not.available.action.name= diff.dialog.select.change.action.name=Select Change diff.dialog.select.change.action.description=Select changed text in this version and corresponding in other merge.files.dialog.title=Merge @@ -34,10 +34,6 @@ merge.dialog.cannot.load.file.error.message=Cannot load file: {0} merge.editor.replace.operation.name=Replace merge.editor.insert.operation.name=Insert merge.editor.remove.operation.name=Remove -comparison.policy.default.name=Default -comparison.policy.trim.space.name=Trim space -comparison.policy.ignore.spaces.name=Ignore spaces -comparison.ignore.whitespace.acton.name=Ignore whitespace: diff.count.differences.status.text={0, choice, 0#no differences|1#1 difference|2#{0, number} differences} cant.launch.diff.tool.error.message=Can''t Launch Diff Tool binary.files.are.identical.message=Binary files are identical From 6728c9bcb97cceb70a31a04c7322f70cc38db653 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 19 Apr 2012 11:50:26 +0200 Subject: [PATCH 22/36] Report unknown file types in diff --- .../openapi/diff/DiffApplication.java | 56 +++++++++++-------- .../src/messages/DiffBundle.properties | 7 ++- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java b/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java index 1df743e95664..2401fa3666af 100644 --- a/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java +++ b/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java @@ -20,20 +20,22 @@ import com.intellij.ide.diff.DirDiffSettings; import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.application.ApplicationStarterEx; import com.intellij.openapi.fileEditor.FileDocumentManager; +import com.intellij.openapi.fileTypes.UnknownFileType; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.PropertyKey; import java.io.File; -import java.io.FileNotFoundException; /** * @author max * @author Konstantin Bulenkov */ -@SuppressWarnings({"UseOfSystemOutOrSystemErr"}) +@SuppressWarnings({"UseOfSystemOutOrSystemErr", "CallToPrintStackTrace"}) public class DiffApplication implements ApplicationStarterEx { public String getCommandName() { return "diff"; @@ -54,7 +56,7 @@ public class DiffApplication implements ApplicationStarterEx { try { processDiffCommand(args); } - catch (FileNotFoundException e) { + catch (OperationFailedException e) { System.err.println(e.getMessage()); System.exit(1); } @@ -62,9 +64,6 @@ public class DiffApplication implements ApplicationStarterEx { e.printStackTrace(); System.exit(1); } - finally { - System.exit(0); - } } @Override @@ -83,28 +82,25 @@ public class DiffApplication implements ApplicationStarterEx { } } - private static void processDiffCommand(String[] args) throws FileNotFoundException { + private static void processDiffCommand(String[] args) throws OperationFailedException { final String path1 = args[1]; final String path2 = args[2]; final VirtualFile file1 = findFile(path1); final VirtualFile file2 = findFile(path2); - final boolean isDirs = isDirs(file1, file2); - final boolean isJars = isJars(file1, file2); - if (isDirs || isJars) { + final boolean areDirs = areDirs(file1, file2); + final boolean areJars = areJars(file1, file2); + if (areDirs || areJars) { final DirDiffManager diffManager = DirDiffManager.getInstance(ProjectManager.getInstance().getDefaultProject()); final DiffElement d1 = diffManager.createDiffElement(file1); final DiffElement d2 = diffManager.createDiffElement(file2); if (d1 == null) { - System.err.println("Can't create diff element from " + path1); - return; + throw new OperationFailedException("cannot.create.diff.error", path1); } if (d2 == null) { - System.err.println("Can't create diff element from " + path2); - return; + throw new OperationFailedException("cannot.create.diff.error", path1); } - if (!diffManager.canShow(d1, d2)) { - System.err.println("Diff manager can't compare '" + path1 + "' and '" + path2 + "'"); - return; + else if (!diffManager.canShow(d1, d2)) { + throw new OperationFailedException("cannot.compare.error", path1, path2); } final DirDiffSettings settings = new DirDiffSettings(); @@ -114,6 +110,14 @@ public class DiffApplication implements ApplicationStarterEx { else { file1.refresh(false, false); file2.refresh(false, false); + + if (file1.getFileType() == UnknownFileType.INSTANCE) { + throw new OperationFailedException("unknown.file.type.error", path1); + } + else if (file2.getFileType() == UnknownFileType.INSTANCE) { + throw new OperationFailedException("unknown.file.type.error", path2); + } + SimpleDiffRequest request = SimpleDiffRequest.compareFiles(file1, file2, ProjectManager.getInstance().getDefaultProject()); request.addHint(DiffTool.HINT_SHOW_MODAL_DIALOG); DiffManager.getInstance().getIdeaDiffTool().show(request); @@ -121,20 +125,26 @@ public class DiffApplication implements ApplicationStarterEx { } } - private static boolean isJars(VirtualFile file1, VirtualFile file2) { - return JarFileSystem.PROTOCOL.equalsIgnoreCase(file1.getExtension()) - && JarFileSystem.PROTOCOL.equalsIgnoreCase(file2.getExtension()); + private static boolean areJars(VirtualFile file1, VirtualFile file2) { + return JarFileSystem.PROTOCOL.equalsIgnoreCase(file1.getExtension()) && JarFileSystem.PROTOCOL.equalsIgnoreCase(file2.getExtension()); } - private static boolean isDirs(VirtualFile file1, VirtualFile file2) { + private static boolean areDirs(VirtualFile file1, VirtualFile file2) { return file1.isDirectory() && file2.isDirectory(); } - private static VirtualFile findFile(final String path) throws FileNotFoundException { + @NotNull + private static VirtualFile findFile(final String path) throws OperationFailedException { final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path)); if (file == null) { - throw new FileNotFoundException(DiffBundle.message("cannot.file.file.error.message", path)); + throw new OperationFailedException("cannot.file.file.error", path); } return file; } + + private static class OperationFailedException extends Exception { + public OperationFailedException(@NotNull @PropertyKey(resourceBundle = "messages.DiffBundle") String key, Object... params) { + super(DiffBundle.message(key, params)); + } + } } diff --git a/platform/platform-resources-en/src/messages/DiffBundle.properties b/platform/platform-resources-en/src/messages/DiffBundle.properties index a8a3af2a3c47..a26a57b2954c 100644 --- a/platform/platform-resources-en/src/messages/DiffBundle.properties +++ b/platform/platform-resources-en/src/messages/DiffBundle.properties @@ -1,5 +1,10 @@ diff.application.usage.parameters.and.description=Usage: idea diff -cannot.file.file.error.message=Cannot find file: {0} + +cannot.file.file.error=Cannot find file: {0} +cannot.create.diff.error=Cannot create diff element from: {0} +cannot.compare.error=Diff manager cannot compare ''{0}' and ''{1}'' +unknown.file.type.error=Unknown file type: {0} + save.merge.result.command.name=Merge compare.file.vs.file.dialog.title={0} vs {1} diff.content.editor.content.title=Editor From 09a852a65bf1b2b7c41b9e73a7007d692d00925f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 19 Apr 2012 12:26:37 +0200 Subject: [PATCH 23/36] Fix NPE in jar diff --- platform/platform-resources/src/componentSets/Editor.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-resources/src/componentSets/Editor.xml b/platform/platform-resources/src/componentSets/Editor.xml index 28ecbbeb4ef1..adf1f3bf5d7f 100644 --- a/platform/platform-resources/src/componentSets/Editor.xml +++ b/platform/platform-resources/src/componentSets/Editor.xml @@ -32,7 +32,7 @@ com.intellij.openapi.editor.LazyRangeMarkerFactory + - \ No newline at end of file From fddbd00277f284680af9663dbb44fc76b1d33356 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 19 Apr 2012 12:27:14 +0200 Subject: [PATCH 24/36] Restore diff exit --- .../src/com/intellij/openapi/diff/DiffApplication.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java b/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java index 2401fa3666af..0b279c8667c6 100644 --- a/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java +++ b/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java @@ -60,10 +60,12 @@ public class DiffApplication implements ApplicationStarterEx { System.err.println(e.getMessage()); System.exit(1); } - catch (Exception e) { - e.printStackTrace(); - System.exit(1); + catch (Throwable t) { + t.printStackTrace(); + System.exit(2); } + + System.exit(0); } @Override From c4a108ee18950aba6c45a09364bc78d9e1b8a73a Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 19 Apr 2012 12:43:13 +0200 Subject: [PATCH 25/36] Consistent diff usage message --- .../openapi/diff/DiffApplication.java | 22 ++++++++++--------- .../src/messages/DiffBundle.properties | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java b/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java index 0b279c8667c6..ea66473ed06b 100644 --- a/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java +++ b/platform/platform-api/src/com/intellij/openapi/diff/DiffApplication.java @@ -37,21 +37,20 @@ import java.io.File; */ @SuppressWarnings({"UseOfSystemOutOrSystemErr", "CallToPrintStackTrace"}) public class DiffApplication implements ApplicationStarterEx { + @Override public String getCommandName() { return "diff"; } + @Override public void premain(String[] args) { if (args.length != 3) { - printHelp(); + System.err.println(getUsageMessage()); + System.exit(1); } } - private static void printHelp() { - System.err.println(DiffBundle.message("diff.application.usage.parameters.and.description")); - System.exit(1); - } - + @Override public void main(String[] args) { try { processDiffCommand(args); @@ -71,19 +70,22 @@ public class DiffApplication implements ApplicationStarterEx { @Override public void processExternalCommandLine(String[] args) { if (args.length != 3) { - String productName = ApplicationNamesInfo.getInstance().getProductName(); - Messages.showMessageDialog("Usage: " + productName.toLowerCase() + " diff ", - "Diff", Messages.getInformationIcon()); + Messages.showMessageDialog(getUsageMessage(), "Diff", Messages.getInformationIcon()); return; } try { processDiffCommand(args); } - catch(Exception e) { + catch (Exception e) { Messages.showMessageDialog("Error showing diff: " + e.getMessage(), "Diff", Messages.getErrorIcon()); } } + private static String getUsageMessage() { + final String scriptName = ApplicationNamesInfo.getInstance().getScriptName(); + return DiffBundle.message("diff.application.usage.parameters.and.description", scriptName); + } + private static void processDiffCommand(String[] args) throws OperationFailedException { final String path1 = args[1]; final String path2 = args[2]; diff --git a/platform/platform-resources-en/src/messages/DiffBundle.properties b/platform/platform-resources-en/src/messages/DiffBundle.properties index a26a57b2954c..4f47dd7b7101 100644 --- a/platform/platform-resources-en/src/messages/DiffBundle.properties +++ b/platform/platform-resources-en/src/messages/DiffBundle.properties @@ -1,4 +1,4 @@ -diff.application.usage.parameters.and.description=Usage: idea diff +diff.application.usage.parameters.and.description=Usage: {0} diff cannot.file.file.error=Cannot find file: {0} cannot.create.diff.error=Cannot create diff element from: {0} From 85c4d731e0425313fcd29d02cebce73a1bcf0d5e Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Wed, 18 Apr 2012 20:18:55 +0400 Subject: [PATCH 26/36] Simplifying code. --- .../dom/MavenDomProjectProcessorUtils.java | 127 ++++++++---------- .../references/MavenPropertyPsiReference.java | 2 +- 2 files changed, 60 insertions(+), 69 deletions(-) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java index 95b50f81e0f0..e4a10bf46d98 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java @@ -111,45 +111,29 @@ public class MavenDomProjectProcessorUtils { public static XmlTag searchProperty(@NotNull final String propertyName, @NotNull MavenDomProjectModel projectDom, @NotNull final Project project) { - return doSearchPropertyInProfile(propertyName, projectDom, null, project); - } - - @Nullable - public static XmlTag searchPropertyInProfile(@NotNull final String propertyName, - @NotNull MavenDomProfile profileDom) { - return doSearchPropertyInProfile(propertyName, null, profileDom, null); - } - - @Nullable - private static XmlTag doSearchPropertyInProfile(@NotNull final String propertyName, - @Nullable MavenDomProjectModel projectDom, - @Nullable MavenDomProfile profileDom, - @Nullable final Project project) { - final XmlTag[] property = new XmlTag[]{null}; - - Processor searchProcessor = new Processor() { - public boolean process(MavenDomProperties mavenDomProperties) { - XmlTag propertiesTag = mavenDomProperties.getXmlTag(); - if (propertiesTag != null) { - for (XmlTag each : propertiesTag.getSubTags()) { - if (each.getName().equals(propertyName)) { - property[0] = each; - return true; - } - } - } - return false; + SearchProcessor searchProcessor = new SearchProcessor() { + @Override + protected XmlTag find(MavenDomProperties element) { + return findProperty(element, propertyName); } }; - if (projectDom != null) { - processProperties(projectDom, searchProcessor, project); - } - else { - processPropertiesInProfile(profileDom, searchProcessor); + processProperties(projectDom, searchProcessor, project); + return searchProcessor.myResult; + } + + @Nullable + public static XmlTag findProperty(@NotNull MavenDomProperties mavenDomProperties, @NotNull String propertyName) { + XmlTag propertiesTag = mavenDomProperties.getXmlTag(); + if (propertiesTag == null) return null; + + for (XmlTag each : propertiesTag.getSubTags()) { + if (each.getName().equals(propertyName)) { + return each; + } } - return property[0]; + return null; } public static Set collectProperties(@NotNull MavenDomProjectModel projectDom, @NotNull final Project project) { @@ -280,33 +264,31 @@ public class MavenDomProjectProcessorUtils { @Nullable public static MavenDomDependency searchManagingDependency(@NotNull final MavenDomDependency dependency, @NotNull final Project project) { - final MavenDomDependency[] parent = new MavenDomDependency[]{null}; - final String artifactId = dependency.getArtifactId().getStringValue(); final String groupId = dependency.getGroupId().getStringValue(); - if (artifactId != null && groupId != null) { - final MavenDomProjectModel model = dependency.getParentOfType(MavenDomProjectModel.class, false); - if (model != null) { - Processor processor = new Processor() { - public boolean process(MavenDomDependencies mavenDomDependencies) { - if (!model.equals(mavenDomDependencies.getParentOfType(MavenDomProjectModel.class, true))) { - for (MavenDomDependency domDependency : mavenDomDependencies.getDependencies()) { - if (domDependency.equals(dependency)) continue; - if (artifactId.equals(domDependency.getArtifactId().getStringValue()) && - groupId.equals(domDependency.getGroupId().getStringValue())) { - parent[0] = domDependency; - return true; - } - } - } - return false; - } - }; - processDependenciesInDependencyManagement(model, processor, project); - } - } + if (artifactId == null || groupId == null) return null; - return parent[0]; + final MavenDomProjectModel model = dependency.getParentOfType(MavenDomProjectModel.class, false); + if (model == null) return null; + + SearchProcessor processor = new SearchProcessor() { + @Override + protected MavenDomDependency find(MavenDomDependencies mavenDomDependencies) { + if (!model.equals(mavenDomDependencies.getParentOfType(MavenDomProjectModel.class, true))) { + for (MavenDomDependency domDependency : mavenDomDependencies.getDependencies()) { + if (artifactId.equals(domDependency.getArtifactId().getStringValue()) && + groupId.equals(domDependency.getGroupId().getStringValue())) { + return domDependency; + } + } + } + + return null; + } + }; + processDependenciesInDependencyManagement(model, processor, project); + + return processor.myResult; } @@ -346,16 +328,6 @@ public class MavenDomProjectProcessorUtils { return process(projectDom, processor, project, domProfileFunction, projectDomFunction); } - public static boolean processPropertiesInProfile(@NotNull MavenDomProfile profileDom, - @NotNull final Processor processor) { - return processProfile(profileDom, processor, new Function() { - @Override - public MavenDomProperties fun(MavenDomProfile mavenDomProfile) { - return mavenDomProfile.getProperties(); - } - }); - } - public static boolean process(@NotNull MavenDomProjectModel projectDom, @NotNull final Processor processor, @NotNull final Project project, @@ -500,4 +472,23 @@ public class MavenDomProjectProcessorUtils { return process(myManager.getGeneralSettings(), MavenDomUtil.getVirtualFile(projectDom), parentDesc); } } + + private abstract static class SearchProcessor implements Processor { + + private R myResult; + + @Override + public final boolean process(T t) { + R res = find(t); + if (res != null) { + myResult = res; + return true; + } + + return false; + } + + @Nullable + protected abstract R find(T element); + } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenPropertyPsiReference.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenPropertyPsiReference.java index 981dd7b3a7e1..5deff1737e5d 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenPropertyPsiReference.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/references/MavenPropertyPsiReference.java @@ -176,7 +176,7 @@ public class MavenPropertyPsiReference extends MavenPsiReference { MavenDomProfile profile = DomUtil.findDomElement(myElement, MavenDomProfile.class); if (profile != null) { - PsiElement result = MavenDomProjectProcessorUtils.searchPropertyInProfile(myText, profile); + PsiElement result = MavenDomProjectProcessorUtils.findProperty(profile.getProperties(), myText); if (result != null) return result; } From 0d7cc22ae678e286adb9975d69dd9370b9df6b06 Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Thu, 19 Apr 2012 15:33:16 +0400 Subject: [PATCH 27/36] IDEA-84847 adding a new plugin in a profile and activating the profile inside Idea does not update known goals of that plugin --- .../embedder/Maven2ServerEmbedderImpl.java | 31 +++++++++++++------ .../idea/maven/project/MavenProjectsTree.java | 19 ++++++++++-- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/plugins/maven/maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/Maven2ServerEmbedderImpl.java b/plugins/maven/maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/Maven2ServerEmbedderImpl.java index 341aee5b41b8..4d5d8597a0fb 100644 --- a/plugins/maven/maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/Maven2ServerEmbedderImpl.java +++ b/plugins/maven/maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/Maven2ServerEmbedderImpl.java @@ -285,19 +285,30 @@ public class Maven2ServerEmbedderImpl extends MavenRemoteObject implements Maven MavenProject project = RemoteNativeMavenProjectHolder.findProjectById(nativeMavenProjectId); PluginDescriptor result = getComponent(PluginManager.class).verifyPlugin(mavenPlugin, project, myImpl.getSettings(), myImpl.getLocalRepository()); - if (!transitive) return Collections.emptyList(); - - // todo try to use parallel downloading Map resolvedArtifacts = new THashMap(); - for (Artifact each : (Iterable)result.getIntroducedDependencyArtifacts()) { - resolveIfNecessary(new MavenArtifactInfo(each.getGroupId(), each.getArtifactId(), each.getVersion(), each.getType(), null), - repositories, resolvedArtifacts); - } - for (ComponentDependency each : (List)result.getDependencies()) { - resolveIfNecessary(new MavenArtifactInfo(each.getGroupId(), each.getArtifactId(), each.getVersion(), each.getType(), null), - repositories, resolvedArtifacts); + + Artifact pluginArtifact = result.getPluginArtifact(); + + MavenArtifactInfo artifactInfo = new MavenArtifactInfo(pluginArtifact.getGroupId(), + pluginArtifact.getArtifactId(), + pluginArtifact.getVersion(), + pluginArtifact.getType(), null); + + resolveIfNecessary(artifactInfo, repositories, resolvedArtifacts); + + if (transitive) { + // todo try to use parallel downloading + for (Artifact each : (Iterable)result.getIntroducedDependencyArtifacts()) { + resolveIfNecessary(new MavenArtifactInfo(each.getGroupId(), each.getArtifactId(), each.getVersion(), each.getType(), null), + repositories, resolvedArtifacts); + } + for (ComponentDependency each : (List)result.getDependencies()) { + resolveIfNecessary(new MavenArtifactInfo(each.getGroupId(), each.getArtifactId(), each.getVersion(), each.getType(), null), + repositories, resolvedArtifacts); + } } + return new THashSet(resolvedArtifacts.values()); } catch (Exception e) { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java index 685b5e61758f..21c7cb627dc9 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java @@ -1022,11 +1022,26 @@ public class MavenProjectsTree { embedder.clearCachesFor(mavenProject.getMavenId()); try { + process.setText(ProjectBundle.message("maven.downloading.pom.plugins", mavenProject.getDisplayName())); + + Set filesToRefresh = new HashSet(); + for (MavenPlugin each : mavenProject.getDeclaredPlugins()) { process.checkCanceled(); - process.setText(ProjectBundle.message("maven.downloading.pom.plugins", mavenProject.getDisplayName())); - embedder.resolvePlugin(each, mavenProject.getRemoteRepositories(), nativeMavenProject, false); + + Collection artifacts = embedder.resolvePlugin(each, mavenProject.getRemoteRepositories(), nativeMavenProject, false); + + for (MavenArtifact artifact : artifacts) { + File pluginJar = artifact.getFile(); + File pluginDir = pluginJar.getParentFile(); + if (pluginDir != null) { + filesToRefresh.add(pluginDir); // Refresh both *.pom and *.jar files. + } + } } + + LocalFileSystem.getInstance().refreshIoFiles(filesToRefresh); + mavenProject.resetCache(); firePluginsResolved(mavenProject); } From 859f1f3a3fa93d3eeb921eafa1fce124d8d936db Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Thu, 19 Apr 2012 15:39:32 +0400 Subject: [PATCH 28/36] deadcode --- .../ui/breakpoints/actions/AddAction.java | 4 - .../breakpoints/actions/GotoSourceAction.java | 6 +- .../ui/breakpoints/actions/RemoveAction.java | 5 +- .../breakpoints/actions/SwitchViewAction.java | 5 +- .../breakpoints/actions/ViewSourceAction.java | 6 +- ...BasedFrameworkSupportInModuleProvider.java | 82 ------------------- .../ProjectNameWithTypeStep.java | 6 +- .../ConfigurationErrorsComponent.java | 8 +- .../ExplicitTypeCanBeDiamondInspection.java | 4 - ...ossibleHeapPollutionVarargsInspection.java | 4 - .../dataFlow/DataFlowInspection.java | 3 - .../dataFlow/instructions/Instruction.java | 6 -- .../defUse/DefUseInspection.java | 2 - .../DuplicateThrowsInspection.java | 3 - .../equalsAndHashcode/EqualsAndHashcode.java | 4 - .../UndesirableClassUsageInspection.java | 4 - .../nullable/NullableStuffInspection.java | 3 - .../SuspiciousNameCombinationInspection.java | 4 - .../testOnly/TestOnlyInspection.java | 5 +- .../cyclicDependencies/ui/CycleNode.java | 25 ------ .../ClassesScopeTreeStructureExpander.java | 4 - .../InheritanceToDelegationProcessor.java | 8 -- .../InlineParameterExpressionProcessor.java | 3 - .../refactoring/util/RefactoringUtil.java | 2 +- .../junit/segments/SegmentedOutputStream.java | 4 - .../JavaReflectionCompletionTest.java | 5 -- .../daemon/LightAdvHighlightingJdk7Test.java | 6 -- .../EmptyIntentionInspectionQuickFixTest.java | 4 - ...moveRedundantUncheckedSuppressionTest.java | 6 +- .../BaseJavaLocalInspectionTool.java | 3 - .../ClassHasNoToStringMethodInspection.java | 3 - .../FieldNotUsedInToStringInspection.java | 3 - .../ConvertAnnotationInspection.java | 3 - .../inspection/ConvertJavadocInspection.java | 3 - .../ConvertOldAnnotationInspection.java | 5 +- .../BoundFieldAssignmentInspection.java | 3 - 36 files changed, 10 insertions(+), 244 deletions(-) delete mode 100644 java/idea-ui/src/com/intellij/framework/addSupport/FacetBasedFrameworkSupportInModuleProvider.java diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/AddAction.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/AddAction.java index 536b4b10887d..9ecfc0084f82 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/AddAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/AddAction.java @@ -29,10 +29,6 @@ import java.awt.event.KeyEvent; super(IdeBundle.message("button.add")); } - public void setButton(AbstractButton button) { - super.setButton(button); - } - public void setPanel(BreakpointPanel panel) { super.setPanel(panel); getPanel().getTable().registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/GotoSourceAction.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/GotoSourceAction.java index d8dde6fd9680..aedbfb475281 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/GotoSourceAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/GotoSourceAction.java @@ -16,13 +16,12 @@ package com.intellij.debugger.ui.breakpoints.actions; import com.intellij.debugger.ui.breakpoints.BreakpointPanel; +import com.intellij.ide.IdeBundle; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; -import com.intellij.ide.IdeBundle; -import javax.swing.*; import java.awt.event.ActionEvent; /** @@ -47,9 +46,6 @@ public class GotoSourceAction extends BreakpointPanelAction { FileEditorManager.getInstance(myProject).openTextEditor(editSourceDescriptor, true); } } - public void setButton(AbstractButton button) { - super.setButton(button); - } public void setPanel(BreakpointPanel panel) { super.setPanel(panel); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/RemoveAction.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/RemoveAction.java index b4084351511a..72a86b746e3b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/RemoveAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/RemoveAction.java @@ -15,8 +15,8 @@ */ package com.intellij.debugger.ui.breakpoints.actions; -import com.intellij.debugger.DebuggerManagerEx; import com.intellij.debugger.DebuggerBundle; +import com.intellij.debugger.DebuggerManagerEx; import com.intellij.debugger.ui.breakpoints.AnyExceptionBreakpoint; import com.intellij.debugger.ui.breakpoints.Breakpoint; import com.intellij.debugger.ui.breakpoints.BreakpointManager; @@ -39,9 +39,6 @@ public class RemoveAction extends BreakpointPanelAction { myProject = project; } - public void setButton(AbstractButton button) { - super.setButton(button); - } public void setPanel(BreakpointPanel panel) { super.setPanel(panel); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/SwitchViewAction.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/SwitchViewAction.java index 95f77bc78e7b..8a44fbba2fc9 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/SwitchViewAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/SwitchViewAction.java @@ -15,8 +15,8 @@ */ package com.intellij.debugger.ui.breakpoints.actions; -import com.intellij.debugger.ui.breakpoints.BreakpointPanel; import com.intellij.debugger.DebuggerBundle; +import com.intellij.debugger.ui.breakpoints.BreakpointPanel; import javax.swing.*; import java.awt.event.ActionEvent; @@ -30,9 +30,6 @@ public class SwitchViewAction extends BreakpointPanelAction { super(DebuggerBundle.message("button.switch.view")); } - public void setButton(AbstractButton button) { - super.setButton(button); - } public void actionPerformed(ActionEvent e) { getPanel().switchViews(); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/ViewSourceAction.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/ViewSourceAction.java index 7be8484afbad..0744ef917d56 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/ViewSourceAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/actions/ViewSourceAction.java @@ -15,12 +15,11 @@ */ package com.intellij.debugger.ui.breakpoints.actions; +import com.intellij.ide.IdeBundle; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; -import com.intellij.ide.IdeBundle; -import javax.swing.*; import java.awt.event.ActionEvent; /** @@ -35,9 +34,6 @@ public class ViewSourceAction extends BreakpointPanelAction { myProject = project; } - public void setButton(AbstractButton button) { - super.setButton(button); - } public void actionPerformed(ActionEvent e) { OpenFileDescriptor editSourceDescriptor = getPanel().createEditSourceDescriptor(myProject); diff --git a/java/idea-ui/src/com/intellij/framework/addSupport/FacetBasedFrameworkSupportInModuleProvider.java b/java/idea-ui/src/com/intellij/framework/addSupport/FacetBasedFrameworkSupportInModuleProvider.java deleted file mode 100644 index 314137ba5fcf..000000000000 --- a/java/idea-ui/src/com/intellij/framework/addSupport/FacetBasedFrameworkSupportInModuleProvider.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.framework.addSupport; - -import com.intellij.facet.*; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleType; -import com.intellij.openapi.roots.ModifiableModelsProvider; -import com.intellij.openapi.roots.ModifiableRootModel; -import com.intellij.openapi.roots.ui.configuration.FacetsProvider; -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; - -/** - * @author nik - */ -public abstract class FacetBasedFrameworkSupportInModuleProvider extends FrameworkSupportInModuleProvider { - private static final Logger LOG = Logger.getInstance("#com.intellij.framework.addSupport.FacetBasedFrameworkSupportInModuleProvider"); - private final FacetType myFacetType; - - protected FacetBasedFrameworkSupportInModuleProvider(FacetType facetType) { - myFacetType = facetType; - } - - public boolean isEnabledForModuleType(@NotNull final ModuleType moduleType) { - return myFacetType.isSuitableModuleType(moduleType); - } - - @Override - public boolean isSupportAlreadyAdded(@NotNull Module module, @NotNull FacetsProvider facetsProvider) { - return !FacetManager.getInstance(module).getFacetsByType(myFacetType.getId()).isEmpty(); - } - - - protected class FacetBasedFrameworkSupportInModuleConfigurable extends FrameworkSupportInModuleConfigurable { - @Override - public JComponent createComponent() { - return null; - } - - @Override - public void addSupport(@NotNull Module module, - @NotNull ModifiableRootModel rootModel, - @NotNull ModifiableModelsProvider modifiableModelsProvider) { - FacetManager facetManager = FacetManager.getInstance(module); - ModifiableFacetModel model = facetManager.createModifiableModel(); - Facet underlyingFacet = null; - FacetTypeId underlyingFacetType = myFacetType.getUnderlyingFacetType(); - if (underlyingFacetType != null) { - underlyingFacet = model.getFacetByType(underlyingFacetType); - LOG.assertTrue(underlyingFacet != null, underlyingFacetType); - } - F facet = facetManager.createFacet(myFacetType, myFacetType.getDefaultFacetName(), underlyingFacet); - setupConfiguration(facet, rootModel); - model.addFacet(facet); - model.commit(); - onFacetCreated(facet, rootModel); - } - - protected void setupConfiguration(final F facet, final ModifiableRootModel rootModel) { - } - - protected void onFacetCreated(final F facet, final ModifiableRootModel rootModel) { - } - - } -} diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectNameWithTypeStep.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectNameWithTypeStep.java index ef14fe71836b..c172fdb3a460 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectNameWithTypeStep.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectNameWithTypeStep.java @@ -393,10 +393,6 @@ public class ProjectNameWithTypeStep extends ProjectNameStep { return !myWizardContext.isCreatingNewProject() || super.validate(); } - public void disposeUIResources() { - super.disposeUIResources(); - } - private static class PermanentSingleSelectionModel extends DefaultListSelectionModel { public PermanentSingleSelectionModel() { super.setSelectionMode(SINGLE_SELECTION); @@ -429,4 +425,4 @@ public class ProjectNameWithTypeStep extends ProjectNameStep { myInternalPanel.add(component, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0)); } -} \ No newline at end of file +} diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ConfigurationErrorsComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ConfigurationErrorsComponent.java index 1a916c6d69b2..dd994f87f514 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ConfigurationErrorsComponent.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ConfigurationErrorsComponent.java @@ -397,13 +397,7 @@ public class ConfigurationErrorsComponent extends JPanel implements Disposable, myList = list; - myText = new JTextPane() { - @Override - public void setCursor(Cursor cursor) { - super.setCursor(cursor); - //onCursorChanged(cursor); - } - }; + myText = new JTextPane(); myButtonsPanel = new JPanel(new BorderLayout()); myButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 3, 5, 3)); diff --git a/java/java-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java b/java/java-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java index af3d54c919a9..044daee18695 100644 --- a/java/java-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/ExplicitTypeCanBeDiamondInspection.java @@ -60,10 +60,6 @@ public class ExplicitTypeCanBeDiamondInspection extends BaseJavaLocalInspectionT @Override public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { - @Override - public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitNewExpression(PsiNewExpression expression) { if (PsiDiamondTypeUtil.canCollapseToDiamond(expression, expression, null)) { diff --git a/java/java-impl/src/com/intellij/codeInspection/PossibleHeapPollutionVarargsInspection.java b/java/java-impl/src/com/intellij/codeInspection/PossibleHeapPollutionVarargsInspection.java index 8eebe7f115ef..565ebbdf3bd9 100644 --- a/java/java-impl/src/com/intellij/codeInspection/PossibleHeapPollutionVarargsInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/PossibleHeapPollutionVarargsInspection.java @@ -170,9 +170,5 @@ public class PossibleHeapPollutionVarargsInspection extends BaseJavaLocalInspect } protected abstract void registerProblem(PsiMethod method, PsiIdentifier nameIdentifier); - - @Override - public void visitReferenceExpression(PsiReferenceExpression expression) { - } } } diff --git a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java index 59bcce017d48..f2f650ba843d 100644 --- a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java @@ -70,9 +70,6 @@ public class DataFlowInspection extends BaseLocalInspectionTool { @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(PsiReferenceExpression expression) {} - - @Override public void visitField(PsiField field) { if (isNullLiteralExpression(field.getInitializer()) && NullableNotNullManager.isNotNull(field)) { holder.registerProblem(field.getInitializer(), InspectionsBundle.message("dataflow.message.initializing.field.with.null")); diff --git a/java/java-impl/src/com/intellij/codeInspection/dataFlow/instructions/Instruction.java b/java/java-impl/src/com/intellij/codeInspection/dataFlow/instructions/Instruction.java index eb65807aa86e..505deaa0a034 100644 --- a/java/java-impl/src/com/intellij/codeInspection/dataFlow/instructions/Instruction.java +++ b/java/java-impl/src/com/intellij/codeInspection/dataFlow/instructions/Instruction.java @@ -29,7 +29,6 @@ import com.intellij.codeInspection.dataFlow.DfaInstructionState; import com.intellij.codeInspection.dataFlow.DfaMemoryState; import com.intellij.codeInspection.dataFlow.InstructionVisitor; import com.intellij.openapi.progress.ProgressManager; -import org.jetbrains.annotations.NonNls; import java.util.ArrayList; @@ -71,9 +70,4 @@ public abstract class Instruction { public int getIndex() { return myIndex; } - - @NonNls - public String toString() { - return super.toString(); - } } diff --git a/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java b/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java index 62add75be5c4..45da93926d29 100644 --- a/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java @@ -62,8 +62,6 @@ public class DefUseInspection extends BaseLocalInspectionTool { @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(PsiReferenceExpression expression) {} - @Override public void visitMethod(PsiMethod method) { checkCodeBlock(method.getBody(), holder, isOnTheFly); } diff --git a/java/java-impl/src/com/intellij/codeInspection/duplicateThrows/DuplicateThrowsInspection.java b/java/java-impl/src/com/intellij/codeInspection/duplicateThrows/DuplicateThrowsInspection.java index f3ad6f12a266..b4898e658cc0 100644 --- a/java/java-impl/src/com/intellij/codeInspection/duplicateThrows/DuplicateThrowsInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/duplicateThrows/DuplicateThrowsInspection.java @@ -44,9 +44,6 @@ public class DuplicateThrowsInspection extends BaseLocalInspectionTool { @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitMethod(PsiMethod method) { PsiReferenceList throwsList = method.getThrowsList(); PsiJavaCodeReferenceElement[] refs = throwsList.getReferenceElements(); diff --git a/java/java-impl/src/com/intellij/codeInspection/equalsAndHashcode/EqualsAndHashcode.java b/java/java-impl/src/com/intellij/codeInspection/equalsAndHashcode/EqualsAndHashcode.java index 60a69517418f..c175b6a02603 100644 --- a/java/java-impl/src/com/intellij/codeInspection/equalsAndHashcode/EqualsAndHashcode.java +++ b/java/java-impl/src/com/intellij/codeInspection/equalsAndHashcode/EqualsAndHashcode.java @@ -95,10 +95,6 @@ public class EqualsAndHashcode extends BaseJavaLocalInspectionTool { (LocalQuickFix[])null); } } - - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - //do nothing - } }; } diff --git a/java/java-impl/src/com/intellij/codeInspection/internal/UndesirableClassUsageInspection.java b/java/java-impl/src/com/intellij/codeInspection/internal/UndesirableClassUsageInspection.java index 4a399f447986..00373f456fa7 100644 --- a/java/java-impl/src/com/intellij/codeInspection/internal/UndesirableClassUsageInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/internal/UndesirableClassUsageInspection.java @@ -60,10 +60,6 @@ public class UndesirableClassUsageInspection extends InternalInspection { public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { if (!ApplicationManagerEx.getApplicationEx().isInternal()) return new JavaElementVisitor() {}; return new JavaElementVisitor() { - @Override - public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitNewExpression(PsiNewExpression expression) { PsiJavaCodeReferenceElement ref = expression.getClassReference(); diff --git a/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java b/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java index 06583b409c77..b58d9a6a8ab7 100644 --- a/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java @@ -67,9 +67,6 @@ public class NullableStuffInspection extends BaseLocalInspectionTool { @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitMethod(PsiMethod method) { if (!PsiUtil.isLanguageLevel5OrHigher(method)) return; checkNullableStuffForMethod(method, holder); diff --git a/java/java-impl/src/com/intellij/codeInspection/suspiciousNameCombination/SuspiciousNameCombinationInspection.java b/java/java-impl/src/com/intellij/codeInspection/suspiciousNameCombination/SuspiciousNameCombinationInspection.java index 33e320c53982..f63361495760 100644 --- a/java/java-impl/src/com/intellij/codeInspection/suspiciousNameCombination/SuspiciousNameCombinationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/suspiciousNameCombination/SuspiciousNameCombinationInspection.java @@ -117,10 +117,6 @@ public class SuspiciousNameCombinationInspection extends BaseLocalInspectionTool public MyVisitor(final ProblemsHolder problemsHolder) { myProblemsHolder = problemsHolder; } - - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitVariable(PsiVariable variable) { if (variable.hasInitializer()) { PsiExpression expr = variable.getInitializer(); diff --git a/java/java-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java b/java/java-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java index d20ddd3581dc..d7616ebac4d4 100644 --- a/java/java-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/testOnly/TestOnlyInspection.java @@ -50,9 +50,6 @@ public class TestOnlyInspection extends BaseJavaLocalInspectionTool { @Override public void visitCallExpression(PsiCallExpression e) { validate(e, h); } - - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - } }; } @@ -108,4 +105,4 @@ public class TestOnlyInspection extends BaseJavaLocalInspectionTool { String message = InspectionsBundle.message("inspection.test.only.problems.test.only.method.call"); h.registerProblem(e, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } -} \ No newline at end of file +} diff --git a/java/java-impl/src/com/intellij/cyclicDependencies/ui/CycleNode.java b/java/java-impl/src/com/intellij/cyclicDependencies/ui/CycleNode.java index 937a3eba2505..831dac04fb25 100644 --- a/java/java-impl/src/com/intellij/cyclicDependencies/ui/CycleNode.java +++ b/java/java-impl/src/com/intellij/cyclicDependencies/ui/CycleNode.java @@ -17,12 +17,7 @@ package com.intellij.cyclicDependencies.ui; import com.intellij.analysis.AnalysisScopeBundle; import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; import com.intellij.packageDependencies.ui.PackageDependenciesNode; -import com.intellij.psi.PsiFile; - -import javax.swing.*; -import java.util.Set; /** * User: anna @@ -33,26 +28,6 @@ public class CycleNode extends PackageDependenciesNode{ super(project); } - public void fillFiles(Set set, boolean recursively) { - super.fillFiles(set, recursively); - } - - public void addFile(VirtualFile file, boolean isMarked) { - super.addFile(file, isMarked); - } - - public Icon getOpenIcon() { - return super.getOpenIcon(); - } - - public Icon getClosedIcon() { - return super.getClosedIcon(); - } - - public int getWeight() { - return super.getWeight(); - } - public String toString() { return AnalysisScopeBundle.message("cyclic.dependencies.tree.cycle.node.text"); } diff --git a/java/java-impl/src/com/intellij/ide/scopeView/ClassesScopeTreeStructureExpander.java b/java/java-impl/src/com/intellij/ide/scopeView/ClassesScopeTreeStructureExpander.java index 1e55ba8d8531..a025a1e7cdc6 100644 --- a/java/java-impl/src/com/intellij/ide/scopeView/ClassesScopeTreeStructureExpander.java +++ b/java/java-impl/src/com/intellij/ide/scopeView/ClassesScopeTreeStructureExpander.java @@ -94,10 +94,6 @@ public class ClassesScopeTreeStructureExpander implements ScopeTreeStructureExpa @Override public void visitField(PsiField field) { classNode.add(new FieldNode(field)); } - - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - } - }); } } diff --git a/java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java b/java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java index e982d8809d10..0d513d2a0af8 100644 --- a/java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java @@ -961,14 +961,6 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor { myInstanceVisitor = instanceScanner; } - @Override public void visitTypeElement(PsiTypeElement type) { - super.visitTypeElement (type); - } - - @Override public void visitReferenceElement(PsiJavaCodeReferenceElement element) { - super.visitReferenceElement (element); - } - protected void visitClassMemberReferenceElement(PsiMember classMember, PsiJavaCodeReferenceElement classMemberReference) { if ("super".equals(classMemberReference.getText()) && classMemberReference.getParent() instanceof PsiMethodCallExpression) { return; diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineParameterExpressionProcessor.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineParameterExpressionProcessor.java index 8d92f6e62e83..b7caffed9003 100644 --- a/java/java-impl/src/com/intellij/refactoring/inline/InlineParameterExpressionProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineParameterExpressionProcessor.java @@ -75,9 +75,6 @@ public class InlineParameterExpressionProcessor extends BaseRefactoringProcessor return InlineParameterHandler.REFACTORING_NAME; } - @Override - protected void refreshElements(PsiElement[] elements) { - } @NotNull @Override diff --git a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java index 53d027f281b8..0d8a349394e2 100644 --- a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java +++ b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java @@ -945,7 +945,7 @@ public class RefactoringUtil { return false; } - public static interface ImplicitConstructorUsageVisitor { + public interface ImplicitConstructorUsageVisitor { void visitConstructor(PsiMethod constructor, PsiMethod baseConstructor); void visitClassWithoutConstructors(PsiClass aClass); diff --git a/java/java-runtime/src/com/intellij/rt/execution/junit/segments/SegmentedOutputStream.java b/java/java-runtime/src/com/intellij/rt/execution/junit/segments/SegmentedOutputStream.java index f504d9d5227e..f6f81271c186 100644 --- a/java/java-runtime/src/com/intellij/rt/execution/junit/segments/SegmentedOutputStream.java +++ b/java/java-runtime/src/com/intellij/rt/execution/junit/segments/SegmentedOutputStream.java @@ -44,10 +44,6 @@ public class SegmentedOutputStream extends OutputStream implements PacketProcess flush(); } - public synchronized void write(byte[] b, int off, int len) throws IOException { - super.write(b, off, len); - } - public synchronized void flush() throws IOException { myPrintStream.flush(); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaReflectionCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaReflectionCompletionTest.java index 5d5a4dc178f3..b5edafc67717 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaReflectionCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaReflectionCompletionTest.java @@ -22,11 +22,6 @@ import com.intellij.JavaTestUtil; */ public class JavaReflectionCompletionTest extends LightFixtureCompletionTestCase { - @Override - protected void setUp() throws Exception { - super.setUp(); - } - @Override protected String getBasePath() { return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/completion/reflection/"; diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java index 1ae74c1fee54..5ce544d5c852 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java @@ -47,12 +47,6 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase { doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos); } - @Override - protected void setUp() throws Exception { - - super.setUp(); - } - @Override protected LocalInspectionTool[] configureLocalInspectionTools() { return new LocalInspectionTool[]{ diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java index c4e1abca2b20..a2fea9938009 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java @@ -8,7 +8,6 @@ import com.intellij.codeInspection.defUse.DefUseInspection; import com.intellij.psi.JavaElementVisitor; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiLiteralExpression; -import com.intellij.psi.PsiReferenceExpression; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -53,9 +52,6 @@ public class EmptyIntentionInspectionQuickFixTest extends LightQuickFixTestCase{ @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - - } @Override public void visitLiteralExpression(PsiLiteralExpression expression) { final String s = (String)expression.getValue(); if (s.contains("a")) holder.registerProblem(expression, "Look ma! This String contains 'a'"); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveRedundantUncheckedSuppressionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveRedundantUncheckedSuppressionTest.java index 32faea2675dc..248fc1e0e32b 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveRedundantUncheckedSuppressionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveRedundantUncheckedSuppressionTest.java @@ -67,10 +67,6 @@ public class RemoveRedundantUncheckedSuppressionTest extends LightQuickFixTestCa boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { return new JavaElementVisitor() { - @Override - public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitClass(PsiClass aClass) { checkMember(aClass, inspection, holder); @@ -105,4 +101,4 @@ public class RemoveRedundantUncheckedSuppressionTest extends LightQuickFixTestCa return "/codeInsight/daemonCodeAnalyzer/quickFix/redundantUncheckedVarargs"; } -} \ No newline at end of file +} diff --git a/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java b/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java index 3b1eeb3b6276..80ba3f694409 100644 --- a/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java +++ b/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java @@ -86,9 +86,6 @@ public abstract class BaseJavaLocalInspectionTool extends LocalInspectionTool i @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitMethod(PsiMethod method) { addDescriptors(checkMethod(method, holder.getManager(), isOnTheFly)); } diff --git a/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/ClassHasNoToStringMethodInspection.java b/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/ClassHasNoToStringMethodInspection.java index 52530b646489..fd2a91a35dc4 100644 --- a/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/ClassHasNoToStringMethodInspection.java +++ b/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/ClassHasNoToStringMethodInspection.java @@ -71,9 +71,6 @@ public class ClassHasNoToStringMethodInspection extends AbstractToStringInspecti @Override public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { - public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitClass(PsiClass clazz) { if (log.isDebugEnabled()) log.debug("checkClass: clazz=" + clazz); diff --git a/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/FieldNotUsedInToStringInspection.java b/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/FieldNotUsedInToStringInspection.java index 62893233c6ba..60da814170a5 100644 --- a/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/FieldNotUsedInToStringInspection.java +++ b/plugins/generate-tostring/src/org/jetbrains/generate/tostring/inspection/FieldNotUsedInToStringInspection.java @@ -56,9 +56,6 @@ public class FieldNotUsedInToStringInspection extends AbstractToStringInspection @Override public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { - public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitClass(PsiClass clazz) { checkFields(holder, clazz); diff --git a/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertAnnotationInspection.java b/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertAnnotationInspection.java index e3ad57c3d889..0465c72ea664 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertAnnotationInspection.java +++ b/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertAnnotationInspection.java @@ -39,9 +39,6 @@ public class ConvertAnnotationInspection extends BaseJavaLocalInspectionTool { @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(final PsiReferenceExpression expression) { - } - @Override public void visitAnnotation(final PsiAnnotation annotation) { final @NonNls String qualifiedName = annotation.getQualifiedName(); if (qualifiedName != null && qualifiedName.startsWith("org.testng.annotations")) { diff --git a/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertJavadocInspection.java b/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertJavadocInspection.java index 1f098a3d57b9..c732c5f0ba0d 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertJavadocInspection.java +++ b/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertJavadocInspection.java @@ -64,9 +64,6 @@ public class ConvertJavadocInspection extends BaseJavaLocalInspectionTool { @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(final PsiReferenceExpression expression) { - } - @Override public void visitDocTag(final PsiDocTag tag) { if (tag.getName().startsWith(TESTNG_PREFIX)) { holder.registerProblem(tag, DISPLAY_NAME, new ConvertJavadocQuickfix()); diff --git a/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertOldAnnotationInspection.java b/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertOldAnnotationInspection.java index e7f9ea460e8e..9cdffbb0012a 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertOldAnnotationInspection.java +++ b/plugins/testng/src/com/theoryinpractice/testng/inspection/ConvertOldAnnotationInspection.java @@ -65,9 +65,6 @@ public class ConvertOldAnnotationInspection extends BaseJavaLocalInspectionTool @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(final PsiReferenceExpression expression) { - } - @Override public void visitAnnotation(final PsiAnnotation annotation) { final String qualifiedName = annotation.getQualifiedName(); if (Comparing.strEqual(qualifiedName, "org.testng.annotations.Configuration")) { @@ -132,4 +129,4 @@ public class ConvertOldAnnotationInspection extends BaseJavaLocalInspectionTool } } -} \ No newline at end of file +} diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/inspections/BoundFieldAssignmentInspection.java b/plugins/ui-designer/src/com/intellij/uiDesigner/inspections/BoundFieldAssignmentInspection.java index cdbbf1842c46..f3f749ffd160 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/inspections/BoundFieldAssignmentInspection.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/inspections/BoundFieldAssignmentInspection.java @@ -56,9 +56,6 @@ public class BoundFieldAssignmentInspection extends BaseJavaLocalInspectionTool @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { - @Override public void visitReferenceExpression(PsiReferenceExpression expression) { - } - @Override public void visitAssignmentExpression(PsiAssignmentExpression expression) { if (expression.getLExpression() instanceof PsiReferenceExpression) { From 7c116e85d8c11b825c36cf4bb4c9122684c30260 Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Thu, 19 Apr 2012 16:13:47 +0400 Subject: [PATCH 29/36] IDEA-84847 adding a new plugin in a profile and activating the profile inside Idea does not update known goals of that plugin --- .../idea/maven/project/MavenProjectsTree.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java index 21c7cb627dc9..1736e8219029 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsTree.java @@ -1021,11 +1021,11 @@ public class MavenProjectsTree { embedder.customizeForResolve(console, process); embedder.clearCachesFor(mavenProject.getMavenId()); + Set filesToRefresh = new HashSet(); + try { process.setText(ProjectBundle.message("maven.downloading.pom.plugins", mavenProject.getDisplayName())); - Set filesToRefresh = new HashSet(); - for (MavenPlugin each : mavenProject.getDeclaredPlugins()) { process.checkCanceled(); @@ -1040,12 +1040,14 @@ public class MavenProjectsTree { } } - LocalFileSystem.getInstance().refreshIoFiles(filesToRefresh); - mavenProject.resetCache(); firePluginsResolved(mavenProject); } finally { + if (filesToRefresh.size() > 0) { + LocalFileSystem.getInstance().refreshIoFiles(filesToRefresh); + } + embeddersManager.release(embedder); } } From 1d3b4a9fa060c6c60681fb691b0618cd7fc2c4ae Mon Sep 17 00:00:00 2001 From: Vassiliy Kudryashov Date: Thu, 19 Apr 2012 16:47:24 +0400 Subject: [PATCH 30/36] IDEA-68331 Mouse 4/Mouse 5 button not detected Mouse side-buttons behavior has been improved (especially for Ubuntu) --- .../keymap/impl/IdeMouseEventDispatcher.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeMouseEventDispatcher.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeMouseEventDispatcher.java index ac3d5472b2ad..1c1126eea938 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeMouseEventDispatcher.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeMouseEventDispatcher.java @@ -135,19 +135,17 @@ public final class IdeMouseEventDispatcher { ignore = true; } + patchClickCount(e); + if (e.isConsumed() || e.isPopupTrigger() - || MouseEvent.MOUSE_RELEASED != e.getID() - || e.getClickCount() < 1 // TODO[vova,anton] is it possible. it seems that yes! but how??? + || (e.getButton() > 3 ? e.getID() != MOUSE_PRESSED : e.getID() != MOUSE_RELEASED) + || e.getClickCount() < 1 || e.getButton() == MouseEvent.NOBUTTON) { // See #16995. It did happen ignore = true; } - if (e.getID() == MouseEvent.MOUSE_PRESSED && e.getButton() > 3) { - return true; - } - - final JRootPane root = findRoot(e); + final JRootPane root = findRoot(e); if (root != null) { final Integer lastId = myRootPane2BlockedId.get(root); if (lastId != null) { @@ -213,7 +211,7 @@ public final class IdeMouseEventDispatcher { if (actions.length > 0 && e.isConsumed()) return true; } - return false; + return e.getButton() > 3; } private static void resetPopupTrigger(final MouseEvent e) { @@ -225,6 +223,18 @@ public final class IdeMouseEventDispatcher { catch (Exception ignored) { } } + private static void patchClickCount(final MouseEvent e) { + if (e.getClickCount() == 0 && e.getButton() > 3) { + try { + final Field clickCount = e.getClass().getDeclaredField("clickCount"); + clickCount.setAccessible(true); + clickCount.set(e, 1); + } + catch (Exception ignored) { + } + } + } + private boolean doHorizontalScrolling(Component c, MouseWheelEvent me) { final JScrollBar scrollBar = findHorizontalScrollBar(c); if (scrollBar != null) { From 48e7cc17c172ddc5a6f03504f02036d6ed493a62 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Thu, 19 Apr 2012 14:53:25 +0200 Subject: [PATCH 31/36] Platform: show dialogs even if the window is hidden --- .../src/com/intellij/ui/mac/foundation/MacUtil.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java b/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java index cf3fb2747e13..64ddda5e3239 100644 --- a/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java +++ b/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java @@ -15,10 +15,10 @@ */ package com.intellij.ui.mac.foundation; +import com.intellij.openapi.util.Comparing; import org.jetbrains.annotations.Nullable; import javax.swing.*; - import java.awt.*; import static com.intellij.ui.mac.foundation.Foundation.invoke; @@ -52,11 +52,9 @@ public class MacUtil { final ID windowTitle = invoke(window, "title"); if (windowTitle != null && windowTitle.intValue() != 0) { final String titleString = toStringViaUTF8(windowTitle); - if (titleString.equals(title)) { - if (1 == invoke(window, "isVisible").intValue()) { - focusedWindow = window; - break; - } + if (Comparing.equal(titleString, title)) { + focusedWindow = window; + break; } } } From 4d4c852bfa6b201159a3c2ecab942a933d5ed701 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 19 Apr 2012 15:34:16 +0200 Subject: [PATCH 32/36] minor checks --- .../src/com/intellij/testFramework/AbstractVcsTestCase.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/testFramework/src/com/intellij/testFramework/AbstractVcsTestCase.java b/platform/testFramework/src/com/intellij/testFramework/AbstractVcsTestCase.java index 67d0eed69bbc..468ca72f96a3 100644 --- a/platform/testFramework/src/com/intellij/testFramework/AbstractVcsTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/AbstractVcsTestCase.java @@ -48,6 +48,8 @@ import java.io.OutputStream; import java.util.*; import java.util.concurrent.atomic.AtomicReference; +import static junit.framework.Assert.assertTrue; + /** * @author yole */ @@ -343,6 +345,8 @@ public abstract class AbstractVcsTestCase { } public static void editFileInCommand(final Project project, final VirtualFile file, final String newContent) { + assertTrue(file.isValid()); + file.getTimeStamp(); new WriteCommandAction.Simple(project) { @Override protected void run() throws Throwable { From aef5f3e23b45a2c9b1171720de4c77c6ecdc9518 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 19 Apr 2012 12:54:57 +0200 Subject: [PATCH 33/36] move perform button to the right for mac (IDEA-84885) --- .../usageView/src/com/intellij/usages/impl/UsageViewImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java index ab727d4b34d8..21eff6b28853 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java @@ -892,7 +892,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra @Override public void addButtonToLowerPane(@NotNull Runnable runnable, @NotNull String text) { int index = myButtonPanel.getComponentCount(); - if (index > 0 && myPresentation.isShowCancelButton()) index--; + if (!SystemInfo.isMac && index > 0 && myPresentation.isShowCancelButton()) index--; myButtonPanel.addButtonRunnable(index, runnable, text); } From 006a6d37606e330c1a37d1d361f88f42ad4c203b Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 19 Apr 2012 15:52:41 +0200 Subject: [PATCH 34/36] PerforceCheckinComponent: report no jobs found only once --- .../src/com/intellij/openapi/vcs/ui/TextFieldAction.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/ui/TextFieldAction.java b/platform/vcs-api/src/com/intellij/openapi/vcs/ui/TextFieldAction.java index befd526c7f13..9139f90b8ab9 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/ui/TextFieldAction.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/ui/TextFieldAction.java @@ -13,10 +13,12 @@ package com.intellij.openapi.vcs.ui; import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.actionSystem.ex.CustomComponentAction; import com.intellij.openapi.util.SystemInfo; import com.intellij.ui.IdeBorderFactory; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.border.Border; @@ -36,8 +38,8 @@ public abstract class TextFieldAction extends AnAction implements CustomComponen myField = new JTextField(initSize); myField.addKeyListener(new KeyAdapter() { @Override - public void keyTyped(KeyEvent e) { - if ('\n' == e.getKeyChar()) { + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { e.consume(); actionPerformed(null); } @@ -45,6 +47,9 @@ public abstract class TextFieldAction extends AnAction implements CustomComponen }); } + @Override + public abstract void actionPerformed(@Nullable AnActionEvent e); + public JComponent createCustomComponent(Presentation presentation) { // honestly borrowed from SearchTextField From 5f5db1e8b2dd9061ca909e0f77b4be19da11e056 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 19 Apr 2012 16:28:18 +0200 Subject: [PATCH 35/36] IDEA-84027 Balloons should fit window despite long textual content --- .../com/intellij/notification/EventLog.java | 8 +++---- .../impl/NotificationsManagerImpl.java | 23 +++++++++++++++---- .../impl/actions/NotificationTestAction.java | 5 +++- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/notification/EventLog.java b/platform/platform-impl/src/com/intellij/notification/EventLog.java index 89e8189e62e0..7a33e1205234 100644 --- a/platform/platform-impl/src/com/intellij/notification/EventLog.java +++ b/platform/platform-impl/src/com/intellij/notification/EventLog.java @@ -41,9 +41,7 @@ import com.intellij.openapi.ui.SimpleToolWindowPanel; import com.intellij.openapi.ui.popup.Balloon; import com.intellij.openapi.util.*; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.wm.ToolWindow; -import com.intellij.openapi.wm.ToolWindowFactory; -import com.intellij.openapi.wm.ToolWindowManager; +import com.intellij.openapi.wm.*; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentFactory; @@ -532,7 +530,9 @@ public class EventLog implements Notifications { RelativePoint target = EventLog.getProjectComponent(project).myConsole.getHyperlinkLocation(this); if (target != null) { - Balloon balloon = NotificationsManagerImpl.createBalloon(myNotification, true, true); + IdeFrame frame = WindowManager.getInstance().getIdeFrame(project); + assert frame != null; + Balloon balloon = NotificationsManagerImpl.createBalloon(frame, myNotification, true, true); Disposer.register(project, balloon); balloon.show(target, Balloon.Position.above); } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java index 6f666d2e8a9c..6e17b411238e 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java @@ -28,10 +28,12 @@ import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.popup.*; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.wm.IdeFrame; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.WindowManager; import com.intellij.openapi.wm.impl.IdeFrameImpl; import com.intellij.ui.BalloonImpl; +import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.util.ArrayUtil; import com.intellij.util.ui.UIUtil; @@ -203,7 +205,7 @@ public class NotificationsManagerImpl extends NotificationsManager implements No final ProjectManager projectManager = ProjectManager.getInstance(); final boolean noProjects = projectManager.getOpenProjects().length == 0; final boolean sticky = NotificationDisplayType.STICKY_BALLOON == displayType || noProjects; - final Balloon balloon = createBalloon(notification, false, false); + final Balloon balloon = createBalloon((IdeFrameImpl)window, notification, false, false); Disposer.register(project != null ? project : ApplicationManager.getApplication(), balloon); if (notification.isExpired()) { @@ -251,7 +253,7 @@ public class NotificationsManagerImpl extends NotificationsManager implements No return frame; } - public static Balloon createBalloon(final Notification notification, final boolean showCallout, final boolean hideOnClickOutside) { + public static Balloon createBalloon(@NotNull final IdeFrame window, final Notification notification, final boolean showCallout, final boolean hideOnClickOutside) { final JEditorPane text = new JEditorPane(); text.setEditorKit(UIUtil.getHTMLEditorKit()); @@ -273,9 +275,14 @@ public class NotificationsManagerImpl extends NotificationsManager implements No final JPanel content = new NonOpaquePanel(new BorderLayout((int)(label.getIconTextGap() * 1.5), (int)(label.getIconTextGap() * 1.5))); - final NonOpaquePanel textWrapper = new NonOpaquePanel(new GridBagLayout()); - textWrapper.add(text); - content.add(textWrapper, BorderLayout.CENTER); + text.setCaretPosition(0); + JScrollPane pane = ScrollPaneFactory.createScrollPane(text, + ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + pane.setBorder(null); + pane.setOpaque(false); + pane.getViewport().setOpaque(false); + content.add(pane, BorderLayout.CENTER); final NonOpaquePanel north = new NonOpaquePanel(new BorderLayout()); north.add(new JLabel(NotificationsUtil.getIcon(notification)), BorderLayout.NORTH); @@ -283,6 +290,12 @@ public class NotificationsManagerImpl extends NotificationsManager implements No content.setBorder(new EmptyBorder(2, 4, 2, 4)); + Dimension preferredSize = pane.getPreferredSize(); + int maxHeight = Math.min(400, window.getComponent().getHeight() - 20); + if (preferredSize.height > maxHeight) { + pane.setPreferredSize(new Dimension(preferredSize.width, maxHeight)); + } + final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(content); builder.setFillColor(NotificationsUtil.getBackground(notification)).setCloseButtonEnabled(true).setShowCallout(showCallout) .setHideOnClickOutside(hideOnClickOutside) diff --git a/platform/platform-impl/src/com/intellij/notification/impl/actions/NotificationTestAction.java b/platform/platform-impl/src/com/intellij/notification/impl/actions/NotificationTestAction.java index a8a6054a8898..4c11dc165a05 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/actions/NotificationTestAction.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/actions/NotificationTestAction.java @@ -25,6 +25,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.messages.MessageBus; import javax.swing.event.HyperlinkEvent; @@ -61,7 +62,9 @@ public class NotificationTestAction extends AnAction implements DumbAware { }; final Notification notification = new Notification(TEST_GROUP_ID, "This is a test notification", //"a", - "You can
close this very

very very very long notification by clicking this link. Long long long long. It should be long. Very long. Too long. And even longer.", + "You can
close this very

very very very long notification by clicking this link. Long long long long. It should be long. Very long. Too long." + + StringUtil.repeat("
line", 100) + + " And even longer.", type, listener); ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { From b42ed63049c9ec4f0c0e8f718f825d8db93a7755 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 19 Apr 2012 17:17:28 +0200 Subject: [PATCH 36/36] IDEA-83223 IDEA incorrectly inserts 'super' keyword with replace completion character. --- .../normal/ReplaceThisWithSuper.java | 10 +++++++ .../normal/ReplaceThisWithSuper_After.java | 10 +++++++ .../completion/TabCompletionTest.java | 26 +++++++++++-------- .../util/ParenthesesInsertHandler.java | 1 + 4 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 java/java-tests/testData/codeInsight/completion/normal/ReplaceThisWithSuper.java create mode 100644 java/java-tests/testData/codeInsight/completion/normal/ReplaceThisWithSuper_After.java diff --git a/java/java-tests/testData/codeInsight/completion/normal/ReplaceThisWithSuper.java b/java/java-tests/testData/codeInsight/completion/normal/ReplaceThisWithSuper.java new file mode 100644 index 000000000000..553a4cefe4f2 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/normal/ReplaceThisWithSuper.java @@ -0,0 +1,10 @@ +public class Util { + public Util(String a) { + this.a = a; + } + + public Util() { + suthis("2"); + } + +} diff --git a/java/java-tests/testData/codeInsight/completion/normal/ReplaceThisWithSuper_After.java b/java/java-tests/testData/codeInsight/completion/normal/ReplaceThisWithSuper_After.java new file mode 100644 index 000000000000..2ae91d849b5f --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/normal/ReplaceThisWithSuper_After.java @@ -0,0 +1,10 @@ +public class Util { + public Util(String a) { + this.a = a; + } + + public Util() { + super("2"); + } + +} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/TabCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/TabCompletionTest.java index 0a3c8b2dc45c..a2481a48985e 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/TabCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/TabCompletionTest.java @@ -3,26 +3,30 @@ package com.intellij.codeInsight.completion; import com.intellij.JavaTestUtil; -public class TabCompletionTest extends LightCompletionTestCase { - +public class TabCompletionTest extends LightFixtureCompletionTestCase { @Override - protected String getTestDataPath() { - return JavaTestUtil.getJavaTestDataPath(); + protected String getBasePath() { + return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/completion/normal"; } public void testMethodCallCompletionWithTab() throws Exception { - configureByFile("/codeInsight/completion/normal/MethodLookup3.java"); - checkResultByFile("/codeInsight/completion/normal/MethodLookup3_After.java"); + configureByFile("MethodLookup3.java"); + checkResultByFile("MethodLookup3_After.java"); + } + + public void testReplaceThisWithSuper() throws Throwable { + configureByFile("ReplaceThisWithSuper.java"); + checkResultByFile("ReplaceThisWithSuper_After.java"); } public void testTabInXml() throws Throwable { - configureByFile("/codeInsight/completion/normal/TabInXml.xml"); - checkResultByFile("/codeInsight/completion/normal/TabInXml_After.xml"); + configureByFile("TabInXml.xml"); + checkResultByFile("TabInXml_After.xml"); } - + public void testTabInXml2() throws Throwable { - configureByFile("/codeInsight/completion/normal/TabInXml2.xml"); - checkResultByFile("/codeInsight/completion/normal/TabInXml2_After.xml"); + configureByFile("TabInXml2.xml"); + checkResultByFile("TabInXml2_After.xml"); } @Override diff --git a/platform/lang-api/src/com/intellij/codeInsight/completion/util/ParenthesesInsertHandler.java b/platform/lang-api/src/com/intellij/codeInsight/completion/util/ParenthesesInsertHandler.java index 8ce543e7f688..41af4b29b6a9 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/completion/util/ParenthesesInsertHandler.java +++ b/platform/lang-api/src/com/intellij/codeInsight/completion/util/ParenthesesInsertHandler.java @@ -90,6 +90,7 @@ public abstract class ParenthesesInsertHandler implemen public void handleInsert(final InsertionContext context, final T item) { final Editor editor = context.getEditor(); final Document document = editor.getDocument(); + context.commitDocument(); PsiElement element = findNextToken(context); final char completionChar = context.getCompletionChar();