diff --git a/community-tests/src/tests/testGroups.properties b/community-tests/src/tests/testGroups.properties index eee771707459..598ddc48ce04 100644 --- a/community-tests/src/tests/testGroups.properties +++ b/community-tests/src/tests/testGroups.properties @@ -87,6 +87,10 @@ com.android.tools.idea.wizard.DynamicWizardPathTest com.android.tools.idea.wizard.DynamicWizardStepTest com.android.tools.idea.rendering.FlagManagerTest com.android.tools.idea.rendering.ResourceFolderRepositoryTest +com.android.tools.idea.javadoc.AndroidJavaDocRendererTest +com.android.tools.idea.editors.strings.StringResourceDataTest +com.android.tools.idea.rendering.ClassConverterTest +com.android.tools.idea.gradle.service.notification.errors.UnknownHostErrorHandlerTest [GRADLE_INTEGRATION_TESTS] org.jetbrains.plugins.gradle.importing.* diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java index 5c41a8965b7e..a9c077080c08 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java @@ -42,10 +42,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Computable; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.Ref; -import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.*; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; @@ -625,8 +622,12 @@ public class FrameVariablesTree extends DebuggerTree { if (myVisibleLocals.contains(var.getName())) { myVars.add(var.getName()); } - else if (var instanceof PsiLocalVariable) { - myExpressions.add(new TextWithImportsImpl(reference)); + else { + // fix for variables used in inner classes + if (!Comparing.equal(PsiTreeUtil.getParentOfType(reference, PsiClass.class), + PsiTreeUtil.getParentOfType(var, PsiClass.class))) { + myExpressions.add(new TextWithImportsImpl(reference)); + } } } } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLambdaExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLambdaExpressionImpl.java index 74092851e579..7b24a96ff03d 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLambdaExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLambdaExpressionImpl.java @@ -117,9 +117,8 @@ public class PsiLambdaExpressionImpl extends ExpressionPsiElement implements Psi return false; } } - catch (AnalysisCanceledException e) { - return false; - } + //error would be shown inside body + catch (AnalysisCanceledException ignore) {} for (PsiReturnStatement statement : PsiUtil.findReturnStatements((PsiCodeBlock)body)) { if (statement.getReturnValue() == null) { diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/ControlFlowAnalysisFailedValueCompatibilityUnchanged.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/ControlFlowAnalysisFailedValueCompatibilityUnchanged.java new file mode 100644 index 000000000000..e2ff4cfc493f --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/ControlFlowAnalysisFailedValueCompatibilityUnchanged.java @@ -0,0 +1,15 @@ +import java.util.stream.Collectors; +import java.util.stream.Stream; + +class Test { + public static void processDifference(final Stream stream, final Stream cells) { + stream.map(rule -> { + try { + return cells.collect(Collectors.toMap(c -> c, null)); + } finally { + System.out.println(;); + } + }); + } + +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy index b27540c6a50d..7c8956b4dfa0 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateGetterSetterTest.groovy @@ -70,6 +70,26 @@ class Foo { return isStateForceMailField; } } +''' + } + + public void "test strip is of boolean fields setter"() { + myFixture.configureByText 'a.java', ''' +class Foo { + boolean isStateForceMailField; + + +} +''' + generateSetter() + myFixture.checkResult ''' +class Foo { + boolean isStateForceMailField; + + public void setStateForceMailField(boolean stateForceMailField) { + isStateForceMailField = stateForceMailField; + } +} ''' } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java index 07a7b0930d83..efc6c3c1d9cb 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java @@ -199,6 +199,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase { doTest(); } + public void testControlFlowAnalysisFailedValueCompatibilityUnchanged() throws Exception { + doTest(); + } + private void doTest() { doTest(false); } diff --git a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java index 5c4ba6b9baed..19094ce1d354 100644 --- a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java +++ b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java @@ -87,7 +87,7 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa protected void resume(SuspendContextImpl context) { DebugProcessImpl debugProcess = context.getDebugProcess(); - debugProcess.getManagerThread().schedule(debugProcess.createResumeCommand(context, PrioritizedTask.Priority.LOW)); + debugProcess.getManagerThread().schedule(debugProcess.createResumeCommand(context, PrioritizedTask.Priority.LOWEST)); } protected void stepInto(SuspendContextImpl context) { @@ -114,11 +114,16 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa } protected void onBreakpoint(SuspendContextRunnable runnable) { + addDefaultBreakpointListener(); + myScriptRunnables.add(runnable); + } + + protected void addDefaultBreakpointListener() { if (myPauseScriptListener == null) { final DebugProcessImpl debugProcess = getDebugProcess(); - + assertTrue("Debug process was not started", debugProcess != null); - + myPauseScriptListener = new DelayedEventsProcessListener( new DebugProcessAdapterImpl() { @Override @@ -164,7 +169,6 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa ); debugProcess.addDebugProcessListener(myPauseScriptListener); } - myScriptRunnables.add(runnable); } protected void printFrameProxy(StackFrameProxyImpl frameProxy) throws EvaluateException { diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java index c41297afad0b..ea3c4bd20d07 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java @@ -17,7 +17,6 @@ package com.intellij.profile.codeInspection; import com.intellij.openapi.Disposable; import com.intellij.openapi.components.ServiceManager; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.diagnostic.Logger; import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.Profile; @@ -38,7 +37,6 @@ import java.util.List; */ public abstract class InspectionProfileManager extends ApplicationProfileManager implements SeverityProvider { @NonNls public static final String INSPECTION_DIR = "inspection"; - @NonNls public static final String FILE_SPEC = StoragePathMacros.ROOT_CONFIG + '/' + INSPECTION_DIR; private final List myProfileChangeAdapters = ContainerUtil.createLockFreeCopyOnWriteList(); diff --git a/platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt b/platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt index 033542249ba5..03c9a3393936 100644 --- a/platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt +++ b/platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt @@ -18,6 +18,7 @@ package com.intellij.configurationStore import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.RoamingType import com.intellij.openapi.components.SettingsSavingComponent +import com.intellij.openapi.components.StoragePathMacros import com.intellij.openapi.components.impl.stores.IComponentStore import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.options.* @@ -31,11 +32,11 @@ private val LOG = Logger.getInstance(javaClass()) public class SchemeManagerFactoryImpl : SchemesManagerFactory(), SettingsSavingComponent { private val myRegisteredManagers = ContainerUtil.createLockFreeCopyOnWriteList>() - override fun createSchemesManager(fileSpec: String, processor: SchemeProcessor, roamingType: RoamingType): SchemesManager { + override fun createSchemesManager(directoryName: String, processor: SchemeProcessor, roamingType: RoamingType): SchemesManager { val storageManager = (ApplicationManager.getApplication().getPicoContainer().getComponentInstance(javaClass()) as IComponentStore).getStateStorageManager() - val baseDirPath = storageManager.expandMacros(fileSpec) - val provider = storageManager.getStreamProvider() - val manager = SchemeManagerImpl(fileSpec, processor, roamingType, provider, File(baseDirPath)) + + val fileSpec = if (directoryName.startsWith('$')) directoryName else "${StoragePathMacros.ROOT_CONFIG}/$directoryName" + val manager = SchemeManagerImpl(fileSpec, processor, roamingType, storageManager.getStreamProvider(), File(storageManager.expandMacros(fileSpec))) @suppress("CAST_NEVER_SUCCEEDS") myRegisteredManagers.add(manager as SchemeManagerImpl) return manager diff --git a/platform/configuration-store-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java b/platform/configuration-store-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java index bcef9a16761b..a9e3170d0071 100644 --- a/platform/configuration-store-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java +++ b/platform/configuration-store-impl/src/com/intellij/openapi/components/impl/stores/DefaultProjectStoreImpl.java @@ -163,13 +163,6 @@ public class DefaultProjectStoreImpl extends ProjectStoreImpl { }; } - @Override - public void load() { - if (myProjectManager.getDefaultProjectRootElement() != null) { - super.load(); - } - } - private static class MyExternalizationSession implements StateStorageManager.ExternalizationSession { @NotNull final StateStorage.ExternalizationSession externalizationSession; diff --git a/platform/core-api/src/com/intellij/openapi/options/SchemesManagerFactory.java b/platform/core-api/src/com/intellij/openapi/options/SchemesManagerFactory.java index 667a9203cac7..987506a26462 100644 --- a/platform/core-api/src/com/intellij/openapi/options/SchemesManagerFactory.java +++ b/platform/core-api/src/com/intellij/openapi/options/SchemesManagerFactory.java @@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull; public abstract class SchemesManagerFactory { @NotNull - public abstract SchemesManager createSchemesManager(@NotNull String fileSpec, + public abstract SchemesManager createSchemesManager(@NotNull String directoryName, @NotNull SchemeProcessor processor, @NotNull RoamingType roamingType); diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java index 1f5df45e60a7..0fd2f20d0dde 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java @@ -35,14 +35,12 @@ import com.intellij.openapi.roots.OrderEntry; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.ProjectLevelVcsManager; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.StatusBar; -import com.intellij.openapi.wm.StatusBarWidget; import com.intellij.openapi.wm.WindowManager; import com.intellij.openapi.wm.impl.status.StatusBarUtil; import com.intellij.util.Consumer; @@ -73,30 +71,6 @@ public class DvcsUtil { private static final int SHORT_HASH_LENGTH = 8; private static final int LONG_HASH_LENGTH = 40; - public static void installStatusBarWidget(@NotNull final Project project, @NotNull final StatusBarWidget widget) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); - if (statusBar != null) { - statusBar.addWidget(widget, "after " + (SystemInfo.isMac ? "Encoding" : "InsertOverwrite"), project); - } - } - }); - } - - public static void removeStatusBarWidget(@NotNull final Project project, @NotNull final StatusBarWidget widget) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); - if (statusBar != null) { - statusBar.removeWidget(widget.ID()); - } - } - }); - } - @NotNull public static String getShortRepositoryName(@NotNull Project project, @NotNull VirtualFile root) { VirtualFile projectDir = project.getBaseDir(); diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/branch/DvcsBranchPopup.java b/platform/dvcs-impl/src/com/intellij/dvcs/branch/DvcsBranchPopup.java index c3c98afa34dc..f3070824490a 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/branch/DvcsBranchPopup.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/branch/DvcsBranchPopup.java @@ -68,6 +68,7 @@ public abstract class DvcsBranchPopup { warnThatBranchesDivergedIfNeeded(); } + @NotNull public ListPopup asListPopup() { return myPopup; } diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/DvcsStatusWidget.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/DvcsStatusWidget.java new file mode 100644 index 000000000000..0ec678f6f36e --- /dev/null +++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/DvcsStatusWidget.java @@ -0,0 +1,222 @@ +/* + * Copyright 2000-2015 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.dvcs.ui; + +import com.intellij.dvcs.DvcsUtil; +import com.intellij.dvcs.repo.Repository; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.fileEditor.FileEditorManagerEvent; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.popup.ListPopup; +import com.intellij.openapi.util.SystemInfo; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.wm.StatusBar; +import com.intellij.openapi.wm.StatusBarWidget; +import com.intellij.openapi.wm.WindowManager; +import com.intellij.openapi.wm.impl.status.EditorBasedWidget; +import com.intellij.util.Consumer; +import org.jetbrains.annotations.CalledInAwt; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.awt.event.MouseEvent; + +public abstract class DvcsStatusWidget extends EditorBasedWidget + implements StatusBarWidget.MultipleTextValuesPresentation, StatusBarWidget.Multiframe +{ + protected static final Logger LOG = Logger.getInstance(DvcsStatusWidget.class); + private static final String MAX_STRING = "VCS: Rebasing feature-12345"; + + @NotNull private final String myPrefix; + + @Nullable private String myText; + @Nullable private String myTooltip; + + protected DvcsStatusWidget(@NotNull Project project, @NotNull String prefix) { + super(project); + myPrefix = prefix; + } + + @Nullable + protected abstract T guessRepository(@NotNull Project project, @Nullable VirtualFile selectedFile); + + @NotNull + protected abstract String getFullBranchName(@NotNull T repository); + + protected abstract boolean isMultiRoot(@NotNull Project project); + + @NotNull + protected abstract ListPopup getPopup(@NotNull Project project, @NotNull T repository); + + protected abstract void subscribeToRepoChangeEvents(@NotNull Project project); + + protected abstract void widgetUpdated(@NotNull T repository); + + public void activate() { + Project project = getProject(); + if (project != null) { + installWidgetToStatusBar(project, this); + } + } + + public void deactivate() { + Project project = getProject(); + if (project != null) { + removeWidgetFromStatusBar(project, this); + } + } + + public void dispose() { + deactivate(); + super.dispose(); + } + + @NotNull + @Override + public String ID() { + return getClass().getName(); + } + + @Override + public WidgetPresentation getPresentation(@NotNull PlatformType type) { + return this; + } + + @Override + public void selectionChanged(@NotNull FileEditorManagerEvent event) { + LOG.debug("selection changed"); + update(); + } + + @Override + public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { + LOG.debug("file opened"); + update(); + } + + @Override + public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) { + LOG.debug("file closed"); + update(); + } + + @CalledInAwt + @Nullable + @Override + public String getSelectedValue() { + return StringUtil.isEmpty(myText) ? "" : myPrefix + ": " + myText; + } + + @NotNull + @Override + @Deprecated + public String getMaxValue() { + return ""; + } + + @Nullable + @Override + public String getTooltipText() { + return myTooltip; + } + + @Nullable + @Override + public ListPopup getPopupStep() { + Project project = getProject(); + if (project == null || project.isDisposed()) return null; + T repository = guessRepository(project, DvcsUtil.getSelectedFile(project)); + if (repository == null) return null; + + return getPopup(project, repository); + } + + @Nullable + @Override + public Consumer getClickConsumer() { + // has no effect since the click opens a list popup, and the consumer is not called for the MultipleTextValuesPresentation + return null; + } + + protected void updateLater() { + ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override + public void run() { + LOG.debug("update after repository change"); + update(); + } + }); + } + + @CalledInAwt + private void update() { + myText = null; + myTooltip = null; + + Project project = getProject(); + if (project == null || project.isDisposed()) return; + T repository = guessRepository(project, DvcsUtil.getSelectedFile(project)); + if (repository == null) return; + + int maxLength = MAX_STRING.length() - 1; // -1, because there are arrows indicating that it is a popup + myText = StringUtil.shortenTextWithEllipsis(getFullBranchName(repository), maxLength, 5); + myTooltip = getToolTip(project); + if (myStatusBar != null) { + myStatusBar.updateWidget(ID()); + } + widgetUpdated(repository); + } + + @Nullable + private String getToolTip(@NotNull Project project) { + T currentRepository = guessRepository(project, DvcsUtil.getSelectedFile(project)); + if (currentRepository == null) return null; + String branchName = getFullBranchName(currentRepository); + if (isMultiRoot(project)) { + return branchName + "\n" + "Root: " + currentRepository.getRoot().getName(); + } + return branchName; + } + + private void installWidgetToStatusBar(@NotNull final Project project, @NotNull final StatusBarWidget widget) { + ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override + public void run() { + StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); + if (statusBar != null && !isDisposed()) { + statusBar.addWidget(widget, "after " + (SystemInfo.isMac ? "Encoding" : "InsertOverwrite"), project); + subscribeToRepoChangeEvents(project); + update(); + } + } + }); + } + + private void removeWidgetFromStatusBar(@NotNull final Project project, @NotNull final StatusBarWidget widget) { + ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override + public void run() { + StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); + if (statusBar != null && !isDisposed()) { + statusBar.removeWidget(widget.ID()); + } + } + }); + } +} \ No newline at end of file diff --git a/platform/lang-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java b/platform/lang-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java index fc443ffd0385..df11145c08af 100644 --- a/platform/lang-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java +++ b/platform/lang-api/src/com/intellij/execution/configuration/RunConfigurationExtensionsManager.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2015 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.execution.configuration; import com.intellij.execution.ExecutionException; @@ -91,10 +106,12 @@ public class RunConfigurationExtensionsManager 1) { + map.put(extension.getSerializationId(), element); + } } for (Element values : map.values()) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java index 350f833d98de..084cba55b3d6 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java @@ -89,7 +89,7 @@ public class TemplateSettings implements PersistentStateComponent myTemplates = MultiMap.createLinked(); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java index e41788d2b76f..8544671b4aae 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/InspectionProfileManagerImpl.java @@ -66,9 +66,10 @@ import java.util.concurrent.atomic.AtomicBoolean; @Storage(file = StoragePathMacros.APP_CONFIG + "/editor.xml"), @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml", deprecated = true) }, - additionalExportFile = InspectionProfileManager.FILE_SPEC + additionalExportFile = InspectionProfileManager.INSPECTION_DIR ) public class InspectionProfileManagerImpl extends InspectionProfileManager implements SeverityProvider, PersistentStateComponent { + private final InspectionToolRegistrar myRegistrar; private final SchemesManager mySchemesManager; private final AtomicBoolean myProfilesAreInitialized = new AtomicBoolean(false); @@ -84,7 +85,7 @@ public class InspectionProfileManagerImpl extends InspectionProfileManager imple myRegistrar = registrar; registerProvidedSeverities(); - mySchemesManager = schemesManagerFactory.createSchemesManager(FILE_SPEC, new BaseSchemeProcessor() { + mySchemesManager = schemesManagerFactory.createSchemesManager(INSPECTION_DIR, new BaseSchemeProcessor() { @NotNull @Override public InspectionProfileImpl readScheme(@NotNull Element element) { diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/ExportableFileTemplateSettings.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/ExportableFileTemplateSettings.java index db969cdf0762..efb9e11c631d 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/ExportableFileTemplateSettings.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/ExportableFileTemplateSettings.java @@ -32,7 +32,7 @@ import java.util.Locale; @State( name = "ExportableFileTemplateSettings", storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/" + ExportableFileTemplateSettings.EXPORTABLE_SETTINGS_FILE), - additionalExportFile = StoragePathMacros.ROOT_CONFIG + "/" + FileTemplatesLoader.TEMPLATES_DIR + additionalExportFile = FileTemplatesLoader.TEMPLATES_DIR ) public class ExportableFileTemplateSettings extends FileTemplatesLoader implements PersistentStateComponent { public final static String EXPORTABLE_SETTINGS_FILE = "file.template.settings.xml"; diff --git a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java index 3929fda2c7f0..c936db0d8304 100644 --- a/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/components/impl/stores/ModuleStoreImpl.java @@ -64,10 +64,7 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM return myModule.getProject(); } - @Override public void load() { - super.load(); - String moduleTypeId = getMainStorageData().myOptions.get(Module.ELEMENT_TYPE); myModule.setOption(Module.ELEMENT_TYPE, ModuleTypeManager.getInstance().findByID(moduleTypeId).getId()); diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/FormatterBasedLineIndentInfoBuilder.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/FormatterBasedLineIndentInfoBuilder.java index 164956c51e4a..e18a834445e7 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/FormatterBasedLineIndentInfoBuilder.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/FormatterBasedLineIndentInfoBuilder.java @@ -20,6 +20,7 @@ import com.intellij.lang.LanguageFormatting; import com.intellij.openapi.editor.Document; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Condition; +import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiComment; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; @@ -59,9 +60,7 @@ public class FormatterBasedLineIndentInfoBuilder { List normallyIndentedBlocks = ContainerUtil.filter(getBlocksStartingNewLine(), new Condition() { @Override public boolean value(Block block) { - Indent indent = block.getIndent(); - Indent.Type type = indent != null ? indent.getType() : null; - return type == Indent.Type.NONE || type == Indent.Type.NORMAL; + return hasTotallyNormalOrNoneIndent(block); } }); @@ -74,6 +73,29 @@ public class FormatterBasedLineIndentInfoBuilder { } }); } + + private static boolean hasTotallyNormalOrNoneIndent(Block block) { + final TextRange range = block.getTextRange(); + final int startOffset = range.getStartOffset(); + + boolean startOffsetAlreadyHasNormalIndent = false; + + while (block != null && range.getStartOffset() == startOffset) { + Indent.Type type = block.getIndent() != null ? block.getIndent().getType() : null; + + if (type == Indent.Type.NONE || type == Indent.Type.NORMAL && !startOffsetAlreadyHasNormalIndent) { + startOffsetAlreadyHasNormalIndent = true; + } + else { + return false; + } + + List subBlocks = block.getSubBlocks(); + block = subBlocks.isEmpty() ? null : subBlocks.get(0); + } + + return true; + } @NotNull private List getBlocksStartingNewLine() { diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemesImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemesImpl.java index b922bb4797c6..74d9a4ee4372 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemesImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemesImpl.java @@ -16,7 +16,6 @@ package com.intellij.psi.impl.source.codeStyle; import com.intellij.openapi.components.RoamingType; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.options.BaseSchemeProcessor; import com.intellij.openapi.options.SchemesManager; import com.intellij.openapi.options.SchemesManagerFactory; @@ -35,7 +34,7 @@ public abstract class CodeStyleSchemesImpl extends CodeStyleSchemes { protected static final String DEFAULT_SCHEME_NAME = "Default"; @NonNls - static final String CODE_STYLES_DIR_PATH = StoragePathMacros.ROOT_CONFIG + "/codestyles"; + static final String CODE_STYLES_DIR_PATH = "codestyles"; protected final SchemesManager mySchemesManager; diff --git a/platform/lang-impl/src/com/intellij/tools/ToolManager.java b/platform/lang-impl/src/com/intellij/tools/ToolManager.java index 0722090527bb..dfabbfe68770 100644 --- a/platform/lang-impl/src/com/intellij/tools/ToolManager.java +++ b/platform/lang-impl/src/com/intellij/tools/ToolManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package com.intellij.tools; import com.intellij.openapi.actionSystem.ex.ActionManagerEx; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.options.SchemeProcessor; import com.intellij.openapi.options.SchemesManagerFactory; import org.jetbrains.annotations.NotNull; @@ -33,7 +32,7 @@ public class ToolManager extends BaseToolManager { @Override protected String getSchemesPath() { - return StoragePathMacros.ROOT_CONFIG + "/tools"; + return "tools"; } @Override diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ExportSettingsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ExportSettingsAction.java index b48f26647c1d..b39ec70221e1 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ExportSettingsAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ExportSettingsAction.java @@ -208,7 +208,12 @@ public class ExportSettingsAction extends AnAction implements DumbAware { File additionalExportFile = null; if (!StringUtil.isEmpty(stateAnnotation.additionalExportFile())) { - additionalExportFile = new File(storageManager.expandMacros(stateAnnotation.additionalExportFile())); + String expandedPath = storageManager.expandMacros(stateAnnotation.additionalExportFile()); + additionalExportFile = new File(expandedPath); + if (!additionalExportFile.exists()) { + additionalExportFile = new File(storageManager.expandMacros(StoragePathMacros.ROOT_CONFIG) + '/' + expandedPath); + } + if (onlyExisting && !additionalExportFile.exists()) { additionalExportFile = null; } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaRootPaneUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaRootPaneUI.java index d60e26dd50d1..bd6a0e156566 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaRootPaneUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaRootPaneUI.java @@ -15,6 +15,7 @@ */ package com.intellij.ide.ui.laf.darcula.ui; +import com.intellij.openapi.util.registry.Registry; import com.intellij.ui.Gray; import com.intellij.ui.ScreenUtil; import com.intellij.util.ui.JBUI; @@ -371,6 +372,8 @@ public class DarculaRootPaneUI extends BasicRootPaneUI { } public void setMaximized() { + if (Registry.is("darcula.fix.maximized.frame.bounds")) return; + Component tla = myRootPane.getTopLevelAncestor(); GraphicsConfiguration gc = (currentRootPaneGC != null) ? currentRootPaneGC : tla.getGraphicsConfiguration(); diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickListsManager.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickListsManager.java index 7cd47436a47b..8d15385bd74c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickListsManager.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/ex/QuickListsManager.java @@ -22,7 +22,6 @@ import com.intellij.openapi.actionSystem.impl.BundledQuickListsProvider; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ExportableApplicationComponent; import com.intellij.openapi.components.RoamingType; -import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.options.BaseSchemeProcessor; import com.intellij.openapi.options.SchemesManager; import com.intellij.openapi.options.SchemesManagerFactory; @@ -38,8 +37,6 @@ import java.util.List; import java.util.Set; public class QuickListsManager implements ExportableApplicationComponent { - static final String FILE_SPEC = StoragePathMacros.ROOT_CONFIG + "/quicklists"; - private static final String LIST_TAG = "list"; private final ActionManager myActionManager; @@ -47,8 +44,8 @@ public class QuickListsManager implements ExportableApplicationComponent { public QuickListsManager(@NotNull ActionManager actionManager, @NotNull SchemesManagerFactory schemesManagerFactory) { myActionManager = actionManager; - mySchemeManager = schemesManagerFactory.createSchemesManager(FILE_SPEC, - new BaseSchemeProcessor() { + mySchemeManager = schemesManagerFactory.createSchemesManager("quicklists", + new BaseSchemeProcessor() { @NotNull @Override public QuickList readScheme(@NotNull Element element) { @@ -62,7 +59,7 @@ public class QuickListsManager implements ExportableApplicationComponent { return element; } }, - RoamingType.PER_USER); + RoamingType.PER_USER); } @NotNull diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionButtonWithText.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionButtonWithText.java index 890149ca4124..f4830834f06f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionButtonWithText.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionButtonWithText.java @@ -63,10 +63,12 @@ public class ActionButtonWithText extends ActionButton { int x2 = Math.max(iconR.x + iconR.width, textR.x + textR.width); int y1 = Math.min(iconR.y, textR.y); int y2 = Math.max(iconR.y + iconR.height, textR.y + textR.height); - Dimension rv = new Dimension(x2 - x1, y2 - y1); + Dimension rv = new Dimension(x2 - x1 + dx, y2 - y1 + dy); - rv.width = Math.max(rv.width += dx, basicSize.width); - rv.height = Math.max(rv.height += dy, basicSize.height); + rv.width += Math.max(basicSize.height - rv.height, 0); + + rv.width = Math.max(rv.width, basicSize.width); + rv.height = Math.max(rv.height, basicSize.height); return rv; } diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index 81f7a850aa39..ea463f33230c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -501,7 +501,10 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Loading application components"); try { - store.load(); + long t = System.currentTimeMillis(); + init(); + t = System.currentTimeMillis() - t; + LOG.info(getComponentConfigurations().length + " application components initialized in " + t + " ms"); } catch (StateStorageException e) { throw new IOException(e); diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ApplicationStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ApplicationStoreImpl.java index 13449af54d16..f0ea761b77b4 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ApplicationStoreImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/ApplicationStoreImpl.java @@ -100,14 +100,6 @@ public class ApplicationStoreImpl extends ComponentStoreImpl { }; } - @Override - public void load() { - long t = System.currentTimeMillis(); - myApplication.init(); - t = System.currentTimeMillis() - t; - LOG.info(myApplication.getComponentConfigurations().length + " application components initialized in " + t + " ms"); - } - @Override @NotNull protected MessageBus getMessageBus() { diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/BaseFileConfigurableStoreImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/BaseFileConfigurableStoreImpl.java index d05ce01aa6c5..202b214d012b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/BaseFileConfigurableStoreImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/BaseFileConfigurableStoreImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -99,11 +99,6 @@ abstract class BaseFileConfigurableStoreImpl extends ComponentStoreImpl { return ourConversionProblemsStorage; } - @Override - public void load() { - getMainStorageData(); //load it - } - public BaseStorageData getMainStorageData() { return (BaseStorageData)getMainStorage().getStorageData(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java index e6829907fd89..046506d68a9a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.java @@ -36,8 +36,6 @@ public interface IComponentStore { boolean isReloadPossible(@NotNull Set componentNames); - void load(); - @NotNull StateStorageManager getStateStorageManager(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java index 7fa5de890f99..c496cb4b5bae 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java @@ -66,7 +66,7 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers private final DefaultColorSchemesManager myDefaultColorSchemesManager; private final SchemesManager mySchemesManager; - static final String FILE_SPEC = StoragePathMacros.ROOT_CONFIG + "/colors"; + static final String FILE_SPEC = "colors"; private State myState = new State(); diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java index e77b6b75e68e..cc9d978cde6d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java @@ -128,7 +128,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent private static final String[] FILE_TYPES_WITH_PREDEFINED_EXTENSIONS = {"JSP", "JSPX", "DTD", "HTML", "Properties", "XHTML"}; private final SchemesManager mySchemesManager; @NonNls - static final String FILE_SPEC = StoragePathMacros.ROOT_CONFIG + "/filetypes"; + static final String FILE_SPEC = "filetypes"; // these flags are stored in 'packedFlags' as chunks of four bits private static final int AUTO_DETECTED_AS_TEXT_MASK = 1; // set if the file was auto-detected as text diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java index b1e2fd13acf4..5384764ba79b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapManagerImpl.java @@ -44,7 +44,7 @@ import java.util.*; additionalExportFile = KeymapManagerImpl.KEYMAPS_DIR_PATH ) public class KeymapManagerImpl extends KeymapManagerEx implements PersistentStateComponent, ApplicationComponent { - static final String KEYMAPS_DIR_PATH = StoragePathMacros.ROOT_CONFIG + "/keymaps"; + static final String KEYMAPS_DIR_PATH = "keymaps"; private final List myListeners = ContainerUtil.createLockFreeCopyOnWriteList(); private final Map myBoundShortcuts = new HashMap(); diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java index 7a60f49377bc..598034ecdf76 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java @@ -307,10 +307,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements PersistentSt boolean succeed = false; try { - if (template == null) { - project.getStateStore().load(); - } - else { + if (template != null) { project.getStateStore().loadProjectFromTemplate(template); } project.init(); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EditorBasedWidget.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EditorBasedWidget.java index 2e274b9599d9..e6d85e23dea2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EditorBasedWidget.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EditorBasedWidget.java @@ -33,7 +33,7 @@ public abstract class EditorBasedWidget extends FileEditorManagerAdapter impleme protected Project myProject; protected MessageBusConnection myConnection; - private boolean myDisposed; + private volatile boolean myDisposed; protected EditorBasedWidget(@NotNull Project project) { myProject = project; diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.java index 4b1ba760b65b..c15f9afa14ce 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.java @@ -191,16 +191,31 @@ public class IdeStatusBarImpl extends JComponent implements StatusBarEx { @Override public void addWidget(@NotNull final StatusBarWidget widget) { - addWidget(widget, Position.RIGHT, "__AUTODETECT__"); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + addWidget(widget, Position.RIGHT, "__AUTODETECT__"); + } + }); } @Override - public void addWidget(@NotNull final StatusBarWidget widget, @NotNull String anchor) { - addWidget(widget, Position.RIGHT, anchor); + public void addWidget(@NotNull final StatusBarWidget widget, @NotNull final String anchor) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + addWidget(widget, Position.RIGHT, anchor); + } + }); } private void addWidget(@NotNull final StatusBarWidget widget, @NotNull final Position pos) { - addWidget(widget, pos, "__IGNORED__"); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + addWidget(widget, pos, "__IGNORED__"); + } + }); } @Override @@ -314,7 +329,6 @@ public class IdeStatusBarImpl extends JComponent implements StatusBarEx { } private void addWidget(@NotNull final StatusBarWidget widget, @NotNull final Position pos, @NotNull final String anchor) { - assert EventQueue.isDispatchThread() : "Must be EDT"; myOrderedWidgets.add(widget.ID()); JPanel panel; @@ -405,9 +419,14 @@ public class IdeStatusBarImpl extends JComponent implements StatusBarEx { final StatusBarWidget.Multiframe mfw = (StatusBarWidget.Multiframe)widget; updateChildren(new ChildAction() { @Override - public void update(IdeStatusBarImpl child) { - StatusBarWidget widgetCopy = mfw.copy(); - child.addWidget(widgetCopy, pos, anchor); + public void update(final IdeStatusBarImpl child) { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + StatusBarWidget widgetCopy = mfw.copy(); + child.addWidget(widgetCopy, pos, anchor); + } + }); } }); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ApplicationStoreTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ApplicationStoreTest.kt index 2178f1fb4698..745b65276c5e 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ApplicationStoreTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/ApplicationStoreTest.kt @@ -178,9 +178,6 @@ public class ApplicationStoreTest : LightPlatformTestCase() { stateStorageManager.addMacro(StoragePathMacros.APP_CONFIG, testAppConfigPath) } - override fun load() { - } - override fun getStateStorageManager(): StateStorageManager { return stateStorageManager } diff --git a/platform/testFramework/src/com/intellij/mock/MockProjectStore.java b/platform/testFramework/src/com/intellij/mock/MockProjectStore.java index 74d9222d462d..940f106cbedc 100644 --- a/platform/testFramework/src/com/intellij/mock/MockProjectStore.java +++ b/platform/testFramework/src/com/intellij/mock/MockProjectStore.java @@ -124,11 +124,6 @@ public class MockProjectStore implements IProjectStore { throw new UnsupportedOperationException("Method initComponent is not yet implemented in " + getClass().getName()); } - @Override - public void load() { - throw new UnsupportedOperationException("Method load is not yet implemented in " + getClass().getName()); - } - @Override public void save(@NotNull List> readonlyFiles) { throw new UnsupportedOperationException(); diff --git a/platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java b/platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java index ea5a15bf9a41..dc38b60e1802 100644 --- a/platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java +++ b/platform/testFramework/src/com/intellij/testFramework/MockSchemesManagerFactory.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2015 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.testFramework; import com.intellij.openapi.components.RoamingType; @@ -9,7 +24,7 @@ public class MockSchemesManagerFactory extends SchemesManagerFactory { @NotNull @Override - public SchemesManager createSchemesManager(@NotNull String fileSpec, + public SchemesManager createSchemesManager(@NotNull String directoryName, @NotNull SchemeProcessor processor, @NotNull RoamingType roamingType) { //noinspection unchecked diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 0ec0dd1be064..287990c926a4 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -595,6 +595,8 @@ ide.win.frame.decoration=false ide.win.frame.decoration.description=Enables Frame and Dialog decorations for IntelliJ and Darcula LaFs on Windows darcula.fix.native.flickering=false darcula.fix.native.flickering.description=Fixes white flash on first window appearance +darcula.fix.maximized.frame.bounds=true +darcula.fix.maximized.frame.bounds.description=Disables modification of frame maximized bounds terminal.buffer.max.lines.count=1000 rubymine.use.vagrant.credential.cache=true diff --git a/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java b/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java index e2e1f74c3690..d2295136e560 100644 --- a/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java +++ b/platform/util/src/com/intellij/util/ui/tree/WideSelectionTreeUI.java @@ -121,8 +121,8 @@ public class WideSelectionTreeUI extends BasicTreeUI { } private void handle(MouseEvent e) { - final JTree tree = (JTree)e.getSource(); - if (SwingUtilities.isLeftMouseButton(e) && !e.isPopupTrigger()) { + if (!e.isPopupTrigger() && e.getClickCount() == 1 && SwingUtilities.isLeftMouseButton(e)) { + final JTree tree = (JTree)e.getSource(); final TreePath pressedPath = getClosestPathForLocation(tree, e.getX(), e.getY()); if (pressedPath != null) { Rectangle bounds = getPathBounds(tree, pressedPath); diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableIfStatement.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableIfStatement.html index 398d5cbb1b59..7c012ee2871a 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableIfStatement.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableIfStatement.html @@ -7,8 +7,8 @@ Reports if statements of the form if (condition) return true else return foo or if (condition) return false else return foo. These expressions may be safely simplified to -return condition && foo or -return !condition || foo, respectively. +return condition || foo or +return !condition && foo, respectively.

diff --git a/plugins/coverage/coverage.iml b/plugins/coverage/coverage.iml index c6cf45e25c90..6b579f5102aa 100644 --- a/plugins/coverage/coverage.iml +++ b/plugins/coverage/coverage.iml @@ -1,6 +1,6 @@ - + diff --git a/plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java b/plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java index 34e466b94967..1628ccf3f5ba 100644 --- a/plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java +++ b/plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java @@ -16,10 +16,13 @@ package org.jetbrains.java.generate.element; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.PsiModifier; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.JavaCodeStyleManager; import com.intellij.psi.codeStyle.VariableKind; +import java.beans.Introspector; import java.util.List; public class GenerationHelper { @@ -55,8 +58,16 @@ public class GenerationHelper { } public static String getPropertyName(FieldElement fieldElement, Project project) { - String name = fieldElement.getName(); - JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project); - return codeStyleManager.variableNameToPropertyName(name, fieldElement.isModifierStatic() ? VariableKind.STATIC_FIELD : VariableKind.FIELD); + final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project); + final VariableKind variableKind = fieldElement.isModifierStatic() ? VariableKind.STATIC_FIELD : VariableKind.FIELD; + final String propertyName = codeStyleManager.variableNameToPropertyName(fieldElement.getName(), variableKind); + if (!fieldElement.isModifierStatic() && fieldElement.isBoolean()) { + if (propertyName.startsWith("is") && + propertyName.length() > "is".length() && + Character.isUpperCase(propertyName.charAt("is".length()))) { + return StringUtil.decapitalize(propertyName.substring("is".length())); + } + } + return propertyName; } } diff --git a/plugins/git4idea/src/git4idea/GitVcs.java b/plugins/git4idea/src/git4idea/GitVcs.java index 184bd2b79295..757a0a128af5 100644 --- a/plugins/git4idea/src/git4idea/GitVcs.java +++ b/plugins/git4idea/src/git4idea/GitVcs.java @@ -15,7 +15,6 @@ */ package git4idea; -import com.intellij.dvcs.DvcsUtil; import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.ide.BrowserUtil; import com.intellij.notification.Notification; @@ -302,7 +301,7 @@ public class GitVcs extends AbstractVcs { if (!ApplicationManager.getApplication().isHeadlessEnvironment()) { myBranchWidget = new GitBranchWidget(myProject); - DvcsUtil.installStatusBarWidget(myProject, myBranchWidget); + myBranchWidget.activate(); } if (myRepositoryForAnnotationsListener == null) { myRepositoryForAnnotationsListener = new GitRepositoryForAnnotationsListener(myProject); @@ -336,7 +335,7 @@ public class GitVcs extends AbstractVcs { } if (myBranchWidget != null) { - DvcsUtil.removeStatusBarWidget(myProject, myBranchWidget); + myBranchWidget.deactivate(); myBranchWidget = null; } } diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java b/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java index e5cbd84cde27..088726958628 100644 --- a/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java +++ b/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java @@ -266,6 +266,7 @@ public class GitBranchUtil { * Returns the text that is displaying current branch. * In the simple case it is just the branch name, but in detached HEAD state it displays the hash or "rebasing master". */ + @NotNull public static String getDisplayableBranchText(@NotNull GitRepository repository) { GitRepository.State state = repository.getState(); if (state == GitRepository.State.DETACHED) { diff --git a/plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java b/plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java index dcf52ff48a24..7e5aa107e9b8 100644 --- a/plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java +++ b/plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java @@ -15,174 +15,73 @@ */ package git4idea.ui.branch; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.fileEditor.FileEditorManager; -import com.intellij.openapi.fileEditor.FileEditorManagerEvent; +import com.intellij.dvcs.ui.DvcsStatusWidget; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.ListPopup; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.StatusBarWidget; -import com.intellij.openapi.wm.impl.status.EditorBasedWidget; -import com.intellij.util.Consumer; +import com.intellij.util.ObjectUtils; import git4idea.GitUtil; import git4idea.branch.GitBranchUtil; import git4idea.config.GitVcsSettings; import git4idea.repo.GitRepository; import git4idea.repo.GitRepositoryChangeListener; import org.jetbrains.annotations.NotNull; - -import java.awt.event.MouseEvent; +import org.jetbrains.annotations.Nullable; /** * Status bar widget which displays the current branch for the file currently open in the editor. - * @author Kirill Likhodedov */ -public class GitBranchWidget extends EditorBasedWidget implements StatusBarWidget.MultipleTextValuesPresentation, - StatusBarWidget.Multiframe, - GitRepositoryChangeListener { - private static final Logger LOG = Logger.getInstance(GitBranchWidget.class); - +public class GitBranchWidget extends DvcsStatusWidget { private final GitVcsSettings mySettings; - private volatile String myText = ""; - private volatile String myTooltip = ""; - private final String myMaxString; - public GitBranchWidget(Project project) { - super(project); - project.getMessageBus().connect().subscribe(GitRepository.GIT_REPO_CHANGE, this); + public GitBranchWidget(@NotNull Project project) { + super(project, "Git"); mySettings = GitVcsSettings.getInstance(project); - myMaxString = "Git: Rebasing master"; - updateLater(); } @Override public StatusBarWidget copy() { - return new GitBranchWidget(getProject()); + return new GitBranchWidget(ObjectUtils.assertNotNull(getProject())); + } + + @Nullable + @Override + protected GitRepository guessRepository(@NotNull Project project, @Nullable VirtualFile selectedFile) { + VirtualFile root = GitBranchUtil.getVcsRootOrGuess(project, selectedFile); + return GitUtil.getRepositoryManager(project).getRepositoryForRoot(root); } @NotNull @Override - public String ID() { - return GitBranchWidget.class.getName(); + protected String getFullBranchName(@NotNull GitRepository repository) { + return GitBranchUtil.getDisplayableBranchText(repository); } @Override - public WidgetPresentation getPresentation(@NotNull PlatformType type) { - return this; + protected boolean isMultiRoot(@NotNull Project project) { + return !GitUtil.justOneGitRepository(project); + } + + @NotNull + @Override + protected ListPopup getPopup(@NotNull Project project, @NotNull GitRepository repository) { + return GitBranchPopup.getInstance(project, repository).asListPopup(); } @Override - public void selectionChanged(@NotNull FileEditorManagerEvent event) { - LOG.debug("selection changed"); - update(); - } - - @Override - public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { - LOG.debug("file opened"); - update(); - } - - @Override - public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) { - LOG.debug("file closed"); - update(); - } - - @Override - public void repositoryChanged(@NotNull GitRepository repository) { - LOG.debug("repository changed"); - updateLater(); - } - - private void updateLater() { - ApplicationManager.getApplication().invokeLater(new Runnable() { + protected void subscribeToRepoChangeEvents(@NotNull Project project) { + project.getMessageBus().connect().subscribe(GitRepository.GIT_REPO_CHANGE, new GitRepositoryChangeListener() { @Override - public void run() { - LOG.debug("update after repository change"); - update(); + public void repositoryChanged(@NotNull GitRepository repository) { + LOG.debug("repository changed"); + updateLater(); } }); } @Override - public ListPopup getPopupStep() { - Project project = getProject(); - if (project == null) { - return null; - } - GitRepository repo = GitBranchUtil.getCurrentRepository(project); - if (repo == null) { - return null; - } - update(); // update on click - return GitBranchPopup.getInstance(project, repo).asListPopup(); + protected void widgetUpdated(@NotNull GitRepository repository) { + mySettings.setRecentRoot(repository.getRoot().getPath()); } - - @Override - public String getSelectedValue() { - final String text = myText; - return StringUtil.isEmpty(text) ? "" : "Git: " + text; - } - - @NotNull - @Override - @Deprecated - public String getMaxValue() { - return myMaxString; - } - - @Override - public String getTooltipText() { - return myTooltip; - } - - @Override - // have no effect since the click opens a list popup, and the consumer is not called for the MultipleTextValuesPresentation - public Consumer getClickConsumer() { - return new Consumer() { - public void consume(MouseEvent mouseEvent) { - update(); - } - }; - } - - private void update() { - Project project = getProject(); - if (project == null || project.isDisposed()) { - emptyTextAndTooltip(); - return; - } - - GitRepository repo = GitBranchUtil.getCurrentRepository(project); - if (repo == null) { // the file is not under version control => display nothing - emptyTextAndTooltip(); - return; - } - - int maxLength = myMaxString.length() - 1; // -1, because there are arrows indicating that it is a popup - myText = StringUtil.shortenTextWithEllipsis(GitBranchUtil.getDisplayableBranchText(repo), maxLength, 5); - myTooltip = getDisplayableBranchTooltip(repo); - if (myStatusBar != null) { - myStatusBar.updateWidget(ID()); - } - mySettings.setRecentRoot(repo.getRoot().getPath()); - } - - private void emptyTextAndTooltip() { - myText = ""; - myTooltip = ""; - } - - @NotNull - private static String getDisplayableBranchTooltip(GitRepository repo) { - String text = GitBranchUtil.getDisplayableBranchText(repo); - if (!GitUtil.justOneGitRepository(repo.getProject())) { - return text + "\n" + "Root: " + repo.getRoot().getName(); - } - return text; - } - } diff --git a/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/AbstractModelBuilderTest.java b/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/AbstractModelBuilderTest.java index ecc7baafbe93..c71869c385d1 100644 --- a/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/AbstractModelBuilderTest.java +++ b/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/AbstractModelBuilderTest.java @@ -66,7 +66,7 @@ public abstract class AbstractModelBuilderTest { public static final Object[][] SUPPORTED_GRADLE_VERSIONS = { {"1.9"}, {"1.10"}, {"1.11"}, {"1.12"}, - {"2.0"}, {"2.1"}, {"2.2"} , {"2.3"} + {"2.0"}, {"2.1"}, {"2.2"} , {"2.3"}, {"2.4"}, {"2.5"} }; public static final String BASE_GRADLE_VERSION = String.valueOf(SUPPORTED_GRADLE_VERSIONS[SUPPORTED_GRADLE_VERSIONS.length - 1][0]); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java index d3f96536fb76..467b5095bbc0 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java @@ -275,7 +275,7 @@ public class HgVcs extends AbstractVcs { checkExecutableAndVersion(); // status bar - myStatusWidget = new HgStatusWidget(this, getProject(), projectSettings); + myStatusWidget = new HgStatusWidget(this, getProject()); myStatusWidget.activate(); myIncomingWidget = new HgIncomingOutgoingWidget(this, getProject(), projectSettings, true); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java b/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java index e323fb30afbd..e9c0580b08be 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java @@ -15,183 +15,71 @@ */ package org.zmlx.hg4idea.status.ui; -import com.intellij.dvcs.DvcsUtil; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.fileEditor.FileEditorManager; -import com.intellij.openapi.fileEditor.FileEditorManagerEvent; +import com.intellij.dvcs.ui.DvcsStatusWidget; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.ListPopup; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.StatusBarWidget; -import com.intellij.openapi.wm.impl.status.EditorBasedWidget; -import com.intellij.util.Consumer; -import com.intellij.util.messages.MessageBusConnection; +import com.intellij.util.ObjectUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.zmlx.hg4idea.HgProjectSettings; import org.zmlx.hg4idea.HgUpdater; import org.zmlx.hg4idea.HgVcs; import org.zmlx.hg4idea.branch.HgBranchPopup; import org.zmlx.hg4idea.repo.HgRepository; import org.zmlx.hg4idea.util.HgUtil; -import java.awt.event.MouseEvent; - /** - * Widget to display basic hg status in the IJ status bar. + * Widget to display basic hg status in the status bar. */ -public class HgStatusWidget extends EditorBasedWidget - implements StatusBarWidget.MultipleTextValuesPresentation, - StatusBarWidget.Multiframe, HgUpdater { - - private static final String MAX_STRING = "Hg: Merging default "; +public class HgStatusWidget extends DvcsStatusWidget { @NotNull private final HgVcs myVcs; - @NotNull private final HgProjectSettings myProjectSettings; - private volatile String myText = ""; - private volatile String myTooltip = ""; - - public HgStatusWidget(@NotNull HgVcs vcs, @NotNull Project project, @NotNull HgProjectSettings projectSettings) { - super(project); + public HgStatusWidget(@NotNull HgVcs vcs, @NotNull Project project) { + super(project, "Hg"); myVcs = vcs; - myProjectSettings = projectSettings; } @Override public StatusBarWidget copy() { - return new HgStatusWidget(myVcs, getProject(), myProjectSettings); + return new HgStatusWidget(myVcs, ObjectUtils.assertNotNull(getProject())); + } + + @Nullable + @Override + protected HgRepository guessRepository(@NotNull Project project, @Nullable VirtualFile selectedFile) { + return HgUtil.getRepositoryForFile(project, selectedFile); } @NotNull @Override - public String ID() { - return HgStatusWidget.class.getName(); + protected String getFullBranchName(@NotNull HgRepository repository) { + return HgUtil.getDisplayableBranchOrBookmarkText(repository); } @Override - public WidgetPresentation getPresentation(@NotNull PlatformType type) { - return this; - } - - @Override - public void selectionChanged(@NotNull FileEditorManagerEvent event) { - update(); - } - - @Override - public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { - update(); - } - - @Override - public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) { - update(); - } - - @Override - public ListPopup getPopupStep() { - Project project = getProject(); - if (project == null || project.isDisposed()) { - return null; - } - VirtualFile root = HgUtil.getRootForSelectedFile(project); - HgRepository repository = HgUtil.getRepositoryManager(project).getRepositoryForRoot(root); - if (repository != null) { - return HgBranchPopup.getInstance(project, repository).asListPopup(); - } - return null; - } - - @Override - public String getSelectedValue() { - final String text = myText; - return StringUtil.isEmpty(text) ? "" : "hg: " + text; + protected boolean isMultiRoot(@NotNull Project project) { + return HgUtil.getRepositoryManager(project).moreThanOneRoot(); } @NotNull @Override - @Deprecated - public String getMaxValue() { - return MAX_STRING; - } - - - @Override - public String getTooltipText() { - return myTooltip; - } - - - @Override - // Updates branch information on click - public Consumer getClickConsumer() { - return new Consumer() { - public void consume(MouseEvent mouseEvent) { - update(); - } - }; + protected ListPopup getPopup(@NotNull Project project, @NotNull HgRepository repository) { + return HgBranchPopup.getInstance(project, repository).asListPopup(); } @Override - public void update(final Project project, @Nullable VirtualFile root) { - updateLater(); - } - - private void updateLater() { - ApplicationManager.getApplication().invokeLater(new Runnable() { + protected void subscribeToRepoChangeEvents(@NotNull Project project) { + project.getMessageBus().connect().subscribe(HgVcs.STATUS_TOPIC, new HgUpdater() { @Override - public void run() { - update(); + public void update(Project project, @Nullable VirtualFile root) { + updateLater(); } }); } - private void update() { - Project project = getProject(); - if ((project == null) || project.isDisposed()) { - emptyTextAndTooltip(); - return; - } - - final HgRepository repo = HgUtil.getCurrentRepository(project); - if (repo == null) { // the file is not under version control => display nothing - emptyTextAndTooltip(); - return; - } - myTooltip = HgUtil.getDisplayableBranchOrBookmarkText(repo); - myText = StringUtil.shortenTextWithEllipsis(myTooltip, MAX_STRING.length(), 5); - if (!isDisposed() && myStatusBar != null) { - myStatusBar.updateWidget(ID()); - } - } - - public void activate() { - Project project = getProject(); - if (null == project) { - return; - } - - MessageBusConnection busConnection = project.getMessageBus().connect(); - busConnection.subscribe(HgVcs.STATUS_TOPIC, this); - - DvcsUtil.installStatusBarWidget(myProject, this); - updateLater(); - } - - public void deactivate() { - if (isDisposed()) return; - DvcsUtil.removeStatusBarWidget(myProject, this); - } - - public void dispose() { - deactivate(); - super.dispose(); - } - - private void emptyTextAndTooltip() { - myText = ""; - myTooltip = ""; + @Override + protected void widgetUpdated(@NotNull HgRepository repository) { } } diff --git a/python/helpers/pydev/pydevd_resolver.py b/python/helpers/pydev/pydevd_resolver.py index 5a502512980d..5914df179b2a 100644 --- a/python/helpers/pydev/pydevd_resolver.py +++ b/python/helpers/pydev/pydevd_resolver.py @@ -222,7 +222,10 @@ class DictResolver: if '(' not in key: #we have to treat that because the dict resolver is also used to directly resolve the global and local #scopes (which already have the items directly) - return dict[key] + try: + return dict[key] + except: + return getattr(dict, key) #ok, we have to iterate over the items to find the one that matches the id, because that's the only way #to actually find the reference from the string we have before. @@ -256,10 +259,12 @@ class DictResolver: break ret['__len__'] = len(dict) + # in case if the class extends built-in type and has some additional fields + additional_fields = defaultResolver.getDictionary(dict) + ret.update(additional_fields) return ret - #======================================================================================================================= # TupleResolver #======================================================================================================================= @@ -272,7 +277,10 @@ class TupleResolver: #to enumerate tuples and lists ''' if attribute in ('__len__', TOO_LARGE_ATTR): return None - return var[int(attribute)] + try: + return var[int(attribute)] + except: + return getattr(var, attribute) def getDictionary(self, var): l = len(var) @@ -290,6 +298,9 @@ class TupleResolver: #to enumerate tuples and lists break d['__len__'] = len(var) + # in case if the class extends built-in type and has some additional fields + additional_fields = defaultResolver.getDictionary(var) + d.update(additional_fields) return d @@ -306,7 +317,11 @@ class SetResolver: if attribute in ('__len__', TOO_LARGE_ATTR): return None - attribute = int(attribute) + try: + attribute = int(attribute) + except: + return getattr(var, attribute) + for v in var: if id(v) == attribute: return v @@ -326,6 +341,9 @@ class SetResolver: d['__len__'] = len(var) + # in case if the class extends built-in type and has some additional fields + additional_fields = defaultResolver.getDictionary(var) + d.update(additional_fields) return d diff --git a/python/ide/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java b/python/ide/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java index 12baeb661707..7260367b067a 100644 --- a/python/ide/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java +++ b/python/ide/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java @@ -44,6 +44,7 @@ import com.jetbrains.python.PyBundle; import com.jetbrains.python.packaging.ui.PyInstalledPackagesPanel; import com.jetbrains.python.packaging.ui.PyPackageManagementService; import com.jetbrains.python.psi.LanguageLevel; +import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher; import com.jetbrains.python.sdk.*; import com.jetbrains.python.sdk.flavors.PythonSdkFlavor; import icons.PythonIcons; diff --git a/python/src/com/jetbrains/python/psi/PyUtil.java b/python/src/com/jetbrains/python/psi/PyUtil.java index 4467eab49a94..b02299a125d1 100644 --- a/python/src/com/jetbrains/python/psi/PyUtil.java +++ b/python/src/com/jetbrains/python/psi/PyUtil.java @@ -771,7 +771,7 @@ public class PyUtil { if (folder != null) { LanguageLevel level = folder.getUserData(LanguageLevel.KEY); if (level == null) level = PythonLanguageLevelPusher.getFileLanguageLevel(project, virtualFile); - if (level != null) return level; + return level; } else { // However this allows us to setup language level per file manually @@ -785,8 +785,23 @@ public class PyUtil { return languageLevel; } } + return guessLanguageLevelWithCaching(project); } - return guessLanguageLevel(project); + } + + public static void invalidateLanguageLevelCache(@NotNull Project project) { + project.putUserData(PythonLanguageLevelPusher.PYTHON_LANGUAGE_LEVEL, null); + } + + @NotNull + public static LanguageLevel guessLanguageLevelWithCaching(@NotNull Project project) { + LanguageLevel languageLevel = project.getUserData(PythonLanguageLevelPusher.PYTHON_LANGUAGE_LEVEL); + if (languageLevel == null) { + languageLevel = guessLanguageLevel(project); + project.putUserData(PythonLanguageLevelPusher.PYTHON_LANGUAGE_LEVEL, languageLevel); + } + + return languageLevel; } @NotNull diff --git a/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java b/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java index a78934b33b12..af2e9cb35235 100644 --- a/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java +++ b/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java @@ -64,6 +64,8 @@ import java.util.*; * @author yole */ public class PythonLanguageLevelPusher implements FilePropertyPusher { + public static final Key PYTHON_LANGUAGE_LEVEL = Key.create("PYTHON_LANGUAGE_LEVEL"); + private final Map myModuleSdks = new WeakHashMap(); public static void pushLanguageLevel(final Project project) { @@ -83,6 +85,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher orderEntries = ProjectRootManager.getInstance(project).getFileIndex().getOrderEntriesForFile(file); for (OrderEntry orderEntry : orderEntries) { @@ -233,17 +239,18 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher