mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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.*
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -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) {
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Test {
|
||||
public static void processDifference(final Stream<String> stream, final Stream<String> cells) {
|
||||
stream.map(rule -> {
|
||||
try {
|
||||
return cells.collect(Collectors.toMap(c -> c, null));
|
||||
} finally {
|
||||
System.out.println(<error descr="')' expected"><error descr="Expression expected">;</error></error><error descr="Unexpected token">)</error>;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
<caret>
|
||||
}
|
||||
'''
|
||||
generateSetter()
|
||||
myFixture.checkResult '''
|
||||
class Foo {
|
||||
boolean isStateForceMailField;
|
||||
|
||||
public void setStateForceMailField(boolean stateForceMailField) {
|
||||
isStateForceMailField = stateForceMailField;
|
||||
}
|
||||
}
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -199,6 +199,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testControlFlowAnalysisFailedValueCompatibilityUnchanged() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
+8
-4
@@ -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 {
|
||||
|
||||
-2
@@ -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<ProfileChangeAdapter> myProfileChangeAdapters = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
|
||||
|
||||
@@ -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<SchemeManagerFactoryImpl>())
|
||||
public class SchemeManagerFactoryImpl : SchemesManagerFactory(), SettingsSavingComponent {
|
||||
private val myRegisteredManagers = ContainerUtil.createLockFreeCopyOnWriteList<SchemeManagerImpl<Scheme, ExternalizableScheme>>()
|
||||
|
||||
override fun <T : Scheme, E : ExternalizableScheme> createSchemesManager(fileSpec: String, processor: SchemeProcessor<E>, roamingType: RoamingType): SchemesManager<T, E> {
|
||||
override fun <T : Scheme, E : ExternalizableScheme> createSchemesManager(directoryName: String, processor: SchemeProcessor<E>, roamingType: RoamingType): SchemesManager<T, E> {
|
||||
val storageManager = (ApplicationManager.getApplication().getPicoContainer().getComponentInstance(javaClass<IComponentStore>()) as IComponentStore).getStateStorageManager()
|
||||
val baseDirPath = storageManager.expandMacros(fileSpec)
|
||||
val provider = storageManager.getStreamProvider()
|
||||
val manager = SchemeManagerImpl<T, E>(fileSpec, processor, roamingType, provider, File(baseDirPath))
|
||||
|
||||
val fileSpec = if (directoryName.startsWith('$')) directoryName else "${StoragePathMacros.ROOT_CONFIG}/$directoryName"
|
||||
val manager = SchemeManagerImpl<T, E>(fileSpec, processor, roamingType, storageManager.getStreamProvider(), File(storageManager.expandMacros(fileSpec)))
|
||||
@suppress("CAST_NEVER_SUCCEEDS")
|
||||
myRegisteredManagers.add(manager as SchemeManagerImpl<Scheme, ExternalizableScheme>)
|
||||
return manager
|
||||
|
||||
-7
@@ -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;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class SchemesManagerFactory {
|
||||
@NotNull
|
||||
public abstract <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> createSchemesManager(@NotNull String fileSpec,
|
||||
public abstract <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> createSchemesManager(@NotNull String directoryName,
|
||||
@NotNull SchemeProcessor<E> processor,
|
||||
@NotNull RoamingType roamingType);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -68,6 +68,7 @@ public abstract class DvcsBranchPopup<Repo extends Repository> {
|
||||
warnThatBranchesDivergedIfNeeded();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ListPopup asListPopup() {
|
||||
return myPopup;
|
||||
}
|
||||
|
||||
@@ -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<T extends Repository> 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<MouseEvent> 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());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+19
-2
@@ -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<U extends RunConfigurationBase, T
|
||||
extension.writeExternal(configuration, element);
|
||||
}
|
||||
catch (WriteExternalException ignored) {
|
||||
map.remove(extension.getSerializationId());
|
||||
continue;
|
||||
}
|
||||
map.put(extension.getSerializationId(), element);
|
||||
|
||||
if (!element.getContent().isEmpty() || element.getAttributes().size() > 1) {
|
||||
map.put(extension.getSerializationId(), element);
|
||||
}
|
||||
}
|
||||
|
||||
for (Element values : map.values()) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class TemplateSettings implements PersistentStateComponent<TemplateSettin
|
||||
@NonNls private static final String KEY = "key";
|
||||
@NonNls private static final String ID = "id";
|
||||
|
||||
static final String TEMPLATES_DIR_PATH = StoragePathMacros.ROOT_CONFIG + "/templates";
|
||||
static final String TEMPLATES_DIR_PATH = "templates";
|
||||
|
||||
private final MultiMap<String, TemplateImpl> myTemplates = MultiMap.createLinked();
|
||||
|
||||
|
||||
+3
-2
@@ -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<Element> {
|
||||
|
||||
private final InspectionToolRegistrar myRegistrar;
|
||||
private final SchemesManager<Profile, InspectionProfileImpl> 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<InspectionProfileImpl>() {
|
||||
mySchemesManager = schemesManagerFactory.createSchemesManager(INSPECTION_DIR, new BaseSchemeProcessor<InspectionProfileImpl>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public InspectionProfileImpl readScheme(@NotNull Element element) {
|
||||
|
||||
+1
-1
@@ -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<Element> {
|
||||
public final static String EXPORTABLE_SETTINGS_FILE = "file.template.settings.xml";
|
||||
|
||||
-3
@@ -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());
|
||||
|
||||
|
||||
+25
-3
@@ -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<Block> normallyIndentedBlocks = ContainerUtil.filter(getBlocksStartingNewLine(), new Condition<Block>() {
|
||||
@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<Block> subBlocks = block.getSubBlocks();
|
||||
block = subBlocks.isEmpty() ? null : subBlocks.get(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<Block> getBlocksStartingNewLine() {
|
||||
|
||||
+1
-2
@@ -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<CodeStyleScheme, CodeStyleSchemeImpl> mySchemesManager;
|
||||
|
||||
|
||||
@@ -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<Tool> {
|
||||
|
||||
@Override
|
||||
protected String getSchemesPath() {
|
||||
return StoragePathMacros.ROOT_CONFIG + "/tools";
|
||||
return "tools";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
+3
-6
@@ -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<QuickList>() {
|
||||
mySchemeManager = schemesManagerFactory.createSchemesManager("quicklists",
|
||||
new BaseSchemeProcessor<QuickList>() {
|
||||
@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
|
||||
|
||||
+5
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -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);
|
||||
|
||||
-8
@@ -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() {
|
||||
|
||||
+1
-6
@@ -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();
|
||||
}
|
||||
|
||||
-2
@@ -36,8 +36,6 @@ public interface IComponentStore {
|
||||
|
||||
boolean isReloadPossible(@NotNull Set<String> componentNames);
|
||||
|
||||
void load();
|
||||
|
||||
@NotNull
|
||||
StateStorageManager getStateStorageManager();
|
||||
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers
|
||||
|
||||
private final DefaultColorSchemesManager myDefaultColorSchemesManager;
|
||||
private final SchemesManager<EditorColorsScheme, EditorColorsSchemeImpl> mySchemesManager;
|
||||
static final String FILE_SPEC = StoragePathMacros.ROOT_CONFIG + "/colors";
|
||||
static final String FILE_SPEC = "colors";
|
||||
|
||||
private State myState = new State();
|
||||
|
||||
|
||||
+1
-1
@@ -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<FileType, AbstractFileType> 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
|
||||
|
||||
@@ -44,7 +44,7 @@ import java.util.*;
|
||||
additionalExportFile = KeymapManagerImpl.KEYMAPS_DIR_PATH
|
||||
)
|
||||
public class KeymapManagerImpl extends KeymapManagerEx implements PersistentStateComponent<Element>, ApplicationComponent {
|
||||
static final String KEYMAPS_DIR_PATH = StoragePathMacros.ROOT_CONFIG + "/keymaps";
|
||||
static final String KEYMAPS_DIR_PATH = "keymaps";
|
||||
|
||||
private final List<KeymapManagerListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
private final Map<String, String> myBoundShortcuts = new HashMap<String, String>();
|
||||
|
||||
+1
-4
@@ -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();
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+27
-8
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
-3
@@ -178,9 +178,6 @@ public class ApplicationStoreTest : LightPlatformTestCase() {
|
||||
stateStorageManager.addMacro(StoragePathMacros.APP_CONFIG, testAppConfigPath)
|
||||
}
|
||||
|
||||
override fun load() {
|
||||
}
|
||||
|
||||
override fun getStateStorageManager(): StateStorageManager {
|
||||
return stateStorageManager
|
||||
}
|
||||
|
||||
@@ -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<Pair<StateStorage.SaveSession, VirtualFile>> readonlyFiles) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
+16
-1
@@ -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 <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> createSchemesManager(@NotNull String fileSpec,
|
||||
public <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> createSchemesManager(@NotNull String directoryName,
|
||||
@NotNull SchemeProcessor<E> processor,
|
||||
@NotNull RoamingType roamingType) {
|
||||
//noinspection unchecked
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -7,8 +7,8 @@ Reports if statements of the form
|
||||
<b>if (<i>condition</i>) return true else return <i>foo</i></b>
|
||||
or <b>if (<i>condition</i>) return false else return <i>foo</i></b>.
|
||||
These expressions may be safely simplified to
|
||||
<b>return <i>condition</i> && <i>foo</i></b> or
|
||||
<b>return !<i>condition</i> || <i>foo</i></b>, respectively.
|
||||
<b>return <i>condition</i> || <i>foo</i></b> or
|
||||
<b>return !<i>condition</i> && <i>foo</i></b>, respectively.
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module relativePaths="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
|
||||
+14
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<CommittedChangeList> {
|
||||
|
||||
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<CommittedChangeList> {
|
||||
}
|
||||
|
||||
if (myBranchWidget != null) {
|
||||
DvcsUtil.removeStatusBarWidget(myProject, myBranchWidget);
|
||||
myBranchWidget.deactivate();
|
||||
myBranchWidget = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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<GitRepository> {
|
||||
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<MouseEvent> getClickConsumer() {
|
||||
return new Consumer<MouseEvent>() {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -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]);
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ public class HgVcs extends AbstractVcs<CommittedChangeList> {
|
||||
checkExecutableAndVersion();
|
||||
|
||||
// status bar
|
||||
myStatusWidget = new HgStatusWidget(this, getProject(), projectSettings);
|
||||
myStatusWidget = new HgStatusWidget(this, getProject());
|
||||
myStatusWidget.activate();
|
||||
|
||||
myIncomingWidget = new HgIncomingOutgoingWidget(this, getProject(), projectSettings, true);
|
||||
|
||||
@@ -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<HgRepository> {
|
||||
|
||||
@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<MouseEvent> getClickConsumer() {
|
||||
return new Consumer<MouseEvent>() {
|
||||
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) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -64,6 +64,8 @@ import java.util.*;
|
||||
* @author yole
|
||||
*/
|
||||
public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLevel> {
|
||||
public static final Key<LanguageLevel> PYTHON_LANGUAGE_LEVEL = Key.create("PYTHON_LANGUAGE_LEVEL");
|
||||
|
||||
private final Map<Module, Sdk> myModuleSdks = new WeakHashMap<Module, Sdk>();
|
||||
|
||||
public static void pushLanguageLevel(final Project project) {
|
||||
@@ -83,6 +85,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
|
||||
}
|
||||
}
|
||||
}
|
||||
project.putUserData(PYTHON_LANGUAGE_LEVEL, PyUtil.guessLanguageLevel(project));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -99,6 +102,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
|
||||
return LanguageLevel.getDefault();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public LanguageLevel getImmediateValue(@NotNull Project project, @Nullable VirtualFile file) {
|
||||
return getFileLanguageLevel(project, file);
|
||||
}
|
||||
@@ -112,7 +116,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
|
||||
if (sdk != null) {
|
||||
return PythonSdkType.getLanguageLevelForSdk(sdk);
|
||||
}
|
||||
return PyUtil.guessLanguageLevel(project);
|
||||
return PyUtil.guessLanguageLevelWithCaching(project);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -123,12 +127,14 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
|
||||
if (sdk != null) {
|
||||
return sdk;
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return findSdkForFileOutsideTheProject(project, file);
|
||||
}
|
||||
return findSdk(project, file);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Sdk findSdk(Project project, VirtualFile file) {
|
||||
private static Sdk findSdkForFileOutsideTheProject(Project project, VirtualFile file) {
|
||||
if (file != null) {
|
||||
final List<OrderEntry> orderEntries = ProjectRootManager.getInstance(project).getFileIndex().getOrderEntriesForFile(file);
|
||||
for (OrderEntry orderEntry : orderEntries) {
|
||||
@@ -233,17 +239,18 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateSdkLanguageLevel(final Project project, final Sdk sdk) {
|
||||
private void updateSdkLanguageLevel(@NotNull final Project project, final Sdk sdk) {
|
||||
final LanguageLevel languageLevel = PythonSdkType.getLanguageLevelForSdk(sdk);
|
||||
final VirtualFile[] files = sdk.getRootProvider().getFiles(OrderRootType.CLASSES);
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
PyUtil.invalidateLanguageLevelCache(project);
|
||||
application.executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
application.runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (project != null && project.isDisposed()) {
|
||||
if (project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
for (VirtualFile file : files) {
|
||||
|
||||
Reference in New Issue
Block a user