diff --git a/platform/lang-api/src/com/intellij/execution/configurations/RunConfiguration.java b/platform/lang-api/src/com/intellij/execution/configurations/RunConfiguration.java index 7e7e88b3df99..992f6715611a 100644 --- a/platform/lang-api/src/com/intellij/execution/configurations/RunConfiguration.java +++ b/platform/lang-api/src/com/intellij/execution/configurations/RunConfiguration.java @@ -22,6 +22,9 @@ import com.intellij.openapi.util.JDOMExternalizable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * @see com.intellij.execution.RunManager + */ public interface RunConfiguration extends RunProfile, JDOMExternalizable, Cloneable { ConfigurationFactory getFactory(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPass.java index df0cea32c0c2..d4e0af3d53bb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPass.java @@ -32,6 +32,7 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.psi.FileViewProvider; import com.intellij.psi.PsiFile; import com.intellij.util.containers.HashMap; +import com.intellij.util.ui.update.Update; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -163,7 +164,18 @@ public class ExternalToolPass extends TextEditorHighlightingPass { r.run(); } else { - myExternalToolPassFactory.scheduleExternalActivity(myFile, r); + myExternalToolPassFactory.scheduleExternalActivity(new Update(myFile) { + @Override + public void run() { + r.run(); + } + + @Override + public void setRejected() { + super.setRejected(); + doFinish(); + } + }); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPassFactory.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPassFactory.java index f719f5e89cf4..a659e5c3396f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPassFactory.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPassFactory.java @@ -78,12 +78,7 @@ public class ExternalToolPassFactory extends AbstractProjectComponent implements return false; } - void scheduleExternalActivity(@NotNull PsiFile file, @NotNull final Runnable r) { - myExternalActivitiesQueue.queue(new Update(file) { - @Override - public void run() { - r.run(); - } - }); - } + void scheduleExternalActivity(@NotNull Update update) { + myExternalActivitiesQueue.queue(update); + } } diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 62fbff7a3740..c3c45db3336f 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -135,7 +135,7 @@ public class FileStructurePopup implements Disposable { else { myTreeActionsOwner = null; myTreeModel = structureViewModel; - } + } myTreeStructure = new SmartTreeStructure(project, myTreeModel){ public void rebuildTree() { @@ -233,7 +233,7 @@ public class FileStructurePopup implements Disposable { } }) .createPopup(); - + myTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { @@ -255,6 +255,7 @@ public class FileStructurePopup implements Disposable { } } }); + myTree.getEmptyText().setText("Loading..."); final Point location = DimensionService.getInstance().getLocation(getDimensionServiceKey(), myProject); if (location != null) { myPopup.showInScreenCoordinates(myEditor.getContentComponent(), location); @@ -267,29 +268,24 @@ public class FileStructurePopup implements Disposable { myPopup.setSize(new Dimension(myPreferredWidth + 10, myPopup.getSize().height)); } - //final long cur = System.currentTimeMillis(); - final Runnable expandIsDone = new Runnable() { + IdeFocusManager.getInstance(myProject).requestFocus(myTree, true); + myAbstractTreeBuilder.queueUpdate().doWhenDone(new Runnable() { @Override public void run() { - //System.out.println(System.currentTimeMillis() - cur); - IdeFocusManager.getInstance(myProject).requestFocus(myTree, true); - myAbstractTreeBuilder.queueUpdate().doWhenDone(new Runnable() { - @Override + myTreeHasBuilt.setDone(); + ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { - selectPsiElement(myInitialPsiElement); - myTreeHasBuilt.setDone(); - //long t = System.currentTimeMillis() - time; - //System.out.println("Shown in " + t + "ms"); + myFilteringStructure.rebuild(); + myAbstractTreeBuilder.queueUpdate(true).doWhenDone(new Runnable() { + @Override + public void run() { + selectPsiElement(myInitialPsiElement); + } + }); } }); } - }; - - //if (myTree.isAlwaysExpanded() || true) { - expandIsDone.run(); - //} else { - // myAbstractTreeBuilder.expandAll(expandIsDone); - //} + }); if (!ApplicationManager.getApplication().isUnitTestMode()) { final Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, myPopup); @@ -457,11 +453,11 @@ public class FileStructurePopup implements Disposable { } } }.registerCustomShortcutSet(CustomShortcutSet.fromString("ESCAPE"), myTree); - + myTree.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1) { + if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1) { navigateSelectedElement(); } } @@ -497,7 +493,7 @@ public class FileStructurePopup implements Disposable { return null; } }); - myFilteringStructure.rebuild(); + return panel; } @@ -566,7 +562,7 @@ public class FileStructurePopup implements Disposable { private void addCheckbox(final JPanel panel, final TreeAction action) { String text = action instanceof FileStructureFilter ? ((FileStructureFilter)action).getCheckBoxText() : - action instanceof FileStructureNodeProvider ? ((FileStructureNodeProvider)action).getCheckBoxText() : null; + action instanceof FileStructureNodeProvider ? ((FileStructureNodeProvider)action).getCheckBoxText() : null; if (text == null) return; @@ -574,7 +570,7 @@ public class FileStructurePopup implements Disposable { ((FileStructureFilter)action).getShortcut() : ((FileStructureNodeProvider)action).getShortcut(); - + final JCheckBox chkFilter = new JCheckBox(); final boolean selected = getDefaultValue(action); chkFilter.setSelected(selected); @@ -592,7 +588,7 @@ public class FileStructurePopup implements Disposable { } myTreeStructure.rebuildTree(); myFilteringStructure.rebuild(); - + final Object sel = selection; final Runnable runnable = new Runnable() { public void run() { @@ -745,8 +741,8 @@ public class FileStructurePopup implements Disposable { } else { return false; } - - } + + } return true; } diff --git a/platform/lang-impl/src/com/intellij/openapi/fileTypes/FileTypeUsagesCollector.java b/platform/lang-impl/src/com/intellij/openapi/fileTypes/FileTypeUsagesCollector.java index a93b73fae882..8269d1d6e7e7 100644 --- a/platform/lang-impl/src/com/intellij/openapi/fileTypes/FileTypeUsagesCollector.java +++ b/platform/lang-impl/src/com/intellij/openapi/fileTypes/FileTypeUsagesCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 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. @@ -16,6 +16,7 @@ package com.intellij.openapi.fileTypes; import com.intellij.internal.statistic.AbstractApplicationUsagesCollector; +import com.intellij.internal.statistic.CollectUsagesException; import com.intellij.internal.statistic.beans.GroupDescriptor; import com.intellij.internal.statistic.beans.UsageDescriptor; import com.intellij.openapi.application.ApplicationManager; @@ -46,30 +47,35 @@ public class FileTypeUsagesCollector extends AbstractApplicationUsagesCollector @NotNull @Override - public Set getProjectUsages(@NotNull final Project project) { + public Set getProjectUsages(@NotNull final Project project) throws CollectUsagesException { final Set usedFileTypes = new HashSet(); - ApplicationManager.getApplication().runReadAction(new Runnable() { - @Override - public void run() { - if (!project.isDisposed()) { - final FileType[] registeredFileTypes = FileTypeManager.getInstance().getRegisteredFileTypes(); - for (final FileType fileType : registeredFileTypes) { - FileBasedIndex.getInstance().processValues( - FileTypeIndex.NAME, - fileType, - null, - new FileBasedIndex.ValueProcessor() { - @Override - public boolean process(VirtualFile file, Void value) { - usedFileTypes.add(fileType); - return false; - } - }, GlobalSearchScope.projectScope(project)); - } - usedFileTypes.add(UnknownFileType.INSTANCE); - } + final FileTypeManager fileTypeManager = FileTypeManager.getInstance(); + if (fileTypeManager == null) { + throw new CollectUsagesException("Cannot get instance of FileTypeManager"); + } + final FileType[] registeredFileTypes = fileTypeManager.getRegisteredFileTypes(); + for (final FileType fileType : registeredFileTypes) { + if (project.isDisposed()) { + throw new CollectUsagesException("Project is disposed"); } - }); + ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override + public void run() { + FileBasedIndex.getInstance().processValues( + FileTypeIndex.NAME, + fileType, + null, + new FileBasedIndex.ValueProcessor() { + @Override + public boolean process(VirtualFile file, Void value) { + usedFileTypes.add(fileType); + return false; + } + }, GlobalSearchScope.projectScope(project)); + } + }); + } + usedFileTypes.add(UnknownFileType.INSTANCE); return ContainerUtil.map2Set(usedFileTypes, new NotNullFunction() { @NotNull @Override diff --git a/platform/platform-api/src/com/intellij/ide/ui/UISettings.java b/platform/platform-api/src/com/intellij/ide/ui/UISettings.java index c25837f09326..00facabfd373 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/UISettings.java +++ b/platform/platform-api/src/com/intellij/ide/ui/UISettings.java @@ -300,7 +300,7 @@ public class UISettings implements PersistentStateComponent, Exporta UISettings uiSettings=getInstance(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF); - GraphicsUtil.setupAntialiasing(g2d, uiSettings == null || uiSettings.ANTIALIASING_IN_EDITOR); + GraphicsUtil.setupAntialiasing(g2d, uiSettings == null || uiSettings.ANTIALIASING_IN_EDITOR, true); } /** diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/AbstractApplicationUsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/AbstractApplicationUsagesCollector.java index 97a9340edf99..6b994c098505 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/AbstractApplicationUsagesCollector.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/AbstractApplicationUsagesCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -18,6 +18,7 @@ package com.intellij.internal.statistic; import com.intellij.internal.statistic.beans.UsageDescriptor; import com.intellij.internal.statistic.persistence.ApplicationStatisticsPersistence; import com.intellij.internal.statistic.persistence.ApplicationStatisticsPersistenceComponent; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; @@ -29,8 +30,17 @@ import java.util.Map; import java.util.Set; public abstract class AbstractApplicationUsagesCollector extends UsagesCollector { + + private static final Logger LOG = Logger.getInstance("#com.intellij.internal.statistic.AbstractApplicationUsagesCollector"); + public void persistProjectUsages(@NotNull Project project) { - persistProjectUsages(project, getProjectUsages(project)); + try { + final Set projectUsages = getProjectUsages(project); + persistProjectUsages(project, projectUsages); + } + catch (CollectUsagesException e) { + LOG.info(e); + } } public void persistProjectUsages(@NotNull Project project, @NotNull Set usages) { @@ -69,14 +79,15 @@ public abstract class AbstractApplicationUsagesCollector extends UsagesCollector } @NotNull - public Set getUsages(@Nullable Project project) { + public Set getUsages(@Nullable Project project) throws CollectUsagesException { if (project != null) { - persistProjectUsages(project, getProjectUsages(project)); + final Set projectUsages = getProjectUsages(project); + persistProjectUsages(project, projectUsages); } return getApplicationUsages(); } @NotNull - public abstract Set getProjectUsages(@NotNull Project project); + public abstract Set getProjectUsages(@NotNull Project project) throws CollectUsagesException; } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/CollectUsagesException.java b/platform/platform-impl/src/com/intellij/internal/statistic/CollectUsagesException.java new file mode 100644 index 000000000000..7c5d473759c5 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/internal/statistic/CollectUsagesException.java @@ -0,0 +1,26 @@ +/* + * 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. + * 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.internal.statistic; + +/** + * @author Nikolay Matveev + */ +public class CollectUsagesException extends Exception { + + public CollectUsagesException(String message) { + super(message); + } +} diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/StatisticsUploadAssistant.java b/platform/platform-impl/src/com/intellij/internal/statistic/StatisticsUploadAssistant.java index 5b11661f8c11..c4436275532a 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/StatisticsUploadAssistant.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/StatisticsUploadAssistant.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -24,6 +24,7 @@ import com.intellij.internal.statistic.beans.UsageDescriptor; import com.intellij.internal.statistic.persistence.SentUsagesPersistence; import com.intellij.internal.statistic.persistence.UsageStatisticsPersistenceComponent; import com.intellij.openapi.application.ex.ApplicationManagerEx; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; @@ -39,6 +40,8 @@ import java.util.*; public class StatisticsUploadAssistant { + private static final Logger LOG = Logger.getInstance("#com.intellij.internal.statistic.StatisticsUploadAssistant"); + public String getData() { return getData(Collections.emptySet()); } @@ -233,7 +236,13 @@ public class StatisticsUploadAssistant { final GroupDescriptor groupDescriptor = usagesCollector.getGroupId(); if (!disabledGroups.contains(groupDescriptor.getId())) { - usageDescriptors.put(groupDescriptor, usagesCollector.getUsages(project)); + try { + final Set usages = usagesCollector.getUsages(project); + usageDescriptors.put(groupDescriptor, usages); + } + catch (CollectUsagesException e) { + LOG.info(e); + } } } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java index 46e03564bf5d..e0c03c33625f 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/UsagesCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -16,9 +16,9 @@ package com.intellij.internal.statistic; import com.intellij.internal.statistic.beans.GroupDescriptor; +import com.intellij.internal.statistic.beans.UsageDescriptor; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.project.Project; -import com.intellij.internal.statistic.beans.UsageDescriptor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -27,7 +27,7 @@ import java.util.Set; public abstract class UsagesCollector { public static ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.statistics.usagesCollector"); - public abstract @NotNull Set getUsages(@Nullable Project project); + public abstract @NotNull Set getUsages(@Nullable Project project) throws CollectUsagesException; public abstract @NotNull GroupDescriptor getGroupId(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeader.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeader.java index 00988b058f35..f400145531e6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeader.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeader.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 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. diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java index 5e7d5534e91f..460b3ffe3810 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.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. @@ -303,16 +303,22 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh }); c.addMouseListener(new MouseAdapter() { - public void mouseReleased(final MouseEvent e) { + public void mousePressed(final MouseEvent e) { myLastPoint[0] = e.getPoint(); SwingUtilities.convertPointToScreen(myLastPoint[0], c); + if (!e.isPopupTrigger()) { + if (!UIUtil.isCloseClick(e)) { + ui.myWindow.fireActivated(); + } + } + } + + @Override + public void mouseReleased(MouseEvent e) { if (!e.isPopupTrigger()) { if (UIUtil.isCloseClick(e, MouseEvent.MOUSE_RELEASED)) { ui.processHide(e); } - else { - ui.myWindow.fireActivated(); - } } } }); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypeUsagesCollectorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypeUsagesCollectorTest.java index 3e5e8534a86f..48368840cc44 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypeUsagesCollectorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypeUsagesCollectorTest.java @@ -15,6 +15,7 @@ */ package com.intellij.openapi.fileTypes; +import com.intellij.internal.statistic.CollectUsagesException; import com.intellij.internal.statistic.beans.UsageDescriptor; import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; import com.intellij.util.NotNullFunction; @@ -30,7 +31,7 @@ import java.util.Set; */ public class FileTypeUsagesCollectorTest extends LightPlatformCodeInsightFixtureTestCase { - private void doTest(@NotNull Collection fileTypes) { + private void doTest(@NotNull Collection fileTypes) throws CollectUsagesException { final Set usages = new FileTypeUsagesCollector().getProjectUsages(getProject()); for (UsageDescriptor usage : usages) { assertEquals(1, usage.getValue()); @@ -53,16 +54,16 @@ public class FileTypeUsagesCollectorTest extends LightPlatformCodeInsightFixture ); } - public void testEmptyProject() { + public void testEmptyProject() throws CollectUsagesException { doTest(Arrays.asList(UnknownFileType.INSTANCE)); } - public void testSingleFileProject() { + public void testSingleFileProject() throws CollectUsagesException { myFixture.configureByText("a.txt", ""); doTest(Arrays.asList(UnknownFileType.INSTANCE, PlainTextFileType.INSTANCE)); } - public void testSeveralSameFilesProject() { + public void testSeveralSameFilesProject() throws CollectUsagesException { myFixture.configureByText("a.txt", ""); myFixture.configureByText("b.txt", ""); doTest(Arrays.asList(UnknownFileType.INSTANCE, PlainTextFileType.INSTANCE)); diff --git a/platform/util/src/com/intellij/util/ui/GraphicsUtil.java b/platform/util/src/com/intellij/util/ui/GraphicsUtil.java index 5b7e74947dad..560b5decae5a 100644 --- a/platform/util/src/com/intellij/util/ui/GraphicsUtil.java +++ b/platform/util/src/com/intellij/util/ui/GraphicsUtil.java @@ -25,21 +25,21 @@ import java.util.Map; */ public class GraphicsUtil { public static void setupAntialiasing(@NotNull Graphics g2) { - setupAntialiasing(g2, true); + setupAntialiasing(g2, true, false); } - public static void setupAntialiasing(Graphics g2, boolean enable) { + public static void setupAntialiasing(Graphics g2, boolean enableAA, boolean ignoreSystemSettings) { if (g2 instanceof Graphics2D) { Graphics2D g = (Graphics2D)g2; Toolkit tk = Toolkit.getDefaultToolkit(); //noinspection HardCodedStringLiteral Map map = (Map)tk.getDesktopProperty("awt.font.desktophints"); - if (map != null) { + if (map != null && !ignoreSystemSettings) { g.addRenderingHints(map); } else { g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - enable ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); + enableAA ? RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java index d85de9738d2d..53c568ab5a89 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java @@ -15,6 +15,8 @@ */ package org.jetbrains.idea.maven.importing; +import com.intellij.openapi.application.AccessToken; +import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.module.ModifiableModuleModel; import com.intellij.openapi.module.Module; import com.intellij.openapi.roots.*; @@ -215,7 +217,13 @@ public class MavenRootModelAdapter { e = myRootModel.addModuleOrderEntry(m); } else { - e = myRootModel.addInvalidModuleEntry(moduleName); + AccessToken accessToken = ReadAction.start(); + try { + e = myRootModel.addInvalidModuleEntry(moduleName); + } + finally { + accessToken.finish(); + } } e.setScope(scope); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java index 3928df4a6009..110329c8c78b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java @@ -63,6 +63,7 @@ public class SvnRecursiveStatusWalker { myHandler.setCurrentItem(item); try { item.getClient(ioFile).doStatus(ioFile, SVNRevision.WORKING, item.getDepth(), false, false, true, false, myHandler, null); + myHandler.checkIfCopyRootWasReported(); } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() == SVNErrorCode.WC_NOT_DIRECTORY) { @@ -172,17 +173,30 @@ public class SvnRecursiveStatusWalker { myMetCurrentItem = false; } - public void handleStatus(final SVNStatus status) throws SVNException { - myPartner.checkCanceled(); - final File ioFile = status.getFile(); + public void checkIfCopyRootWasReported() { if (! myMetCurrentItem && myCurrentItem.isIsInnerCopyRoot()) { myMetCurrentItem = true; final SVNStatus statusInner = SvnUtil.getStatus(SvnVcs.getInstance(myProject), myCurrentItem.getPath().getIOFile()); - if (myCurrentItem.getPath().getVirtualFile() != null || statusInner != null) { + if (statusInner == null) return; + + final SVNStatusType status = statusInner.getNodeStatus(); + if (SVNStatusType.OBSTRUCTED.equals(status) || SVNStatusType.STATUS_IGNORED.equals(status) || + SVNStatusType.STATUS_NONE.equals(status) || SVNStatusType.STATUS_UNVERSIONED.equals(status) || + SVNStatusType.UNKNOWN.equals(status)) { + return; + } + if (myCurrentItem.getPath().getVirtualFile() != null) { myReceiver.processCopyRoot(myCurrentItem.getPath().getVirtualFile(), statusInner.getURL(), WorkingCopyFormat.getInstance(statusInner.getWorkingCopyFormat())); } } + } + + public void handleStatus(final SVNStatus status) throws SVNException { + myPartner.checkCanceled(); + final File ioFile = status.getFile(); + checkIfCopyRootWasReported(); + final LocalFileSystem lfs = LocalFileSystem.getInstance(); VirtualFile vFile = lfs.findFileByIoFile(ioFile); if (vFile == null) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionChildDescriptionImpl.java index 8e11fa4e8e41..022bbc4151d7 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionChildDescriptionImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionChildDescriptionImpl.java @@ -17,6 +17,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Type; import java.util.Collection; +import java.util.Collections; import java.util.List; /** @@ -27,7 +28,11 @@ public class CollectionChildDescriptionImpl extends DomChildDescriptionImpl impl private final NotNullFunction> myTagsGetter = new NotNullFunction>() { @NotNull public List fun(final DomInvocationHandler handler) { - return DomImplUtil.findSubTags(handler.getXmlTag(), handler.createEvaluatedXmlName(getXmlName()), handler.getFile()); + XmlTag tag = handler.getXmlTag(); + if (tag == null) { + return Collections.emptyList(); + } + return DomImplUtil.findSubTags(tag, handler.createEvaluatedXmlName(getXmlName()), handler.getFile()); } }; diff --git a/xml/impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java b/xml/impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java index 07f57bb6c1e1..6068f42006bd 100644 --- a/xml/impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java +++ b/xml/impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java @@ -26,6 +26,7 @@ import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.xml.*; import com.intellij.util.ArrayUtil; +import com.intellij.util.containers.ConcurrentFactoryMap; import com.intellij.util.containers.FactoryMap; import com.intellij.xml.XmlAttributeDescriptor; import com.intellij.xml.XmlElementDescriptor; @@ -78,7 +79,7 @@ public class ComplexTypeDescriptor extends TypeDescriptor { } }; - private final FactoryMap> myAnyAttributeCache = new FactoryMap>() { + private final FactoryMap> myAnyAttributeCache = new ConcurrentFactoryMap>() { @Override protected CachedValue create(final String key) { return CachedValuesManager.getManager(myTag.getProject()).createCachedValue(new CachedValueProvider() {