Merge remote-tracking branch 'origin/master'

This commit is contained in:
Alexandr Evstigneev
2016-12-19 17:48:22 +03:00
22 changed files with 92 additions and 457 deletions
@@ -1,23 +0,0 @@
/*
* Copyright 2000-2016 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.debugger.engine;
/**
* @author egor
*/
public interface ActionMethodFilter {
int onReached(SuspendContextImpl context, RequestHint hint);
}
@@ -29,7 +29,7 @@ import com.sun.jdi.request.EventRequest;
/**
* @author egor
*/
public class ClassInstanceMethodFilter extends ConstructorStepMethodFilter implements ActionMethodFilter {
public class ClassInstanceMethodFilter extends ConstructorStepMethodFilter {
private final BreakpointStepMethodFilter myMethodFilter;
public ClassInstanceMethodFilter(PsiMethod psiMethod, Range<Integer> lines) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -23,4 +23,8 @@ import org.jetbrains.annotations.Nullable;
public interface MethodFilter {
boolean locationMatches(DebugProcessImpl process, Location location) throws EvaluateException;
@Nullable Range<Integer> getCallingExpressionLines();
default int onReached(SuspendContextImpl context, RequestHint hint) {
return RequestHint.STOP;
}
}
@@ -180,13 +180,6 @@ public class RequestHint {
}
}
private int reached(MethodFilter filter, SuspendContextImpl context) {
if (filter instanceof ActionMethodFilter) {
return ((ActionMethodFilter)filter).onReached(context, this);
}
return STOP;
}
protected boolean isSteppedOut() {
return mySteppedOut;
}
@@ -203,7 +196,7 @@ public class RequestHint {
!isTheSameFrame(context)
) {
myTargetMethodMatched = true;
return reached(myMethodFilter, context);
return myMethodFilter.onReached(context, this);
}
if ((myDepth == StepRequest.STEP_OVER || myDepth == StepRequest.STEP_INTO) && myPosition != null) {
@@ -20,7 +20,6 @@ import com.intellij.util.indexing.InvertedIndex;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.backwardRefs.index.CompiledFileData;
import org.jetbrains.jps.builders.java.JavaBuilderUtil;
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
import org.jetbrains.jps.incremental.CompileContext;
@@ -64,7 +63,7 @@ public class BackwardReferenceIndexWriter {
final BuildDataManager dataManager = context.getProjectDescriptor().dataManager;
final File buildDir = dataManager.getDataPaths().getDataStorageRoot();
if (isEnabled()) {
boolean isRebuild = JavaBuilderUtil.isForcedRecompilationAllJavaModules(context);
boolean isRebuild = isRebuildInAllJavaModules(context);
if (!JavaCompilers.JAVAC_ID.equals(JavaBuilder.getUsedCompilerId(context))) {
CompilerBackwardReferenceIndex.removeIndexFiles(buildDir);
@@ -162,6 +161,17 @@ public class BackwardReferenceIndexWriter {
return nameEnumerator.enumerate(name);
}
private static boolean isRebuildInAllJavaModules(CompileContext context) {
for (JavaModuleBuildTargetType type : JavaModuleBuildTargetType.ALL_TYPES) {
for (ModuleBuildTarget target : context.getProjectDescriptor().getBuildTargetIndex().getAllTargets(type)) {
if (!context.getScope().isBuildForced(target)) {
return false;
}
}
}
return true;
}
private static boolean areAllJavaModulesAffected(CompileContext context) {
for (JavaModuleBuildTargetType type : JavaModuleBuildTargetType.ALL_TYPES) {
for (ModuleBuildTarget target : context.getProjectDescriptor().getBuildTargetIndex().getAllTargets(type)) {
@@ -67,7 +67,7 @@ public class CompileScopeImpl extends CompileScope {
@Override
public boolean isWholeTargetAffected(@NotNull BuildTarget<?> target) {
return myTypes.contains(target.getTargetType()) || myTargets.contains(target) || isAffectedByAssociatedModule(target);
return (myTypes.contains(target.getTargetType()) || myTargets.contains(target) || isAffectedByAssociatedModule(target)) && !myFiles.containsKey(target);
}
@Override
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.javac.ast.api.JavacDef;
import org.jetbrains.jps.javac.ast.api.JavacFileData;
import org.jetbrains.jps.javac.ast.api.JavacRef;
import org.jetbrains.jps.javac.ast.api.NameTableCache;
import org.jetbrains.jps.javac.ast.api.JavacNameTable;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
@@ -49,7 +49,7 @@ final class JavacReferenceCollectorListener implements TaskListener {
private final Elements myElementUtility;
private final Types myTypeUtility;
private final Trees myTreeUtility;
private final NameTableCache myNameTableCache;
private final JavacNameTable myNameTableCache;
private NotNullLazyValue<Name> myAsterisk = new NotNullLazyValue<Name>() {
@NotNull
@@ -98,7 +98,7 @@ final class JavacReferenceCollectorListener implements TaskListener {
myTypeUtility = typeUtility;
myTreeUtility = treeUtility;
myAstScanner = JavacTreeRefScanner.createASTScanner();
myNameTableCache = new NameTableCache(elementUtility);
myNameTableCache = new JavacNameTable(elementUtility);
}
@Override
@@ -23,18 +23,24 @@ import javax.lang.model.element.Name;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
public class NameTableCache extends SLRUCache<Name, String> {
public class JavacNameTable {
private final SLRUCache<Name, String> myParsedNameCache;
private final Elements myElements;
public NameTableCache(Elements elements) {
super(1000, 1000);
public JavacNameTable(Elements elements) {
myParsedNameCache = new SLRUCache<Name, String>(1000, 1000) {
@NotNull
@Override
public String createValue(Name key) {
return key.toString();
}
};
myElements = elements;
}
@NotNull
@Override
public String createValue(Name name) {
return name.toString();
public String parseName(Name name) {
return myParsedNameCache.get(name);
}
public Name getBinaryName(Element element) {
@@ -120,9 +120,9 @@ public interface JavacRef {
abstract class JavacElementRefBase implements JavacRef {
protected final @NotNull Element myOriginalElement;
protected final NameTableCache myNameTableCache;
protected final JavacNameTable myNameTableCache;
protected JavacElementRefBase(@NotNull Element element, NameTableCache nameTableCache) {
protected JavacElementRefBase(@NotNull Element element, JavacNameTable nameTableCache) {
myOriginalElement = element;
myNameTableCache = nameTableCache;
}
@@ -135,7 +135,7 @@ public interface JavacRef {
@NotNull
@Override
public String getName() {
return myNameTableCache.get(myOriginalElement.getSimpleName());
return myNameTableCache.parseName(myOriginalElement.getSimpleName());
}
@Override
@@ -146,10 +146,10 @@ public interface JavacRef {
@NotNull
@Override
public String getOwnerName() {
return myNameTableCache.get(myNameTableCache.getBinaryName(myOriginalElement.getEnclosingElement()));
return myNameTableCache.parseName(myNameTableCache.getBinaryName(myOriginalElement.getEnclosingElement()));
}
public static JavacElementRefBase fromElement(Element element, NameTableCache nameTableCache) {
public static JavacElementRefBase fromElement(Element element, JavacNameTable nameTableCache) {
if (element instanceof TypeElement) {
return new JavacElementClassImpl(element, nameTableCache);
}
@@ -164,24 +164,24 @@ public interface JavacRef {
}
class JavacElementClassImpl extends JavacElementRefBase implements JavacClass {
public JavacElementClassImpl(@NotNull Element element, NameTableCache nameTableCache) {
public JavacElementClassImpl(@NotNull Element element, JavacNameTable nameTableCache) {
super(element, nameTableCache);
}
@NotNull
@Override
public String getName() {
return myNameTableCache.get(myNameTableCache.getBinaryName(myOriginalElement));
return myNameTableCache.parseName(myNameTableCache.getBinaryName(myOriginalElement));
}
@Override
public boolean isAnonymous() {
return myNameTableCache.get(myOriginalElement.getSimpleName()).isEmpty();
return myNameTableCache.parseName(myOriginalElement.getSimpleName()).isEmpty();
}
}
class JavacElementMethodImpl extends JavacElementRefBase implements JavacMethod {
public JavacElementMethodImpl(@NotNull Element element, NameTableCache nameTableCache) {
public JavacElementMethodImpl(@NotNull Element element, JavacNameTable nameTableCache) {
super(element, nameTableCache);
}
@@ -192,7 +192,7 @@ public interface JavacRef {
}
class JavacElementFieldImpl extends JavacElementRefBase implements JavacField {
public JavacElementFieldImpl(@NotNull Element element, NameTableCache nameTableCache) {
public JavacElementFieldImpl(@NotNull Element element, JavacNameTable nameTableCache) {
super(element, nameTableCache);
}
}
@@ -23,7 +23,6 @@ import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleComponent;
import com.intellij.openapi.project.ModuleListener;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
@@ -33,7 +32,6 @@ import com.intellij.openapi.util.WriteExternalException;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashSet;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -42,10 +40,9 @@ import java.util.Collection;
import java.util.List;
import java.util.Set;
@State(name = ModuleRunConfigurationManager.COMPONENT_NAME)
public final class ModuleRunConfigurationManager implements ModuleComponent, ModuleListener, PersistentStateComponent<Element> {
@State(name = "ModuleRunConfigurationManager")
public final class ModuleRunConfigurationManager implements PersistentStateComponent<Element> {
private static final Logger LOG = Logger.getInstance(ModuleRunConfigurationManager.class);
@NonNls static final String COMPONENT_NAME = "ModuleRunConfigurationManager";
@NotNull
private final Condition<RunnerAndConfigurationSettings> myModuleConfigCondition =
settings -> settings != null && usesMyModule(settings.getConfiguration());
@@ -59,34 +56,18 @@ public final class ModuleRunConfigurationManager implements ModuleComponent, Mod
public ModuleRunConfigurationManager(@NotNull final Module module, @NotNull final RunManagerImpl runManager) {
myModule = module;
myManager = runManager;
}
@Override
public void projectOpened() {
}
@Override
public void projectClosed() {
}
@Override
public void moduleAdded() {
}
@Override
public void initComponent() {
LOG.debug("initComponent(" + myModule + ")");
myModule.getMessageBus().connect(myModule).subscribe(ProjectTopics.MODULES, this);
}
@Override
public void disposeComponent() {
}
@NotNull
@Override
public String getComponentName() {
return COMPONENT_NAME;
myModule.getMessageBus().connect().subscribe(ProjectTopics.MODULES, new ModuleListener() {
@Override
public void beforeModuleRemoved(@NotNull Project project, @NotNull Module module) {
if (myModule.equals(module)) {
LOG.debug("time to remove something from project (" + project + ")");
for (final RunnerAndConfigurationSettings settings : getModuleRunConfigurationSettings()) {
myManager.removeConfiguration(settings);
}
}
}
});
}
@Nullable
@@ -135,14 +116,13 @@ public final class ModuleRunConfigurationManager implements ModuleComponent, Mod
}
}
public void readExternal(@NotNull final Element element) throws InvalidDataException {
public void readExternal(@NotNull final Element element) {
LOG.debug("readExternal(" + myModule + ")");
myUnloadedElements = null;
final Set<String> existing = new HashSet<>();
final List children = element.getChildren();
for (final Object child : children) {
final RunnerAndConfigurationSettings configuration = myManager.loadConfiguration((Element)child, true);
for (final Element child : element.getChildren()) {
final RunnerAndConfigurationSettings configuration = myManager.loadConfiguration(child, true);
if (configuration == null && Comparing.strEqual(element.getName(), RunManagerImpl.CONFIGURATION)) {
if (myUnloadedElements == null) myUnloadedElements = new ArrayList<>(2);
myUnloadedElements.add(element);
@@ -156,8 +136,9 @@ public final class ModuleRunConfigurationManager implements ModuleComponent, Mod
for (final RunConfiguration configuration : myManager.getAllConfigurationsList()) {
if (!usesMyModule(configuration)) {
RunnerAndConfigurationSettings settings = myManager.getSettings(configuration);
if (settings != null)
if (settings != null) {
existing.add(settings.getUniqueID());
}
}
}
myManager.removeNotExistingSharedConfigurations(existing);
@@ -166,14 +147,4 @@ public final class ModuleRunConfigurationManager implements ModuleComponent, Mod
myManager.setOrdered(false);
myManager.getSortedConfigurations();
}
@Override
public void beforeModuleRemoved(@NotNull Project project, @NotNull Module module) {
if (myModule.equals(module)) {
LOG.debug("time to remove something from project (" + project + ")");
for (final RunnerAndConfigurationSettings settings : getModuleRunConfigurationSettings()) {
myManager.removeConfiguration(settings);
}
}
}
}
@@ -1,298 +0,0 @@
/*
* 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.impl;
import com.intellij.ProjectTopics;
import com.intellij.execution.*;
import com.intellij.execution.configuration.EmptyRunProfileState;
import com.intellij.execution.configurations.*;
import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.runners.GenericProgramRunner;
import com.intellij.execution.runners.RunContentBuilder;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.testFramework.LightPlatformTestCase;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.ui.UIUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jmock.Expectations;
import org.jmock.Mockery;
import javax.swing.*;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class ModuleRunConfigurationManagerTest extends LightPlatformTestCase {
private ModuleRunConfigurationManager myManager;
private final Mockery context = new Mockery();
private Module myModule;
private Collection<? extends RunnerAndConfigurationSettings> myConfigurations;
private final List<RunnerAndConfigurationSettings> myRemovedSettings = ContainerUtil.newArrayList();
private RunnerAndConfigurationSettings mySettings;
private final List<RunnerAndConfigurationSettings> myAddedElements = ContainerUtil.newArrayList();
@Override
public void setUp() throws Exception {
super.setUp();
myModule = context.mock(Module.class, "myModule");
context.checking(new Expectations() {{
allowing(myModule).getName(); will(returnValue("my-module"));
}});
myManager = new ModuleRunConfigurationManager(myModule, new MyRunManagerImpl());
mySettings = createSettings("my-module-run", new MyModuleBasedConfiguration("my-module-run-config", getProject(), myModule));
final List<? extends RunnerAndConfigurationSettings> configs = ContainerUtil.newArrayList(
createSettings("other-run", context.mock(RunConfiguration.class, "other-run-run-config")),
createSettings("other-module-run", new MyModuleBasedConfiguration("other-module-run-config", getProject(), getModule())),
mySettings
);
myConfigurations = Collections.unmodifiableCollection(configs);
}
@NotNull
private RunnerAndConfigurationSettings createSettings(@NotNull final String name, @NotNull final RunConfiguration runConfiguration) {
final RunnerAndConfigurationSettings settings = context.mock(RunnerAndConfigurationSettings.class, name);
context.checking(new Expectations() {{
allowing(settings).getConfiguration(); will(returnValue(runConfiguration));
}});
return settings;
}
@Override
public void tearDown() throws Exception {
try {
ExecutionTestUtil.terminateAllRunningDescriptors(ExecutionManager.getInstance(getProject()));
myManager = null;
}
finally {
super.tearDown();
}
}
public void testInitComponentSubscribesForModulesTopic() throws Exception {
context.checking(new Expectations() {{
final MessageBus messageBus = context.mock(MessageBus.class, "messageBus");
final MessageBusConnection messageBusConnection = context.mock(MessageBusConnection.class, "messageBusConnection");
oneOf(myModule).getMessageBus();
will(returnValue(messageBus));
oneOf(messageBus).connect(myModule); will(returnValue(messageBusConnection));
oneOf(messageBusConnection).subscribe(ProjectTopics.MODULES, myManager);
}});
myManager.initComponent();
context.assertIsSatisfied();
}
public void testGetState() throws Exception {
myAddedElements.clear();
myManager.getState();
assertSameElements("One config should be added to state", myAddedElements, Collections.singleton(mySettings));
}
public void testBeforeOtherModuleRemoved() throws Exception {
myRemovedSettings.clear();
myManager.beforeModuleRemoved(getProject(), getModule());
assertEmpty("No settings should be removed", myRemovedSettings);
}
public void testBeforeMyModuleRemoved() throws Exception {
myRemovedSettings.clear();
myManager.beforeModuleRemoved(getProject(), myModule);
assertSameElements("one run config should be removed", myRemovedSettings, Collections.singleton(mySettings));
}
public void testSuppressToolwindowActivation() throws Exception {
RunnerAndConfigurationSettings settings = new RunnerAndConfigurationSettingsImpl(
new MyRunManagerImpl(), new MyModuleBasedConfiguration("my-name", getProject(), getModule()), false
);
settings.setActivateToolWindowBeforeRun(true);
MockProgramRunner programRunner = new MockProgramRunner();
ExecutionEnvironment env = new ExecutionEnvironmentBuilder(getProject(), DefaultRunExecutor.getRunExecutorInstance())
.runnerAndSettings(programRunner, settings)
.build();
RunContentDescriptor descriptorToReuse = new RunContentDescriptor(null, null, new JPanel(), "name");
descriptorToReuse.setActivateToolWindowWhenAdded(false);
descriptorToReuse.setReuseToolWindowActivation(true);
env.setContentToReuse(descriptorToReuse);
ExecutionManager executionManager = ExecutionManager.getInstance(getProject());
executionManager.restartRunProfile(env);
UIUtil.dispatchAllInvocationEvents();
RunContentDescriptor lastDescriptor = ExecutionTestUtil.getSingleRunContentDescriptor(executionManager);
assertFalse(lastDescriptor.isActivateToolWindowWhenAdded());
Disposer.dispose(descriptorToReuse);
}
private static final class MyRunConfigurationModule extends RunConfigurationModule {
private final Module myModule;
public MyRunConfigurationModule(@NotNull final Project project, @NotNull final Module module) {
super(project);
setModule(module);
myModule = module;
}
@Nullable
@Override
public Module getModule() {
return myModule;
}
}
private final class MyRunManagerImpl extends RunManagerImpl {
public MyRunManagerImpl() {
super(LightPlatformTestCase.getProject(), PropertiesComponent.getInstance(LightPlatformTestCase.getProject()));
}
@NotNull
@Override
Collection<? extends RunnerAndConfigurationSettings> getConfigurationSettings() {
return myConfigurations;
}
@Override
public void removeConfiguration(@Nullable RunnerAndConfigurationSettings settings) {
myRemovedSettings.add(settings);
}
@Override
void addConfigurationElement(@NotNull Element parentNode, RunnerAndConfigurationSettings template) {
myAddedElements.add(template);
}
}
private static final class MyModuleBasedConfiguration extends ModuleBasedConfiguration<RunConfigurationModule> {
public MyModuleBasedConfiguration(@NotNull final String name, @NotNull final Project project, @NotNull final Module module) {
super(name, new MyRunConfigurationModule(project, module), new MockConfigurationFactory());
}
@Override
public Collection<Module> getValidModules() {
return null;
}
@NotNull
@Override
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
return null;
}
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
return EmptyRunProfileState.INSTANCE;
}
}
private static class MockConfigurationFactory extends ConfigurationFactory {
public MockConfigurationFactory() {
super(new MyConfigurationType());
}
@Override
public RunConfiguration createTemplateConfiguration(Project project) {
throw new UnsupportedOperationException("Not Implemented");
}
}
private static class MyConfigurationType implements ConfigurationType {
@Override
public String getDisplayName() {
return "mock";
}
@Override
public String getConfigurationTypeDescription() {
return "mock type";
}
@Override
public Icon getIcon() {
return null;
}
@Override
@NotNull
public String getId() {
return "MockRuntimeConfiguration";
}
@Override
public ConfigurationFactory[] getConfigurationFactories() {
return new ConfigurationFactory[0];
}
}
private static class MockProgramRunner extends GenericProgramRunner {
private RunContentDescriptor myLastDescriptor;
@NotNull
@Override
public String getRunnerId() {
return "MockProgramRunner";
}
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
ExecutionResult executionResult = new DefaultExecutionResult(null, new NopProcessHandler());
myLastDescriptor = new RunContentBuilder(executionResult, env).showRunContent(env.getContentToReuse());
return myLastDescriptor;
}
@Override
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
return true;
}
public RunContentDescriptor getLastDescriptor() {
return myLastDescriptor;
}
}
public static class NopProcessHandler extends ProcessHandler {
@Override
protected void destroyProcessImpl() {
notifyProcessTerminated(0);
}
@Override
protected void detachProcessImpl() {
}
@Override
public boolean detachIsDefault() {
return false;
}
@Nullable
@Override
public OutputStream getProcessInput() {
return null;
}
}
}
@@ -17,6 +17,7 @@ package com.intellij.ui.components;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.ui.ComponentSettings;
import com.intellij.util.SystemProperties;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -193,7 +194,9 @@ public class SmoothScrollPane extends JScrollPane {
protected SmoothScrollBar(int orientation) {
super(orientation);
setModel(new SmoothBoundedRangeModel(this));
if (SystemProperties.isTrueSmoothScrollingEnabled()) {
setModel(new SmoothBoundedRangeModel(this));
}
}
@Override
@@ -2690,7 +2690,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
private MyScrollBar(@JdkConstants.AdjustableOrientation int orientation) {
super(orientation);
setPersistentUI(createEditorScrollbarUI(EditorImpl.this));
setModel(new SmoothBoundedRangeModel(this));
if (SystemProperties.isTrueSmoothScrollingEnabled()) {
setModel(new SmoothBoundedRangeModel(this));
}
}
void setPersistentUI(ScrollBarUI ui) {
@@ -76,12 +76,7 @@ public class CoreModule extends MockComponentManager implements ModuleEx {
loadState(object, false);
}
};
Disposer.register(parentDisposable, new Disposable() {
@Override
public void dispose() {
moduleRootManager.disposeComponent();
}
});
Disposer.register(parentDisposable, moduleRootManager);
getPicoContainer().registerComponentInstance(ModuleRootManager.class, moduleRootManager);
getPicoContainer().registerComponentInstance(PathMacroManager.class, createModulePathMacroManager(project));
getPicoContainer().registerComponentInstance(ModuleFileIndex.class, createModuleFileIndex(project));
@@ -16,7 +16,6 @@
package com.intellij.openapi.components.impl.stores;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.util.ReflectionUtil;
@@ -47,13 +46,8 @@ public class DefaultStateSerializer {
}
T t = ReflectionUtil.newInstance(stateClass);
try {
((JDOMExternalizable)t).readExternal(stateElement);
return t;
}
catch (InvalidDataException e) {
throw new RuntimeException(e);
}
((JDOMExternalizable)t).readExternal(stateElement);
return t;
}
else if (mergeInto == null) {
return XmlSerializer.deserialize(stateElement, stateClass);
@@ -39,6 +39,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.StandardFileSystems;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.SmartList;
import com.intellij.util.concurrency.AppExecutorUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
@@ -223,7 +224,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
progressIndicator.setText("Loading modules...");
progressIndicator.setText2("");
List<Module> modulesWithUnknownTypes = new ArrayList<>();
List<Module> modulesWithUnknownTypes = new SmartList<>();
List<ModuleLoadingErrorDescription> errors = Collections.synchronizedList(new ArrayList<>());
ModuleGroupInterner groupInterner = new ModuleGroupInterner();
@@ -898,9 +899,8 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
}
public void projectClosed() {
for (Module aCollection : myModules.values()) {
ModuleEx module = (ModuleEx)aCollection;
module.projectClosed();
for (Module module : myModules.values()) {
((ModuleEx)module).projectClosed();
}
}
@@ -13,14 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.roots.impl;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.*;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.*;
@@ -42,8 +45,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleComponent {
public class ModuleRootManagerImpl extends ModuleRootManager implements Disposable {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.ModuleRootManagerImpl");
private final Module myModule;
@@ -52,7 +54,6 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
private RootModelImpl myRootModel;
private boolean myIsDisposed = false;
private boolean myLoaded = false;
private boolean isModuleAdded = false;
private final OrderRootsCache myOrderRootsCache;
private final Map<RootModelImpl, Throwable> myModelCreations = new THashMap<>();
@@ -81,17 +82,7 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
}
@Override
@NotNull
public String getComponentName() {
return "NewModuleRootManager";
}
@Override
public void initComponent() {
}
@Override
public void disposeComponent() {
public void dispose() {
myRootModel.dispose();
myIsDisposed = true;
@@ -108,7 +99,6 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
}
}
@Override
@NotNull
public ModifiableRootModel getModifiableModel() {
@@ -140,7 +130,7 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
void makeRootsChange(@NotNull Runnable runnable) {
ProjectRootManagerEx projectRootManagerEx = (ProjectRootManagerEx)ProjectRootManager.getInstance(myModule.getProject());
// IMPORTANT: should be the first listener!
projectRootManagerEx.makeRootsChange(runnable, false, isModuleAdded);
projectRootManagerEx.makeRootsChange(runnable, false, myModule.isLoaded());
}
public RootModelImpl getRootModel() {
@@ -318,20 +308,6 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
return myRootModel.getSourceRoots(rootTypes);
}
@Override
public void projectOpened() {
}
@Override
public void projectClosed() {
}
@Override
public void moduleAdded() {
isModuleAdded = true;
}
public void dropCaches() {
myOrderRootsCache.clearCache();
}
@@ -341,7 +317,7 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
}
public void loadState(ModuleRootManagerState object) {
loadState(object, myLoaded || isModuleAdded);
loadState(object, myLoaded || myModule.isLoaded());
myLoaded = true;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.vcs.log;
package com.intellij.vcs.log.util;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Function;
import org.jetbrains.annotations.NotNull;
public class UserNameRegex implements Function<String, String> {
@NotNull public static final UserNameRegex BASIC_INSTANCE = new UserNameRegex(false);
@NotNull public static final UserNameRegex EXTENDED_INSTANCE = new UserNameRegex(true);
@NotNull private static final char[] BASIC_REGEX_CHARS = new char[]{'.', '^', '$', '*', '[', ']'};
@NotNull public static final char[] EXTENDED_REGEX_CHARS = new char[]{'.', '^', '$', '*', '+', '-', '?', '(', ')', '[', ']', '{', '}', '|'};
@@ -25,6 +25,7 @@ import com.intellij.util.containers.MultiMap;
import com.intellij.vcs.log.impl.HashImpl;
import com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder;
import com.intellij.vcs.log.impl.VcsLogUserFilterImpl;
import com.intellij.vcs.log.util.UserNameRegex;
import com.intellij.vcs.log.util.VcsUserUtil;
import junit.framework.TestCase;
import org.jetbrains.annotations.NotNull;
@@ -38,6 +38,7 @@ import com.intellij.vcs.log.graph.impl.facade.PermanentGraphImpl;
import com.intellij.vcs.log.impl.HashImpl;
import com.intellij.vcs.log.impl.LogDataImpl;
import com.intellij.vcs.log.util.StopWatch;
import com.intellij.vcs.log.util.UserNameRegex;
import com.intellij.vcsUtil.VcsFileUtil;
import git4idea.*;
import git4idea.branch.GitBranchUtil;
@@ -2,7 +2,7 @@
<body>
This inspection reports any instances of empty <b><font color="#000080">try</font></b> blocks in Groovy code. Empty <b><font
color="#000080">finally</font></b> blocks
color="#000080">try</font></b> blocks
usually indicate coding errors.
<br>
<small>Powered by InspectorGroovy</small>
@@ -31,6 +31,7 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.vcs.log.*;
import com.intellij.vcs.log.impl.LogDataImpl;
import com.intellij.vcs.log.util.UserNameRegex;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.zmlx.hg4idea.HgNameWithHashInfo;