diff --git a/build/conf/mac/Contents/Info.plist b/build/conf/mac/Contents/Info.plist index bcb30bc7b44f..6236c5336cc6 100644 --- a/build/conf/mac/Contents/Info.plist +++ b/build/conf/mac/Contents/Info.plist @@ -39,12 +39,14 @@ @@version@@ CFBundleVersion @@build@@ + LSArchitecturePriority - i386 x86_64 - ppc + i386 + LSRequiresNativeExecution + YES Java diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java index 49c9392e9ad7..442a19ceb0f1 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java @@ -1736,8 +1736,13 @@ public class CompileDriver { LOG.assertTrue(outputPath.exists()); } if (!deleteFile(outputPath)) { - if (isTestMode && outputPath.exists()) { - LOG.error("Was not able to delete output file: " + outputPath.getPath()); + if (isTestMode) { + if (outputPath.exists()) { + LOG.error("Was not able to delete output file: " + outputPath.getPath()); + } + else { + CompilerManagerImpl.addDeletedPath(outputPath.getPath()); + } } continue; } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaLookupElementBuilder.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaLookupElementBuilder.java index 13444d8503fc..4e4be0bb501b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaLookupElementBuilder.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaLookupElementBuilder.java @@ -74,6 +74,17 @@ public class JavaLookupElementBuilder { public static LookupElementBuilder forClass(@NotNull PsiClass psiClass, final String lookupString) { - return LookupElementBuilder.create(psiClass, lookupString).setIcon(psiClass.getIcon(Iconable.ICON_FLAG_VISIBILITY)); + return forClass(psiClass, lookupString, false); + } + + public static LookupElementBuilder forClass(@NotNull PsiClass psiClass, + final String lookupString, + final boolean withLocation) { + final LookupElementBuilder builder = + LookupElementBuilder.create(psiClass, lookupString).setIcon(psiClass.getIcon(Iconable.ICON_FLAG_VISIBILITY)); + if (withLocation) { + return builder.setTailText(" (" + PsiFormatUtil.getPackageDisplayName(psiClass) + ")", true); + } + return builder; } } diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java index 42e6c9622a28..c2e63e57f957 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java @@ -15,8 +15,7 @@ */ package com.intellij.psi.impl.source.resolve.reference.impl.providers; -import com.intellij.codeInsight.TailType; -import com.intellij.codeInsight.completion.JavaCompletionUtil; +import com.intellij.codeInsight.completion.JavaLookupElementBuilder; import com.intellij.codeInsight.completion.scope.JavaCompletionProcessor; import com.intellij.codeInsight.daemon.QuickFixProvider; import com.intellij.codeInsight.daemon.impl.HighlightInfo; @@ -24,8 +23,6 @@ import com.intellij.codeInsight.daemon.impl.quickfix.OrderEntryFix; import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction; import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixActionRegistrarImpl; import com.intellij.codeInsight.daemon.quickFix.CreateClassOrPackageFix; -import com.intellij.codeInsight.lookup.LookupElementFactoryImpl; -import com.intellij.codeInsight.lookup.LookupItem; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.LocalQuickFixProvider; import com.intellij.lang.StdLanguages; @@ -534,8 +531,10 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer @Nullable private static Object createSubclassLookupValue(@NotNull final PsiPackage context, @NotNull final PsiClass clazz) { - String name = clazz.getQualifiedName(); - if (name == null) return null; + final String qname = clazz.getQualifiedName(); + if (qname == null) return null; + + String name = qname; final String pack = context.getQualifiedName(); if (pack.length() > 0) { if (name.startsWith(pack)) { @@ -545,9 +544,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer return null; } } - final LookupItem lookup = LookupElementFactoryImpl.getInstance().createLookupElement(clazz, name); - lookup.addLookupStrings(clazz.getName()); - return JavaCompletionUtil.setShowFQN(lookup).setTailType(TailType.NONE); + return JavaLookupElementBuilder.forClass(clazz, name, true).addLookupString(qname).addLookupString(clazz.getName()); } public LocalQuickFix[] getQuickFixes() { diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java index 8dc526ea335f..f82f6680486c 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java @@ -193,7 +193,7 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase { protected void tearDown() throws Exception { ((StartupManagerImpl)StartupManager.getInstance(getProject())).checkCleared(); if (toInitializeDaemon) { - DaemonCodeAnalyzer.getInstance(getProject()).projectClosed(); + ((DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(getProject())).projectClosed(); } super.tearDown(); ((VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance()).assertPointersDisposed(); diff --git a/java/testFramework/src/com/intellij/testFramework/fixtures/LightCodeInsightFixtureTestCase.java b/java/testFramework/src/com/intellij/testFramework/fixtures/LightCodeInsightFixtureTestCase.java index b35959de74a8..09d9a3f054f0 100644 --- a/java/testFramework/src/com/intellij/testFramework/fixtures/LightCodeInsightFixtureTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/fixtures/LightCodeInsightFixtureTestCase.java @@ -90,8 +90,7 @@ public abstract class LightCodeInsightFixtureTestCase extends UsefulTestCase{ IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory(); TestFixtureBuilder fixtureBuilder = factory.createLightFixtureBuilder(getProjectDescriptor()); final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture(); - myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture, - new LightTempDirTestFixtureImpl(true)); + myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture, new LightTempDirTestFixtureImpl(true)); myFixture.setUp(); myFixture.setTestDataPath(getTestDataPath()); diff --git a/platform/lang-api/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzer.java b/platform/lang-api/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzer.java index 9177912c1f1e..7a989a8311a9 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzer.java +++ b/platform/lang-api/src/com/intellij/codeInsight/daemon/DaemonCodeAnalyzer.java @@ -17,14 +17,13 @@ package com.intellij.codeInsight.daemon; -import com.intellij.openapi.components.ProjectComponent; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import com.intellij.util.messages.Topic; import org.jetbrains.annotations.NotNull; -public abstract class DaemonCodeAnalyzer implements ProjectComponent { +public abstract class DaemonCodeAnalyzer { public static DaemonCodeAnalyzer getInstance(Project project) { return project.getComponent(DaemonCodeAnalyzer.class); } diff --git a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementFactory.java b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementFactory.java deleted file mode 100644 index 4d7480fd5162..000000000000 --- a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementFactory.java +++ /dev/null @@ -1,40 +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.codeInsight.lookup; - -import com.intellij.openapi.components.ServiceManager; -import com.intellij.psi.PsiNamedElement; -import org.jetbrains.annotations.NotNull; - -/** - * @deprecated use LookupElementBuilder - * @author peter - */ -public abstract class LookupElementFactory { - - @NotNull - public static LookupElementFactory getInstance() { - return ServiceManager.getService(LookupElementFactory.class); - } - - public abstract MutableLookupElement createLookupElement(@NotNull String lookupString); - - public abstract MutableLookupElement createLookupElement(@NotNull T element); - - public abstract MutableLookupElement createLookupElement(@NotNull T element, @NotNull String lookupString); - -} diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/simple/SimpleLookupItem.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/simple/SimpleLookupItem.java deleted file mode 100644 index 25d1b872e8a5..000000000000 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/simple/SimpleLookupItem.java +++ /dev/null @@ -1,38 +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.codeInsight.completion.simple; - -import com.intellij.codeInsight.lookup.LookupItem; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; - -/** - * @author peter - * @deprecated - * @see com.intellij.codeInsight.lookup.LookupElementBuilder - */ -@Deprecated -public class SimpleLookupItem extends LookupItem { - - public SimpleLookupItem(final T o, @NotNull @NonNls final String lookupString) { - super(o, lookupString); - } - - public SimpleLookupItem(final T o) { - super(o, o.toString()); - } - -} diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java index 39b79c098343..dbcdd3292d01 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java @@ -31,6 +31,7 @@ import com.intellij.ide.PowerSaveMode; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.components.ProjectComponent; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; @@ -77,7 +78,7 @@ import java.util.*; /** * This class also controls the auto-reparse and auto-hints. */ -public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMExternalizable { +public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMExternalizable, ProjectComponent { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl"); private static final Key> MARKERS_IN_EDITOR_DOCUMENT_KEY = Key.create("MARKERS_IN_EDITOR_DOCUMENT"); @@ -172,6 +173,8 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx @NotNull int[] toIgnore, boolean canChangeDocument, @Nullable Runnable callbackWhileWaiting) { + assert isInitialized(); + assert !myDisposed; Application application = ApplicationManager.getApplication(); application.assertIsDispatchThread(); assert !application.isWriteAccessAllowed(); @@ -198,18 +201,20 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx try { while (progress.isRunning()) { try { - if (progress.isCanceled() && progress.isRunning()) { - // write action sneaked in the AWT. restart - waitForTermination(); + if (progress.isCanceled() && progress.isRunning()) { + // write action sneaked in the AWT. restart + waitForTermination(); + Throwable savedException = PassExecutorService.getSavedException(progress); + if (savedException != null) throw savedException; + return runPasses(file, document, textEditor, toIgnore, canChangeDocument, callbackWhileWaiting); + } + if (callbackWhileWaiting != null) { + callbackWhileWaiting.run(); + } + progress.waitFor(100); + UIUtil.dispatchAllInvocationEvents(); Throwable savedException = PassExecutorService.getSavedException(progress); if (savedException != null) throw savedException; - return runPasses(file, document, textEditor, toIgnore, canChangeDocument,callbackWhileWaiting); - } - if (callbackWhileWaiting != null) { - callbackWhileWaiting.run(); - } - progress.waitFor(100); - UIUtil.dispatchAllInvocationEvents(); } catch (RuntimeException e) { e.printStackTrace(); @@ -259,6 +264,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx public void disposeComponent() { } + @Override public void projectOpened() { assert !myInitialized : "Double Initializing"; StatusBarUpdater statusBarUpdater = new StatusBarUpdater(myProject); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupElementFactoryImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupElementFactoryImpl.java deleted file mode 100644 index bb62e1bdf283..000000000000 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupElementFactoryImpl.java +++ /dev/null @@ -1,61 +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.codeInsight.lookup; - -import com.intellij.codeInsight.completion.simple.SimpleLookupItem; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.psi.PsiNamedElement; -import com.intellij.psi.meta.PsiMetaData; -import com.intellij.psi.meta.PsiMetaOwner; -import com.intellij.psi.meta.PsiPresentableMetaData; -import org.jetbrains.annotations.NotNull; - -/** - * @author peter - */ -public class LookupElementFactoryImpl extends LookupElementFactory{ - - @SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass"}) - @NotNull - public static LookupElementFactoryImpl getInstance() { - return (LookupElementFactoryImpl)LookupElementFactory.getInstance(); - } - - - public SimpleLookupItem createLookupElement(@NotNull String lookupString) { - return new SimpleLookupItem(lookupString, lookupString); - } - - public SimpleLookupItem createLookupElement(@NotNull T element) { - final SimpleLookupItem lookupItem = createLookupElement(element, StringUtil.notNullize(element.getName())); - if (element instanceof PsiMetaOwner) { - final PsiMetaData metaData = ((PsiMetaOwner)element).getMetaData(); - if (metaData instanceof PsiPresentableMetaData) { - final PsiPresentableMetaData presentableMetaData = (PsiPresentableMetaData)metaData; - lookupItem.setIcon(presentableMetaData.getIcon()); - final String name = presentableMetaData.getName(); - if (StringUtil.isNotEmpty(name)) { - lookupItem.setPresentableText(name); - } - } - } - return lookupItem; - } - - public SimpleLookupItem createLookupElement(@NotNull T element, @NotNull String lookupString) { - return new SimpleLookupItem(element, lookupString); - } -} diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java b/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java index d8aae724b221..9c5b0286cfed 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java @@ -522,9 +522,9 @@ class FindDialog extends DialogWrapper { return new ValidationInfo("String to find is empty", myInputComboBox); } - if (myCbRegularExpressions != null && myCbRegularExpressions.isEnabled()) { + if (myCbRegularExpressions != null && myCbRegularExpressions.isSelected() && myCbRegularExpressions.isEnabled()) { try { - boolean isCaseSensitive = myCbCaseSensitive != null && myCbCaseSensitive.isEnabled(); + boolean isCaseSensitive = myCbCaseSensitive != null && myCbCaseSensitive.isSelected() && myCbCaseSensitive.isEnabled(); Pattern pattern = Pattern.compile(toFind, isCaseSensitive ? Pattern.MULTILINE : Pattern.MULTILINE | Pattern.CASE_INSENSITIVE); if (pattern.matcher("").matches() && !toFind.endsWith("$") && !toFind.startsWith("^")) { diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/scripting/ScriptingIndexableSetContributor.java b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/scripting/ScriptingIndexableSetContributor.java index 9fb1b06b21ba..99488b8436f2 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/scripting/ScriptingIndexableSetContributor.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/scripting/ScriptingIndexableSetContributor.java @@ -28,6 +28,7 @@ import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Arrays; import java.util.Set; /** @@ -50,14 +51,8 @@ public abstract class ScriptingIndexableSetContributor extends IndexableSetContr if (libTable != null) { for (Library lib : libTable.getLibraries()) { if (lib instanceof LibraryEx && libType.equals(((LibraryEx)lib).getType())) { - for (VirtualFile libFile : lib.getFiles(OrderRootType.SOURCES)) { - libFile.putUserData(getIndexKey(), ""); - libFiles.add(libFile); - } - for (VirtualFile libFile : lib.getFiles(OrderRootType.CLASSES)) { - libFile.putUserData(getIndexKey(), ""); - libFiles.add(libFile); - } + libFiles.addAll(Arrays.asList(lib.getFiles(OrderRootType.SOURCES))); + libFiles.addAll(Arrays.asList(lib.getFiles(OrderRootType.CLASSES))); } } } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/scripting/ScriptingLibrariesScope.java b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/scripting/ScriptingLibrariesScope.java index 18e24cf453a8..fb205c4708e6 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/scripting/ScriptingLibrariesScope.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/scripting/ScriptingLibrariesScope.java @@ -16,30 +16,55 @@ package com.intellij.openapi.roots.libraries.scripting; import com.intellij.openapi.module.Module; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.roots.ProjectRootManager; +import com.intellij.openapi.util.Key; +import com.intellij.openapi.util.UserDataCache; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiManager; import com.intellij.psi.search.GlobalSearchScope; +import com.intellij.psi.util.CachedValue; +import com.intellij.psi.util.CachedValueProvider; import com.intellij.util.indexing.IndexableSetContributor; import org.jetbrains.annotations.NotNull; +import java.util.Collections; import java.util.Set; /** * @author Rustam Vishnyakov */ public class ScriptingLibrariesScope extends GlobalSearchScope { + private static final UserDataCache>, Project, Class> ourAllLibFilesCache = + new UserDataCache>, Project, Class>() { + @Override + protected CachedValue> compute(final Project project, final Class p) { + return PsiManager.getInstance(project).getCachedValuesManager().createCachedValue(new CachedValueProvider>() { + @Override + public Result> compute() { + IndexableSetContributor contributor; + contributor = IndexableSetContributor.EP_NAME.findExtension(p); + Set result; + if (contributor instanceof ScriptingIndexableSetContributor) { + result = ((ScriptingIndexableSetContributor)contributor).getLibraryFiles(project); + } else { + result = Collections.emptySet(); + } + return new Result>(result, ProjectRootManager.getInstance(project)); + } + }, false); + } + }; private GlobalSearchScope myBaseScope; protected Set myLibraryFiles; private Set myAllLibraryFiles; - public ScriptingLibrariesScope(GlobalSearchScope baseScope, Class providerClass) { + public ScriptingLibrariesScope(GlobalSearchScope baseScope, Class providerClass, Key key) { super(baseScope.getProject()); myBaseScope = baseScope; - IndexableSetContributor contributor = IndexableSetContributor.EP_NAME.findExtension(providerClass); - if (contributor instanceof ScriptingIndexableSetContributor) { - myAllLibraryFiles = ((ScriptingIndexableSetContributor)contributor).getLibraryFiles(myBaseScope.getProject()); - setLibraryFiles(); - } + myAllLibraryFiles = ourAllLibFilesCache.get(key, baseScope.getProject(), providerClass).getValue(); + setLibraryFiles(); } protected void setLibraryFiles() { diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionPopupMenuImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionPopupMenuImpl.java index 2d0a58f7448f..08588b5f1b31 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionPopupMenuImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionPopupMenuImpl.java @@ -33,8 +33,6 @@ import javax.swing.*; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import java.awt.*; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; /** * @author Anton Katilin @@ -89,14 +87,6 @@ final class ActionPopupMenuImpl extends ApplicationAdapter implements ActionPopu if (getComponentCount() == 0) { return; } - myMenu.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - System.out.println("Enter"); - } - } - }); Dimension preferredSize = getPreferredSize(); // Translate (x,y) into screen coordinate syetem diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java index 3e2767488d20..35930b8927f8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java @@ -63,7 +63,8 @@ public class DeleteAction extends EditorAction { } else if (!selectionModel.hasSelection()) { deleteCharAtCaret(editor); - } else { + } + else { EditorModificationUtil.deleteSelectedText(editor); } } @@ -71,35 +72,33 @@ public class DeleteAction extends EditorAction { private static int getCaretLineLength(Editor editor) { Document document = editor.getDocument(); - if(document.getLineCount() == 0) + if (document.getLineCount() == 0) { return 0; + } int lineNumber = editor.getCaretModel().getLogicalPosition().line; - if(lineNumber >= document.getLineCount()) { + if (lineNumber >= document.getLineCount()) { return 0; } - else { - return document.getLineEndOffset(lineNumber) - document.getLineStartOffset(lineNumber); - } + return document.getLineEndOffset(lineNumber) - document.getLineStartOffset(lineNumber); } private static int getCaretLineStart(Editor editor) { Document document = editor.getDocument(); - if(document.getLineCount() == 0) + if (document.getLineCount() == 0) { return 0; + } int lineNumber = editor.getCaretModel().getLogicalPosition().line; - if(lineNumber >= document.getLineCount()) { + if (lineNumber >= document.getLineCount()) { return document.getLineStartOffset(document.getLineCount() - 1); } - else { - return document.getLineStartOffset(lineNumber); - } + return document.getLineStartOffset(lineNumber); } public static void deleteCharAtCaret(Editor editor) { int lineNumber = editor.getCaretModel().getLogicalPosition().line; int afterLineEnd = EditorModificationUtil.calcAfterLineEnd(editor); Document document = editor.getDocument(); - if(afterLineEnd < 0) { + if (afterLineEnd < 0) { int offset = editor.getCaretModel().getOffset(); FoldRegion region = editor.getFoldingModel().getCollapsedRegionAtOffset(offset); if (region != null && region.shouldNeverExpand()) { @@ -113,7 +112,7 @@ public class DeleteAction extends EditorAction { return; } - if(lineNumber + 1 >= document.getLineCount()) return; + if (lineNumber + 1 >= document.getLineCount()) return; // Do not group delete newline and other deletions. CommandProcessor commandProcessor = CommandProcessor.getInstance(); @@ -121,7 +120,7 @@ public class DeleteAction extends EditorAction { int nextLineStart = document.getLineStartOffset(lineNumber + 1); int nextLineEnd = document.getLineEndOffset(lineNumber + 1); - if(nextLineEnd - nextLineStart > 0) { + if (nextLineEnd - nextLineStart > 0) { StringBuilder buf = new StringBuilder(); StringUtil.repeatSymbol(buf, ' ', afterLineEnd); document.insertString(getCaretLineStart(editor) + getCaretLineLength(editor), buf.toString()); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java index a62a8fd145ca..42363fda68c5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java @@ -244,7 +244,7 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi @Override @NotNull public List getSoftWrapsForLine(int documentLine) { - if (!isSoftWrappingEnabled()) { + if (!isSoftWrappingEnabled() || documentLine < 0) { return Collections.emptyList(); } Document document = myEditor.getDocument(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java index 9579adba8dac..367b99fc24aa 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java @@ -472,7 +472,8 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen return i; } } - return end; + assert end > 0; + return end - 1; } private static int calculateWidthInColumns(char c, int widthInPixels, int spaceWithInPixels) { diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java index b26fd1f09119..f26b222bd078 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java @@ -337,7 +337,7 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx { if (!application.isDisposed()) { application.getMessageBus().syncPublisher(ProjectLifecycleListener.TOPIC).afterProjectClosed(this); } - TimedReference.disposeTimed(true); + TimedReference.disposeTimed(); } private void projectOpened() { diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index 0e2c1c8682e6..e243b07c3a53 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -12,8 +12,6 @@ - diff --git a/platform/platform-resources/src/META-INF/VcsExtensionPoints.xml b/platform/platform-resources/src/META-INF/VcsExtensionPoints.xml index b024d7cbd9d3..fbbe601e7d16 100644 --- a/platform/platform-resources/src/META-INF/VcsExtensionPoints.xml +++ b/platform/platform-resources/src/META-INF/VcsExtensionPoints.xml @@ -14,6 +14,10 @@ interface="com.intellij.openapi.vcs.checkin.CheckinHandlerFactory" area="IDEA_PROJECT"/> + + diff --git a/platform/platform-resources/src/componentSets/VCS.xml b/platform/platform-resources/src/componentSets/VCS.xml index 93f2c41121a3..47511b72e194 100644 --- a/platform/platform-resources/src/componentSets/VCS.xml +++ b/platform/platform-resources/src/componentSets/VCS.xml @@ -23,6 +23,12 @@ com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl