diff --git a/build/conf/mac/Contents/Info.plist b/build/conf/mac/Contents/Info.plist index dda036b27022..bcb30bc7b44f 100644 --- a/build/conf/mac/Contents/Info.plist +++ b/build/conf/mac/Contents/Info.plist @@ -39,6 +39,13 @@ @@version@@ CFBundleVersion @@build@@ + LSArchitecturePriority + + i386 + x86_64 + ppc + + Java ClassPath @@ -47,20 +54,6 @@ JVMVersion @@jdk_req@@ - JVMArchs - - i386 - x86_64 - ppc - - - LSArchitecturePriority - - i386 - x86_64 - ppc - - MainClass com.intellij.idea.Main Properties diff --git a/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java b/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java index 87461cf49d86..32139d5cb299 100644 --- a/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java +++ b/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java @@ -88,6 +88,10 @@ public class JavaParametersUtil { if (module == null) { throw CantRunException.noModuleConfigured(runConfigurationModule.getModuleName()); } + configureModule(module, parameters, classPathType, jreHome); + } + + public static void configureModule(Module module, JavaParameters parameters, int classPathType, String jreHome) throws CantRunException { parameters.configureByModule(module, classPathType, createModuleJdk(module, jreHome)); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java index 7e97de0188ce..1cb7537a2901 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java @@ -212,6 +212,17 @@ public class JavaMethodCallElement extends LookupItem implements Type return builder.append(">").toString(); } + @Override + public LookupItem forceQualify() { + if (myContainingClass != null) { + String className = myContainingClass.getName(); + if (className != null) { + addLookupStrings(className + "." + myMethod.getName()); + } + } + return super.forceQualify(); + } + @Override public void renderElement(LookupElementPresentation presentation) { final String className = myContainingClass == null ? "???" : myContainingClass.getName(); diff --git a/java/java-tests/testData/codeInsight/completion/smartType/EmptyListWithCollectionsPrefix-out.java b/java/java-tests/testData/codeInsight/completion/smartType/EmptyListWithCollectionsPrefix-out.java new file mode 100644 index 000000000000..197b8d11a2b1 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/EmptyListWithCollectionsPrefix-out.java @@ -0,0 +1,7 @@ +import java.util.Collections; + +class Foo { + java.util.List foo() { + return Collections.emptyList(); + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/EmptyListWithCollectionsPrefix.java b/java/java-tests/testData/codeInsight/completion/smartType/EmptyListWithCollectionsPrefix.java new file mode 100644 index 000000000000..c77ae8fdb860 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/EmptyListWithCollectionsPrefix.java @@ -0,0 +1,5 @@ +class Foo { + java.util.List foo() { + return Collect; + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java index d38494c77178..61086af10243 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java @@ -884,25 +884,17 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase { assertEquals(4, myItems.length); } - public void testInsertTypeParametersOnImporting() throws Throwable { - doTest(); - } + public void testInsertTypeParametersOnImporting() throws Throwable { doTest(); } - public void testEmptyListInReturn() throws Throwable { - doItemTest(); - } + public void testEmptyListInReturn() throws Throwable { doItemTest(); } - public void testEmptyListInReturn2() throws Throwable { - doTest(); - } + public void testEmptyListInReturn2() throws Throwable { doTest(); } - public void testEmptyListInReturnTernary() throws Throwable { - doItemTest(); - } + public void testEmptyListInReturnTernary() throws Throwable { doItemTest(); } - public void testEmptyListBeforeSemicolon() throws Throwable { - doItemTest(); - } + public void testEmptyListBeforeSemicolon() throws Throwable { doItemTest(); } + + public void testEmptyListWithCollectionsPrefix() throws Throwable { doItemTest(); } public void testStaticallyImportedMagicMethod() throws Throwable { configureByTestName(); diff --git a/lib/winp-1.14.jar b/lib/winp-1.14.jar new file mode 100644 index 000000000000..240382c7a488 Binary files /dev/null and b/lib/winp-1.14.jar differ diff --git a/license/winp_license.txt b/license/winp_license.txt new file mode 100644 index 000000000000..e9c74d0582e4 --- /dev/null +++ b/license/winp_license.txt @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/platform/lang-api/src/com/intellij/profile/DefaultProjectProfileManager.java b/platform/lang-api/src/com/intellij/profile/DefaultProjectProfileManager.java index b6e26fda7987..b45f8ccea686 100644 --- a/platform/lang-api/src/com/intellij/profile/DefaultProjectProfileManager.java +++ b/platform/lang-api/src/com/intellij/profile/DefaultProjectProfileManager.java @@ -50,6 +50,7 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager protected final Project myProject; public String PROJECT_PROFILE; + public boolean USE_PROJECT_PROFILE = true; private final ApplicationProfileManager myApplicationProfileManager; @@ -178,6 +179,7 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager public void setProjectProfile(final String projectProfile) { final String profileName = PROJECT_PROFILE; PROJECT_PROFILE = projectProfile; + USE_PROJECT_PROFILE = projectProfile != null; for (ProfileChangeAdapter adapter : myProfilesListener) { adapter.profileActivated(profileName != null ? getProfile(profileName) : null, projectProfile != null ? getProfile(projectProfile) : null); } @@ -185,6 +187,7 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager @NotNull public Profile getProjectProfileImpl(){ + if (!USE_PROJECT_PROFILE) return myApplicationProfileManager.getRootProfile(); if (PROJECT_PROFILE == null || myProfiles.isEmpty()){ setProjectProfile(PROJECT_DEFAULT_PROFILE_NAME); final Profile projectProfile = myApplicationProfileManager.createProfile(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index 5fdad4454373..29cbf4159452 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java @@ -490,6 +490,8 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { // the insert handler may have started a live template with completion if (CompletionService.getCompletionService().getCurrentCompletion() == null) { indicator.liveAfterDeath(null); + } else { + LOG.assertTrue(indicator.isZombie(), indicator); } } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java index c26d7ec94574..e88451ece076 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java @@ -289,7 +289,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement if (code == KeyEvent.VK_CONTROL || code == KeyEvent.VK_META || code == KeyEvent.VK_ALT || code == KeyEvent.VK_SHIFT) { myState.modifiersChanged(); if (myState.isWaitingAfterAutoInsertion()) { - unregisterItself(); + unregisterItself(true); } contentComponent.removeKeyListener(this); } @@ -297,6 +297,10 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement }); } + boolean isZombie() { + return myState.isZombie(); + } + private void setMergeCommand() { CommandProcessor.getInstance().setCurrentCommandGroupId(getCompletionCommandName()); } @@ -330,23 +334,23 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement final HintListener hintListener = new HintListener() { public void hintHidden(final EventObject event) { - unregisterItself(); + unregisterItself(true); } }; final DocumentAdapter documentListener = new DocumentAdapter() { @Override public void beforeDocumentChange(DocumentEvent e) { - unregisterItself(); + unregisterItself(true); } }; final SelectionListener selectionListener = new SelectionListener() { public void selectionChanged(SelectionEvent e) { - unregisterItself(); + unregisterItself(true); } }; final CaretListener caretListener = new CaretListener() { public void caretPositionChanged(CaretEvent e) { - unregisterItself(); + unregisterItself(true); } }; @@ -475,7 +479,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement ApplicationManager.getApplication().assertIsDispatchThread(); Disposer.dispose(myQueue); - unregisterItself(); + unregisterItself(false); } @TestOnly @@ -486,8 +490,8 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement } } - private void unregisterItself() { - myState.handleDeath(); + private void unregisterItself(boolean afterDeath) { + myState.handleDeath(afterDeath); CompletionProgressIndicator currentCompletion = CompletionServiceImpl.getCompletionService().getCurrentCompletion(); assert currentCompletion == this : currentCompletion + "!=" + this; CompletionServiceImpl.getCompletionService().setCurrentCompletion(null); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionState.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionState.java index 892bf983363e..979b3c76f21c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionState.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionState.java @@ -91,7 +91,7 @@ public class CompletionState { } public boolean isWaitingAfterAutoInsertion() { - return myRestorePrefix != null; + return myRestorePrefix != null && isZombie(); } public void setRestorePrefix(Runnable restorePrefix) { @@ -127,10 +127,12 @@ public class CompletionState { } } - public void handleDeath() { + public void handleDeath(boolean afterDeath) { ApplicationManager.getApplication().assertIsDispatchThread(); + boolean zombie = isZombie(); + LOG.assertTrue(afterDeath == zombie, this); assertDisposed(); - if (myZombieCleanup != null) { + if (zombie) { myZombieCleanup.run(); } myZombieCleanup = null; @@ -138,6 +140,10 @@ public class CompletionState { setRestorePrefix(null); } + public boolean isZombie() { + return myZombieCleanup != null; + } + int incCount() { return ++myCount; } diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java index 208a3efcb376..52a483d61463 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java @@ -84,7 +84,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac Map myMinimizedButtonsPlaceholder = new HashMap(); Map myCommonActionsPlaceholder = new HashMap(); - Map> myContextActions = new HashMap>(); + Map myContextActions = new HashMap(); boolean myUiLastStateWasRestored; @@ -447,7 +447,8 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac groupToBuild = group; } - if (!contents.equals(myContextActions.get(entry.getKey()))) { + final AnAction[] actions = groupToBuild.getChildren(null); + if (!Arrays.equals(actions, myContextActions.get(entry.getKey()))) { ActionToolbar tb = myActionManager.createActionToolbar(myActionsPlace, groupToBuild, true); tb.setTargetComponent(contextComponent); eachPlaceholder.setContent(tb.getComponent()); @@ -457,7 +458,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac hasToolbarContent = true; } - myContextActions.put(entry.getKey(), contents); + myContextActions.put(entry.getKey(), actions); } return hasToolbarContent; @@ -486,7 +487,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac hasToolbarContent |= updateTabUI(each); } - myTabs.getPresentation().setHideTabs(!hasToolbarContent); + myTabs.getPresentation().setHideTabs(!hasToolbarContent && tabs.size() <= 1); myTabs.updateTabActions(validateNow); diff --git a/platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java b/platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java index fd6fc4868897..f811f109b2a3 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java +++ b/platform/lang-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteProcessor.java @@ -93,6 +93,12 @@ public class SafeDeleteProcessor extends BaseRefactoringProcessor { } } + if (ancestor instanceof PsiFile) { + for (PsiFile file : ((PsiFile)ancestor).getViewProvider().getAllFiles()) { + if (PsiTreeUtil.isAncestor(file, place, false)) return true; + } + } + return PsiTreeUtil.isAncestor(ancestor, place, false); } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java index 3df42df8e973..480b3a639da5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java @@ -143,9 +143,20 @@ public class FSRecords implements Forceable { return myFreeRecords.remove(myFreeRecords.size() - 1); } - private static void createBrokenMarkerFile() { + private static void createBrokenMarkerFile(Throwable reason) { File brokenMarker = getCorruptionMarkerFile(); try { + + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + final PrintStream stream = new PrintStream(out); + new Exception().printStackTrace(stream); + if (reason != null) { + stream.print("\nReason:\n"); + reason.printStackTrace(stream); + } + stream.close(); + LOG.info("Creating VFS corruption marker; Trace=\n" + out.toString()); + final FileWriter writer = new FileWriter(brokenMarker); writer.write("These files are corrupted and must be rebuilt from the scratch on next startup"); writer.close(); @@ -429,7 +440,7 @@ public class FSRecords implements Forceable { private static RuntimeException handleError(final Throwable e) { if (!myCorrupted) { - createBrokenMarkerFile(); + createBrokenMarkerFile(e); myCorrupted = true; force(); } @@ -1193,7 +1204,7 @@ public class FSRecords implements Forceable { } public static void invalidateCaches() { - DbConnection.createBrokenMarkerFile(); + DbConnection.createBrokenMarkerFile(null); } public static void checkSanity() { diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java index 053397f5e6a2..44214add0686 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java @@ -59,16 +59,10 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget. @Override protected void paintComponent(@NotNull final Graphics g) { super.paintComponent(g); - if (actionEnabled) { - setForeground(UIUtil.getActiveTextColor()); - if (getText() != null) { - final Rectangle r = getBounds(); - final Insets insets = getInsets(); - ARROWS_ICON.paintIcon(this, g, r.width - insets.right - ARROWS_ICON.getIconWidth() - 2, r.height / 2 - ARROWS_ICON.getIconHeight() / 2); - } - } - else { - setForeground(UIUtil.getInactiveTextColor()); + if (actionEnabled && getText() != null) { + final Rectangle r = getBounds(); + final Insets insets = getInsets(); + ARROWS_ICON.paintIcon(this, g, r.width - insets.right - ARROWS_ICON.getIconWidth() - 2, r.height / 2 - ARROWS_ICON.getIconHeight() / 2); } } }; @@ -87,7 +81,6 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget. update(); } - @Override public void fileOpened(FileEditorManager source, VirtualFile file) { update(); @@ -179,6 +172,20 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget. } myComponent.setToolTipText(toolTip); myComponent.setText(text); + + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + if (actionEnabled) { + myComponent.setForeground(UIUtil.getActiveTextColor()); + } + else { + myComponent.setForeground(UIUtil.getInactiveTextColor()); + } + } + }); + + myStatusBar.updateWidget(ID()); } diff --git a/platform/platform-resources-en/src/messages/ExecutionBundle.properties b/platform/platform-resources-en/src/messages/ExecutionBundle.properties index 261f1cfcc40d..7537fbd31bd7 100644 --- a/platform/platform-resources-en/src/messages/ExecutionBundle.properties +++ b/platform/platform-resources-en/src/messages/ExecutionBundle.properties @@ -75,7 +75,7 @@ copy.configuration.action.name=Copy Configuration junit.configuration.display.name=JUnit junit.configuration.description=JUnit test configuration no.junit.error.message=No junit.jar -no.junit.in.scope.error.message=No junit.jar: {0} +no.junit.in.scope.error.message=No junit.jar in {0} junit.not.found.in.module.error.message=JUnit not found in module ''{0}'' cannot.browse.test.inheritors.dialog.title=Can't Browse TestCase Inheritors seaching.test.progress.title=Searching For Tests... diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml index a28968da7236..011c1ebe4d55 100644 --- a/platform/platform-resources/src/idea/LangActions.xml +++ b/platform/platform-resources/src/idea/LangActions.xml @@ -671,6 +671,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/testFramework/src/com/intellij/testFramework/LeakedProjectHunter.java b/platform/testFramework/src/com/intellij/testFramework/LeakedProjectHunter.java index e80639064618..e726ef17c497 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LeakedProjectHunter.java +++ b/platform/testFramework/src/com/intellij/testFramework/LeakedProjectHunter.java @@ -89,6 +89,7 @@ public class LeakedProjectHunter { Class rootClass = backLink.aClass; List fields = getAllFields(rootClass); for (Field field : fields) { + if (root instanceof Reference && "referent".equals(field.getName())) continue; // do not follow weak/soft refs Object value = field.get(root); if (value == null) continue; Class valueClass = value.getClass(); @@ -97,7 +98,6 @@ public class LeakedProjectHunter { processor.process(newBackLink); } else { - if (root instanceof Reference && "referent".equals(field.getName())) continue; // do not follow weak/soft refs BackLink newBackLink = new BackLink(valueClass, value, field, backLink); if (toFollow(valueClass)) { toVisit.push(newBackLink); @@ -113,7 +113,7 @@ public class LeakedProjectHunter { toVisit.push(new BackLink(oClass, o, null, backLink)); } } - catch (ClassCastException e) { + catch (ClassCastException ignored) { } } } @@ -133,7 +133,6 @@ public class LeakedProjectHunter { noFollowClasses.add("java.lang.Object"); noFollowClasses.add("java.lang.Short"); noFollowClasses.add("java.lang.String"); - noFollowClasses.add("java.lang.ref.WeakReference"); } private static boolean toFollow(Class oClass) { diff --git a/platform/util/src/com/intellij/util/lang/JarLoader.java b/platform/util/src/com/intellij/util/lang/JarLoader.java index acbb6e069c40..d673049fd3da 100644 --- a/platform/util/src/com/intellij/util/lang/JarLoader.java +++ b/platform/util/src/com/intellij/util/lang/JarLoader.java @@ -34,12 +34,11 @@ class JarLoader extends Loader { private final boolean myCanLockJar; private static final boolean myDebugTime = false; - //private SoftReference myZipFileRef; private final TimedComputable myZipFileRef = new TimedComputable(null) { @NotNull protected ZipFile calc() { try { - final ZipFile zipFile = _getZipFile(); + final ZipFile zipFile = doGetZipFile(); if (zipFile == null) throw new RuntimeException("Can't load zip file"); return zipFile; } @@ -60,20 +59,27 @@ class JarLoader extends Loader { } @Nullable - private ZipFile getZipFile() throws IOException { + private ZipFile acquireZipFile() throws IOException { if (myCanLockJar) { return myZipFileRef.acquire(); } - else { - return _getZipFile(); + return doGetZipFile(); + } + + private void releaseZipFile(final ZipFile zipFile) throws IOException { + if (myCanLockJar) { + myZipFileRef.release(); + } + else if (zipFile != null) { + zipFile.close(); } } @Nullable - private ZipFile _getZipFile() throws IOException { + private ZipFile doGetZipFile() throws IOException { if (FILE_PROTOCOL.equals(myURL.getProtocol())) { String s = FileUtil.unquote(myURL.getFile()); - if (!(new File(s)).exists()) { + if (!new File(s).exists()) { throw new FileNotFoundException(s); } else { @@ -85,48 +91,44 @@ class JarLoader extends Loader { } void buildCache(final ClasspathCache cache) throws IOException { - final ZipFile zipFile = getZipFile(); - if (zipFile == null) return; - final Enumeration entries = zipFile.entries(); + ZipFile zipFile = null; + try { + zipFile = acquireZipFile(); + if (zipFile == null) return; + final Enumeration entries = zipFile.entries(); - while (entries.hasMoreElements()) { - ZipEntry zipEntry = entries.nextElement(); - cache.addResourceEntry(zipEntry.getName(), this); + while (entries.hasMoreElements()) { + ZipEntry zipEntry = entries.nextElement(); + cache.addResourceEntry(zipEntry.getName(), this); + } } - - releaseZipFile(zipFile); - } - - private void releaseZipFile(final ZipFile zipFile) throws IOException { - if (myCanLockJar) { - myZipFileRef.release(); - } - else { - zipFile.close(); + finally { + releaseZipFile(zipFile); } } @Nullable Resource getResource(String name, boolean flag) { final long started = myDebugTime ? System.nanoTime():0; + ZipFile file = null; try { - final ZipFile file = getZipFile(); + file = acquireZipFile(); if (file == null) return null; - - try { - ZipEntry entry = file.getEntry(name); - if (entry != null) return new MyResource(entry, new URL(getBaseURL(), name)); - } - finally { - releaseZipFile(file); - } + ZipEntry entry = file.getEntry(name); + if (entry != null) return new MyResource(entry, new URL(getBaseURL(), name)); } catch (Exception e) { return null; - } finally { - final long doneFor = myDebugTime ? (System.nanoTime() - started):0; + } + finally { + try { + releaseZipFile(file); + } + catch (IOException ignored) { + } + final long doneFor = myDebugTime ? System.nanoTime() - started :0; if (doneFor > NS_THRESHOLD) { - System.out.println((doneFor/1000000) + " ms for jar loader get resource:"+name); + System.out.println(doneFor/1000000 + " ms for jar loader get resource:"+name); } } @@ -156,24 +158,28 @@ class JarLoader extends Loader { @Nullable public InputStream getInputStream() throws IOException { - final ZipFile file = getZipFile(); - if (file == null) return null; - - final boolean[] wasReleased = new boolean[]{false}; + final boolean[] wasReleased = {false}; + ZipFile file = null; try { + file = acquireZipFile(); + if (file == null) { + releaseZipFile(file); + return null; + } final InputStream inputStream = file.getInputStream(myEntry); if (inputStream == null) { + releaseZipFile(file); return null; // if entry was not found } + final ZipFile finalFile = file; return new FilterInputStream(inputStream) { private boolean myClosed = false; - public void close() throws IOException { super.close(); if (!myClosed) { - releaseZipFile(file); + releaseZipFile(finalFile); } myClosed = true; wasReleased[0] = true; @@ -182,8 +188,8 @@ class JarLoader extends Loader { } catch (IOException e) { e.printStackTrace(); - assert !wasReleased[0]; releaseZipFile(file); + assert !wasReleased[0]; return null; } } diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java index c9f20b7b408d..267a17a32c92 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java @@ -21,6 +21,7 @@ import com.intellij.execution.filters.TextConsoleBuilderFactory; import com.intellij.execution.process.ProcessHandler; import com.intellij.execution.ui.ExecutionConsole; import com.intellij.execution.ui.RunnerLayoutUi; +import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.xdebugger.breakpoints.XBreakpointHandler; import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; import com.intellij.xdebugger.stepping.XSmartStepIntoHandler; @@ -158,6 +159,12 @@ public abstract class XDebugProcess { public void registerAdditionalContent(@NotNull RunnerLayoutUi ui) { } + /** + * Override this method to provide additional actions in 'Debug' tool window + */ + public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar) { + } + /** * @return message to show in Variables View when debugger isn't paused */ diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerActions.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerActions.java index 6fe96f9e7525..4819bbe1574d 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerActions.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerActions.java @@ -39,6 +39,8 @@ public interface XDebuggerActions { @NonNls String EVALUATE_EXPRESSION = "EvaluateExpression"; + @NonNls String TOOL_WINDOW_TOP_TOOLBAR_GROUP = "XDebugger.ToolWindow.TopToolbar"; + @NonNls String TOOL_WINDOW_LEFT_TOOLBAR_GROUP = "XDebugger.ToolWindow.LeftToolbar"; @NonNls String EVALUATE_DIALOG_TREE_POPUP_GROUP = "XDebugger.Evaluation.Dialog.Tree.Popup"; @NonNls String INSPECT_TREE_POPUP_GROUP = "XDebugger.Inspect.Tree.Popup"; @NonNls String VARIABLES_TREE_POPUP_GROUP = "XDebugger.Variables.Tree.Popup"; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java index 8a0055867998..3adb2a26a7fb 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java @@ -71,8 +71,10 @@ public class XDebugSessionTab extends DebuggerSessionTabBase { myUi = RunnerLayoutUi.Factory.getInstance(project).create("Debug", "unknown!", sessionName, this); myUi.getDefaults().initTabDefaults(0, "Debug", null); + } - myUi.getOptions().setTopToolbar(createTopToolbar(), ActionPlaces.DEBUGGER_TOOLBAR); + private static ActionGroup getActionGroup(final String id) { + return (ActionGroup)ActionManager.getInstance().getAction(id); } private Content createConsoleContent() { @@ -94,7 +96,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase { Content watchesContent = myUi.createContent(DebuggerContentInfo.WATCHES_CONTENT, myWatchesView.getMainPanel(), XDebuggerBundle.message("debugger.session.tab.watches.title"), XDebuggerUIConstants.WATCHES_TAB_ICON, null); - ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP); + ActionGroup group = getActionGroup(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP); watchesContent.setActions(group, ActionPlaces.DEBUGGER_TOOLBAR, myWatchesView.getTree()); return watchesContent; } @@ -114,21 +116,6 @@ public class XDebugSessionTab extends DebuggerSessionTabBase { return framesContent; } - private static DefaultActionGroup createTopToolbar() { - DefaultActionGroup group = new DefaultActionGroup(); - ActionManager actionManager = ActionManager.getInstance(); - group.add(actionManager.getAction(XDebuggerActions.SHOW_EXECUTION_POINT)); - group.addSeparator(); - group.add(actionManager.getAction(XDebuggerActions.STEP_OVER)); - group.add(actionManager.getAction(XDebuggerActions.STEP_INTO)); - group.add(actionManager.getAction(XDebuggerActions.FORCE_STEP_INTO)); - group.add(actionManager.getAction(XDebuggerActions.STEP_OUT)); - group.add(actionManager.getAction(XDebuggerActions.RUN_TO_CURSOR)); - group.addSeparator(); - group.add(actionManager.getAction(XDebuggerActions.TOGGLE_SORT_VALUES)); - return group; - } - public XDebugSessionData saveData() { final List watchExpressions = myWatchesView.getWatchExpressions(); return new XDebugSessionData(ArrayUtil.toStringArray(watchExpressions)); @@ -191,37 +178,35 @@ public class XDebugSessionTab extends DebuggerSessionTabBase { return myRunContentDescriptor; } - DefaultActionGroup group = new DefaultActionGroup(); + DefaultActionGroup leftToolbar = new DefaultActionGroup(); final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance(); if (runner != null && environment != null) { RestartAction restartAction = new RestartAction(executor, runner, myRunContentDescriptor.getProcessHandler(), XDebuggerUIConstants.DEBUG_AGAIN_ICON, myRunContentDescriptor, environment); - group.add(restartAction); + leftToolbar.add(restartAction); restartAction.registerShortcut(myUi.getComponent()); } - addActionToGroup(group, XDebuggerActions.RESUME); - addActionToGroup(group, XDebuggerActions.PAUSE); - addActionToGroup(group, IdeActions.ACTION_STOP_PROGRAM); + leftToolbar.addAll(getActionGroup(XDebuggerActions.TOOL_WINDOW_LEFT_TOOLBAR_GROUP)); - group.addSeparator(); - - addActionToGroup(group, XDebuggerActions.VIEW_BREAKPOINTS); - addActionToGroup(group, XDebuggerActions.MUTE_BREAKPOINTS); - - group.addSeparator(); + //group.addSeparator(); //addAction(group, DebuggerActions.EXPORT_THREADS); - group.addSeparator(); + leftToolbar.addSeparator(); - group.add(myUi.getOptions().getLayoutActions()); + leftToolbar.add(myUi.getOptions().getLayoutActions()); - group.addSeparator(); + leftToolbar.addSeparator(); - group.add(PinToolwindowTabAction.getPinAction()); - group.add(new CloseAction(executor, myRunContentDescriptor, getProject())); - group.add(new ContextHelpAction(executor.getHelpId())); + leftToolbar.add(PinToolwindowTabAction.getPinAction()); + leftToolbar.add(new CloseAction(executor, myRunContentDescriptor, getProject())); + leftToolbar.add(new ContextHelpAction(executor.getHelpId())); - myUi.getOptions().setLeftToolbar(group, ActionPlaces.DEBUGGER_TOOLBAR); + DefaultActionGroup topToolbar = new DefaultActionGroup(); + topToolbar.addAll(getActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_GROUP)); + + session.getDebugProcess().registerAdditionalActions(leftToolbar, topToolbar); + myUi.getOptions().setLeftToolbar(leftToolbar, ActionPlaces.DEBUGGER_TOOLBAR); + myUi.getOptions().setTopToolbar(topToolbar, ActionPlaces.DEBUGGER_TOOLBAR); if (environment != null) { final RunProfile runConfiguration = environment.getRunProfile(); @@ -234,11 +219,6 @@ public class XDebugSessionTab extends DebuggerSessionTabBase { return myRunContentDescriptor; } - private static void addActionToGroup(final DefaultActionGroup group, final String actionId) { - AnAction action = ActionManager.getInstance().getAction(actionId); - if (action != null) group.add(action); - } - public RunnerLayoutUi getUi() { return myUi; } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/DeclareCollectionAsInterfaceInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/DeclareCollectionAsInterfaceInspection.java index a69011546188..e4f5ce18ca3b 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/DeclareCollectionAsInterfaceInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/abstraction/DeclareCollectionAsInterfaceInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -155,8 +155,7 @@ public class DeclareCollectionAsInterfaceInspection extends BaseInspection { extends BaseInspectionVisitor { @Override public void visitVariable(@NotNull PsiVariable variable) { - if (isOnTheFly() && - variable.hasModifierProperty(PsiModifier.PUBLIC)) { + if (isOnTheFly() && !isCheapEnoughToSearch(variable)) { return; } if (ignoreLocalVariables && variable instanceof PsiLocalVariable) { @@ -234,8 +233,7 @@ public class DeclareCollectionAsInterfaceInspection extends BaseInspection { method.hasModifierProperty(PsiModifier.PRIVATE)) { return; } - if (isOnTheFly() && - method.hasModifierProperty(PsiModifier.PUBLIC)) { + if (isOnTheFly() && !isCheapEnoughToSearch(method)) { return; } final PsiType type = method.getReturnType(); diff --git a/plugins/android/testData/dom/manifest/applicationNameCompletion.xml b/plugins/android/testData/dom/manifest/ApplicationNameCompletion.xml similarity index 100% rename from plugins/android/testData/dom/manifest/applicationNameCompletion.xml rename to plugins/android/testData/dom/manifest/ApplicationNameCompletion.xml diff --git a/plugins/android/testData/dom/manifest/applicationNameCompletion_after.xml b/plugins/android/testData/dom/manifest/ApplicationNameCompletion_after.xml similarity index 100% rename from plugins/android/testData/dom/manifest/applicationNameCompletion_after.xml rename to plugins/android/testData/dom/manifest/ApplicationNameCompletion_after.xml diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java index b070e350badb..fc5990cf6707 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHandler.java +++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java @@ -390,11 +390,11 @@ public abstract class GitHandler { } try { - LOG.info(myCommandLine.getCommandLineString()); // setup environment if (!myProject.isDefault() && !mySilent && (myVcs != null)) { myVcs.showCommandLine("cd " + myWorkingDirectory); myVcs.showCommandLine(printableCommandLine()); + LOG.info(myCommandLine.getCommandLineString()); } if (!myNoSSHFlag && myProjectSettings.isIdeaSsh()) { GitSSHService ssh = GitSSHIdeaService.getInstance(); diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java index a081dbbf72db..d1445dba7bdd 100644 --- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java +++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java @@ -30,7 +30,12 @@ import git4idea.GitBranch; import git4idea.GitRevisionNumber; import git4idea.GitVcs; import git4idea.actions.GitShowAllSubmittedFilesAction; -import git4idea.commands.*; +import git4idea.commands.GitCommand; +import git4idea.commands.GitHandlerUtil; +import git4idea.commands.GitLineHandler; +import git4idea.commands.GitLineHandlerAdapter; +import git4idea.commands.GitSimpleHandler; +import git4idea.commands.StringScanner; import git4idea.config.GitConfigUtil; import git4idea.config.GitVersionSpecialty; import git4idea.i18n.GitBundle; @@ -166,7 +171,6 @@ public class GitUnstashDialog extends DialogWrapper { public void run(@NotNull ProgressIndicator indicator) { GitSimpleHandler h = dropHandler(stash.myStash); try { - h.setSilent(true); h.run(); h.unsilence(); } diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTest.java similarity index 98% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTest.java index 89d36c11f25c..d4941b708a97 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAddTest.java @@ -22,7 +22,7 @@ import static org.zmlx.hg4idea.test.HgTestOutputParser.added; /** * Tests adding files to the Mercurial repository. */ -public class HgAddTestCase extends HgSingleUserTestCase { +public class HgAddTest extends HgSingleUserTest { @BeforeMethod @Override diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCollaborativeTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCollaborativeTest.java similarity index 95% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCollaborativeTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCollaborativeTest.java index f71095b0dd32..5ba278092d38 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCollaborativeTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCollaborativeTest.java @@ -20,7 +20,7 @@ package org.zmlx.hg4idea.test; * This is used to test collaborative tasks, such as push, pull, merge and others. * @author Kirill Likhodedov */ -public class HgCollaborativeTestCase extends HgAbstractTestCase { +public class HgCollaborativeTest extends HgTest { protected HgTestRepository myParentRepo; protected HgTestRepository myRepo; diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTest.java similarity index 97% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTest.java index 9dfbab6b8bf3..374a2f7929d6 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgCopyTest.java @@ -17,7 +17,7 @@ import org.testng.annotations.Test; import java.io.File; -public class HgCopyTestCase extends HgSingleUserTestCase { +public class HgCopyTest extends HgSingleUserTest { @Test public void testCopyUnmodifiedFile() throws Exception { diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTest.java similarity index 98% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTest.java index f75746effe60..f5d2ae3769d1 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgDeleteTest.java @@ -21,7 +21,7 @@ import java.io.File; import static org.testng.Assert.fail; -public class HgDeleteTestCase extends HgSingleUserTestCase { +public class HgDeleteTest extends HgSingleUserTest { @Test public void testDeleteUnmodifiedFile() throws Exception { diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTest.java similarity index 95% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTest.java index cf398c9c4687..f690233dee7e 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgHistoryTest.java @@ -15,9 +15,9 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; /** - * HgHistoryTestCase tests retrieving file history and specific revisions. + * HgHistoryTest tests retrieving file history and specific revisions. */ -public class HgHistoryTestCase extends HgSingleUserTestCase { +public class HgHistoryTest extends HgSingleUserTest { /** * 1. Make two versions of a file (create, add, commit, modify, commit). diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTest.java similarity index 96% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTest.java index 65e02297031a..6f9f4576c02c 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgLogTest.java @@ -20,7 +20,7 @@ import java.util.List; import static org.testng.Assert.assertEquals; -public class HgLogTestCase extends HgSingleUserTestCase { +public class HgLogTest extends HgSingleUserTest { @Test public void testCommitMessagesWithMultipleLines() throws Exception { diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMergeProviderTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMergeProviderTest.java similarity index 98% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMergeProviderTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMergeProviderTest.java index a3d57709b144..3aceb2cfe38d 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMergeProviderTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMergeProviderTest.java @@ -37,7 +37,7 @@ import static org.testng.Assert.fail; * All Mercurial operations are performed natively to test only HgMergeProvider functionality. * @author Kirill Likhodedov */ -public class HgMergeProviderTestCase extends HgCollaborativeTestCase { +public class HgMergeProviderTest extends HgCollaborativeTest { private MergeProvider myMergeProvider; diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTest.java similarity index 97% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTest.java index 97dfb4a7d82f..7674b6497324 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMoveTest.java @@ -17,7 +17,7 @@ import org.testng.annotations.Test; import java.io.File; -public class HgMoveTestCase extends HgSingleUserTestCase { +public class HgMoveTest extends HgSingleUserTest { @Test public void testMoveNewFile() throws Exception { diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgPushTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgPushTest.java similarity index 97% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgPushTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgPushTest.java index af0b06d8133b..8423b3693918 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgPushTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgPushTest.java @@ -27,7 +27,7 @@ import static org.testng.Assert.assertNotNull; /** * @author Kirill Likhodedov */ -public class HgPushTestCase extends HgCollaborativeTestCase { +public class HgPushTest extends HgCollaborativeTest { /** * Tests 'push' using only native commands. diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTest.java similarity index 98% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTest.java index fb02a4371fa2..210679a1b302 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRenameTest.java @@ -17,7 +17,7 @@ import org.testng.annotations.Test; import java.io.File; -public class HgRenameTestCase extends HgSingleUserTestCase { +public class HgRenameTest extends HgSingleUserTest { @Test public void testRenameUnmodifiedFile() throws Exception { diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTest.java similarity index 96% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTest.java index 5450ab4e7c27..451750a649e3 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgRevertTest.java @@ -9,7 +9,7 @@ import java.nio.charset.Charset; import static org.testng.Assert.assertEquals; -public class HgRevertTestCase extends HgSingleUserTestCase { +public class HgRevertTest extends HgSingleUserTest { @Test public void testRevertToCurrentRevision() throws Exception { fillFile(myProjectDir, new String[]{"file.txt"}, "initial contents"); diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgSingleUserTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgSingleUserTest.java similarity index 88% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgSingleUserTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgSingleUserTest.java index 52b66ce8ec35..d3443c497a5e 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgSingleUserTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgSingleUserTest.java @@ -16,11 +16,11 @@ package org.zmlx.hg4idea.test; /** - * HgSingleUserTestCase is the parent of test cases for single user workflow. + * HgSingleUserTest is the parent of test cases for single user workflow. * It doesn't include collaborate tasks such as cloning, pushing, etc. * @author Kirill Likhodedov */ -public class HgSingleUserTestCase extends HgAbstractTestCase { +public class HgSingleUserTest extends HgTest { protected HgTestRepository myRepo; diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAbstractTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgTest.java similarity index 99% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAbstractTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgTest.java index 715e7fd49b2a..7331325d2175 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgAbstractTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgTest.java @@ -42,7 +42,7 @@ import static org.testng.Assert.assertTrue; /** * The ancestor of all hg4idea test cases. */ -public abstract class HgAbstractTestCase extends AbstractVcsTestCase { +public abstract class HgTest extends AbstractVcsTestCase { public static final String HG_EXECUTABLE_PATH = "IDEA_TEST_HG_EXECUTABLE_PATH"; public static final String HG_EXECUTABLE = "hg"; diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgTestRepository.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgTestRepository.java index 5b8d14427aa8..6fef1f384c14 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgTestRepository.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgTestRepository.java @@ -33,12 +33,12 @@ import java.io.IOException; * @author Kirill Likhodedov */ public class HgTestRepository { - @NotNull private final HgAbstractTestCase myTest; + @NotNull private final HgTest myTest; @NotNull private final TempDirTestFixture myDirFixture; private VirtualFile myDir; @Nullable private final HgTestRepository myParent; // cloned from - public HgTestRepository(@NotNull HgAbstractTestCase test, @NotNull TempDirTestFixture dir) { + public HgTestRepository(@NotNull HgTest test, @NotNull TempDirTestFixture dir) { this(test, dir, null); } @@ -47,7 +47,7 @@ public class HgTestRepository { * @param dir repository root * @param parent parent repository where this repository is cloned from, if one exists. */ - public HgTestRepository(@NotNull HgAbstractTestCase test, @NotNull TempDirTestFixture dir, @Nullable HgTestRepository parent) { + public HgTestRepository(@NotNull HgTest test, @NotNull TempDirTestFixture dir, @Nullable HgTestRepository parent) { myTest = test; myDirFixture = dir; myParent = parent; @@ -55,15 +55,15 @@ public class HgTestRepository { /** * Creates a new Mercurial repository in a new temporary test directory. - * @param testCase reference to the test case instance. + * @param test reference to the test case instance. * @return created repository. */ - public static HgTestRepository create(HgAbstractTestCase testCase) throws Exception { + public static HgTestRepository create(HgTest test) throws Exception { final TempDirTestFixture dirFixture = createFixtureDir(); final File repo = new File(dirFixture.getTempDirPath()); - final ProcessOutput processOutput = testCase.runHg(repo, "init"); + final ProcessOutput processOutput = test.runHg(repo, "init"); AbstractVcsTestCase.verify(processOutput); - return new HgTestRepository(testCase, dirFixture); + return new HgTestRepository(test, dirFixture); } private static TempDirTestFixture createFixtureDir() throws Exception { diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTestCase.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java similarity index 99% rename from plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTestCase.java rename to plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java index 1620e0ecc7ed..9bcae7a18daa 100644 --- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTestCase.java +++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java @@ -46,7 +46,7 @@ import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @SuppressWarnings({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"}) -public class HgUpdateTestCase extends HgCollaborativeTestCase { +public class HgUpdateTest extends HgCollaborativeTest { private VirtualFile projectRepoVirtualFile; private File projectRepo; diff --git a/plugins/junit/src/com/intellij/execution/junit/TestsPattern.java b/plugins/junit/src/com/intellij/execution/junit/TestsPattern.java index 47fe6f47d091..344be431e834 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestsPattern.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestsPattern.java @@ -24,6 +24,8 @@ import com.intellij.execution.ExecutionException; import com.intellij.execution.JavaExecutionUtil; import com.intellij.execution.configurations.*; import com.intellij.execution.util.JavaParametersUtil; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElement; @@ -35,6 +37,7 @@ import com.intellij.util.Function; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.HashSet; import java.util.Set; public class TestsPattern extends TestObject { @@ -49,22 +52,32 @@ public class TestsPattern extends TestObject { protected void initialize() throws ExecutionException { super.initialize(); final JUnitConfiguration.Data data = myConfiguration.getPersistentData(); - RunConfigurationModule module = myConfiguration.getConfigurationModule(); - JavaParametersUtil.configureModule(module, myJavaParameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS, - myConfiguration.isAlternativeJrePathEnabled() ? myConfiguration.getAlternativeJrePath() : null); - - final Project project = module.getProject(); + final Project project = myConfiguration.getProject(); boolean isJUnit4 = false; final ArrayList classNames = new ArrayList(); + final Set modules = new HashSet(); for (String className : data.getPatterns()) { final PsiClass psiClass = JavaExecutionUtil.findMainClass(project, className, GlobalSearchScope.allScope(project)); if (psiClass != null && JUnitUtil.isTestClass(psiClass)) { classNames.add(className); + modules.add(ModuleUtil.findModuleForPsiElement(psiClass)); if (JUnitUtil.isJUnit4TestClass(psiClass)) { isJUnit4 = true; } } } + final String jreHome = myConfiguration.isAlternativeJrePathEnabled() ? myConfiguration.getAlternativeJrePath() : null; + + Module module = myConfiguration.getConfigurationModule().getModule(); + if (module == null && modules.size() == 1 && modules.iterator().next() != null) { + module = modules.iterator().next(); + } + + if (module != null) { + JavaParametersUtil.configureModule(module, myJavaParameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS, jreHome); + } else { + JavaParametersUtil.configureProject(project, myJavaParameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS, jreHome); + } addClassesListToJavaParameters(classNames, new Function.Self(), "", true, isJUnit4); } diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java index 75c9f6348d6b..1771bab5bfc7 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java @@ -22,6 +22,7 @@ import com.intellij.execution.junit.JUnitConfiguration; import com.intellij.execution.junit.JUnitConfigurationType; import com.intellij.execution.junit.JUnitUtil; import com.intellij.execution.junit.TestClassFilter; +import com.intellij.execution.testframework.SourceScope; import com.intellij.execution.testframework.TestSearchScope; import com.intellij.execution.ui.AlternativeJREPanel; import com.intellij.execution.ui.ClassBrowser; @@ -36,10 +37,12 @@ import com.intellij.openapi.ui.FixedSizeButton; import com.intellij.openapi.ui.LabeledComponent; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.TextFieldWithBrowseButton; +import com.intellij.openapi.ui.ex.MessagesEx; import com.intellij.openapi.util.IconLoader; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiPackage; +import com.intellij.psi.search.SearchScope; import com.intellij.util.Icons; import gnu.trove.TIntArrayList; import org.jetbrains.annotations.NotNull; @@ -260,8 +263,14 @@ public class JUnitConfigurable extends SettingsEditor { final TIntArrayList enabledFields = ourEnabledFields.get(newType); for (int i = 0; i < myTestLocations.length; i++) getTestLocation(i).setEnabled(enabledFields.contains(i)); - if (newType != JUnitConfigurationModel.ALL_IN_PACKAGE) myModule.setEnabled(true); - else onScopeChanged(); + if (newType == JUnitConfigurationModel.PATTERN) { + myModule.setEnabled(false); + } else if (newType != JUnitConfigurationModel.ALL_IN_PACKAGE) { + myModule.setEnabled(true); + } + else { + onScopeChanged(); + } } private static class PackageChooserActionListener extends BrowseModuleValueActionListener { @@ -287,6 +296,18 @@ public class JUnitConfigurable extends SettingsEditor { textField.setText(text + (text.length() > 0 ? "||" : "") + psiClass.getQualifiedName()); } + @Override + protected ClassFilter.ClassFilterWithScope getFilter() throws NoFilterException { + try { + return TestClassFilter.create(SourceScope.wholeProject(getProject()), null); + } + catch (JUnitUtil.NoJUnitException ignore) { + throw new NoFilterException(new MessagesEx.MessageInfo(getProject(), + ignore.getMessage(), + ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title"))); + } + } + @Override public void actionPerformed(ActionEvent e) { showDialog(); diff --git a/plugins/spellchecker/src/com/intellij/spellchecker/jetbrains.dic b/plugins/spellchecker/src/com/intellij/spellchecker/jetbrains.dic index bc5f5909efce..b8caf2eba375 100644 --- a/plugins/spellchecker/src/com/intellij/spellchecker/jetbrains.dic +++ b/plugins/spellchecker/src/com/intellij/spellchecker/jetbrains.dic @@ -262,6 +262,7 @@ tooltips trinary twitter uncomment +uncommented underwave undofile unhandled diff --git a/xml/openapi/src/com/intellij/patterns/XmlAttributeValuePattern.java b/xml/openapi/src/com/intellij/patterns/XmlAttributeValuePattern.java index aa74e5331307..459b9d36c6e8 100644 --- a/xml/openapi/src/com/intellij/patterns/XmlAttributeValuePattern.java +++ b/xml/openapi/src/com/intellij/patterns/XmlAttributeValuePattern.java @@ -32,8 +32,12 @@ public class XmlAttributeValuePattern extends XmlElementPattern condition) { + super(condition); } public XmlAttributeValuePattern withLocalName(@NonNls String... names) {