use Disposer.dispose

This commit is contained in:
Sergey Ignatov
2018-05-14 14:14:18 +03:00
parent 430225d431
commit 39bab822db
7 changed files with 15 additions and 70 deletions
@@ -17,6 +17,7 @@ package org.intellij.images.thumbnail.impl;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import org.intellij.images.thumbnail.ThumbnailManager;
import org.intellij.images.thumbnail.ThumbnailView;
import org.jetbrains.annotations.NotNull;
@@ -44,7 +45,7 @@ final class ThumbnailManagerImpl extends ThumbnailManager implements Disposable
public void dispose() {
if (thumbnailView != null) {
thumbnailView.dispose();
Disposer.dispose(thumbnailView);
thumbnailView = null;
}
}
@@ -1,20 +1,4 @@
/*
* Copyright 2000-2009 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.
*/
/** $Id$ */
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.intellij.images.thumbnail.impl;
@@ -153,7 +137,7 @@ final class ThumbnailViewImpl implements ThumbnailView {
getUI().refresh();
}
else {
getUI().dispose();
Disposer.dispose(getUI());
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.hint;
import com.intellij.codeInsight.CodeInsightActionHandler;
@@ -24,9 +10,9 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.reference.SoftReference;
@@ -68,7 +54,7 @@ public class ShowContainerInfoHandler implements CodeInsightActionHandler {
}
}
finally {
model.dispose();
Disposer.dispose(model);
}
while(true) {
if (container == null || container instanceof PsiFile) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.navigation;
@@ -23,6 +9,7 @@ import com.intellij.ide.structureView.TreeBasedStructureViewBuilder;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.lang.LanguageStructureViewBuilder;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.Disposer;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import gnu.trove.THashSet;
@@ -68,7 +55,7 @@ public class MethodUpDownUtil {
addStructureViewElements(model.getRoot(), array, element);
}
finally {
model.dispose();
Disposer.dispose(model);
}
}
}
@@ -144,7 +144,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
myAsyncTreeModel.setRootImmediately(myStructureTreeModel.getRootImmediately());
myTree = new MyTree(myAsyncTreeModel);
Disposer.register(this, () -> myTreeModelWrapper.dispose());
Disposer.register(this, () -> Disposer.dispose(myTreeModelWrapper));
registerAutoExpandListener(myTree, myTreeModel);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2014 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.structureView.newStructureView;
@@ -21,6 +7,7 @@ import com.intellij.ide.structureView.ModelListener;
import com.intellij.ide.structureView.StructureViewModel;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.util.treeView.smartTree.*;
import com.intellij.openapi.util.Disposer;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -123,7 +110,7 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel
@Override
public void dispose() {
myModel.dispose();
Disposer.dispose(myModel);
}
@Override
@@ -182,7 +182,7 @@ public class FileStructurePopup implements Disposable, TreeActionsOwner {
myAsyncTreeModel.setRootImmediately(myStructureTreeModel.getRootImmediately());
myTree = new MyTree(myAsyncTreeModel);
StructureViewComponent.registerAutoExpandListener(myTree, myTreeModel);
Disposer.register(this, () -> myTreeModelWrapper.dispose());
Disposer.register(this, () -> Disposer.dispose(myTreeModelWrapper));
ModelListener modelListener = () -> rebuild(false);
myTreeModel.addModelListener(modelListener);