mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
reduce usage of ApplicationComponent.disposeComponent (to dispose in a correct order (as Disposer))
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -67,7 +67,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
@State(name = "FileBasedIndex", storages = @Storage(value = "stubIndex.xml", roamingType = RoamingType.DISABLED))
|
||||
public class StubIndexImpl extends StubIndex implements ApplicationComponent, PersistentStateComponent<StubIndexState> {
|
||||
public class StubIndexImpl extends StubIndex implements ApplicationComponentAdapter, PersistentStateComponent<StubIndexState> {
|
||||
private static final AtomicReference<Boolean> ourForcedClean = new AtomicReference<>(null);
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.stubs.StubIndexImpl");
|
||||
|
||||
@@ -463,12 +463,6 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "Stub.IndexManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
long started = System.nanoTime();
|
||||
@@ -488,12 +482,12 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
//@Override
|
||||
//public void dispose() {
|
||||
// This index must be disposed only after StubUpdatingIndex is disposed
|
||||
// To ensure this, disposing is done explicitly from StubUpdatingIndex by calling dispose() method
|
||||
// do not call this method here to avoid double-disposal
|
||||
}
|
||||
//}
|
||||
|
||||
public void dispose() {
|
||||
for (UpdatableIndex index : getAsyncState().myIndices.values()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -24,7 +24,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.ex.AnActionListener;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ApplicationComponentAdapter;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.ui.popup.BalloonBuilder;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
@@ -42,7 +42,6 @@ import com.intellij.ui.components.panels.Wrapper;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ui.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -55,7 +54,7 @@ import java.awt.*;
|
||||
import java.awt.event.AWTEventListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
public class IdeTooltipManager implements ApplicationComponent, AWTEventListener {
|
||||
public class IdeTooltipManager implements ApplicationComponentAdapter, Disposable, AWTEventListener {
|
||||
private static final Key<IdeTooltip> CUSTOM_TOOLTIP = Key.create("custom.tooltip");
|
||||
private static final MouseEventAdapter<Void> DUMMY_LISTENER = new MouseEventAdapter<>(null);
|
||||
public static final String IDE_TOOLTIP_PLACE = "IdeTooltip";
|
||||
@@ -512,7 +511,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
public void dispose() {
|
||||
hideCurrentNow(false);
|
||||
if (myLastDisposable != null) {
|
||||
Disposer.dispose(myLastDisposable);
|
||||
@@ -654,12 +653,6 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black), JBUI.Borders.empty(0, 5)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "IDE Tooltip Manager";
|
||||
}
|
||||
|
||||
public boolean isQueuedToShow(IdeTooltip tooltip) {
|
||||
return Comparing.equal(myQueuedTooltip, tooltip);
|
||||
}
|
||||
|
||||
+4
-13
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -16,9 +16,9 @@
|
||||
package com.intellij.openapi.vfs.impl.local;
|
||||
|
||||
import com.intellij.concurrency.JobScheduler;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -43,7 +43,7 @@ import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public final class LocalFileSystemImpl extends LocalFileSystemBase implements ApplicationComponent {
|
||||
public final class LocalFileSystemImpl extends LocalFileSystemBase implements Disposable {
|
||||
private static final String FS_ROOT = "/";
|
||||
private static final int STATUS_UPDATE_PERIOD = 1000;
|
||||
|
||||
@@ -102,19 +102,10 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() { }
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
public void dispose() {
|
||||
myWatcher.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "LocalFileSystem";
|
||||
}
|
||||
|
||||
private List<WatchRequestImpl> normalizeRootsForRefresh() {
|
||||
List<WatchRequestImpl> result = new ArrayList<>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user