mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Build tw] cleanup scheduled for removal api
GitOrigin-RevId: 5865e40acd31af9587226302a269c295367ce2ad
This commit is contained in:
committed by
intellij-monorepo-bot
parent
112d905b23
commit
51ada9381a
@@ -1,43 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2019 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-2020 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.build;
|
||||
|
||||
import com.intellij.build.events.BuildEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
public interface BuildProgressListener {
|
||||
|
||||
/**
|
||||
* @deprecated do not use it, it's only for compatibility reason
|
||||
*/
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2020.1")
|
||||
@Deprecated
|
||||
Object UNKNOWN_BUILD_ID = new Object();
|
||||
|
||||
/**
|
||||
* @param event
|
||||
* @deprecated use {@link #onEvent(Object, BuildEvent)}
|
||||
*/
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2020.1")
|
||||
@Deprecated
|
||||
default void onEvent(@NotNull BuildEvent event) { onEvent(UNKNOWN_BUILD_ID, event);}
|
||||
|
||||
void onEvent(@NotNull Object buildId, @NotNull BuildEvent event);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.ui.SystemNotifications;
|
||||
import com.intellij.ui.UIBundle;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentManager;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.DisposableWrapperList;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
@@ -32,10 +31,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.intellij.build.ExecutionNode.getEventResultIcon;
|
||||
|
||||
@@ -53,8 +52,6 @@ public abstract class AbstractViewManager implements ViewManager, BuildProgressL
|
||||
private final AtomicClearableLazyValue<MultipleBuildsView> myBuildsViewValue;
|
||||
private final Set<MultipleBuildsView> myPinnedViews;
|
||||
private final AtomicBoolean isDisposed = new AtomicBoolean(false);
|
||||
// todo [Vlad] remove the map when BuildProgressListener.onEvent(BuildEvent) method will be removed
|
||||
private final Map<Object, Object> idsMap = new ConcurrentHashMap<>();
|
||||
private final DisposableWrapperList<BuildProgressListener> myListeners = new DisposableWrapperList<>();
|
||||
|
||||
public AbstractViewManager(Project project) {
|
||||
@@ -96,19 +93,6 @@ public abstract class AbstractViewManager implements ViewManager, BuildProgressL
|
||||
public void onEvent(@NotNull Object buildId, @NotNull BuildEvent event) {
|
||||
if (isDisposed.get()) return;
|
||||
|
||||
//noinspection deprecation
|
||||
if (buildId == UNKNOWN_BUILD_ID) {
|
||||
Object buildIdCandidate = event instanceof StartBuildEvent ? event.getId() :
|
||||
idsMap.get(ObjectUtils.notNull(event.getParentId(), event.getId()));
|
||||
if (buildIdCandidate == null) {
|
||||
return;
|
||||
}
|
||||
buildId = buildIdCandidate;
|
||||
if (event instanceof StartEvent) {
|
||||
idsMap.put(event.getId(), buildId);
|
||||
}
|
||||
}
|
||||
|
||||
MultipleBuildsView buildsView;
|
||||
if (event instanceof StartBuildEvent) {
|
||||
configurePinnedContent();
|
||||
@@ -165,7 +149,6 @@ public abstract class AbstractViewManager implements ViewManager, BuildProgressL
|
||||
}
|
||||
|
||||
protected void onBuildFinish(BuildDescriptor buildDescriptor) {
|
||||
clearIdsOf(Collections.singleton(buildDescriptor));
|
||||
BuildInfo buildInfo = (BuildInfo)buildDescriptor;
|
||||
if (buildInfo.result instanceof FailureResult) {
|
||||
boolean activate = buildInfo.isActivateToolWindowWhenFailed();
|
||||
@@ -188,7 +171,6 @@ public abstract class AbstractViewManager implements ViewManager, BuildProgressL
|
||||
isDisposed.set(true);
|
||||
myPinnedViews.clear();
|
||||
myBuildsViewValue.drop();
|
||||
idsMap.clear();
|
||||
}
|
||||
|
||||
void onBuildsViewRemove(@NotNull MultipleBuildsView buildsView) {
|
||||
@@ -200,14 +182,6 @@ public abstract class AbstractViewManager implements ViewManager, BuildProgressL
|
||||
else {
|
||||
myPinnedViews.remove(buildsView);
|
||||
}
|
||||
|
||||
clearIdsOf(buildsView.getBuildsMap().keySet());
|
||||
}
|
||||
|
||||
private void clearIdsOf(@NotNull Collection<? extends BuildDescriptor> builds) {
|
||||
if (idsMap.isEmpty()) return;
|
||||
Set<?> ids = builds.stream().map(BuildDescriptor::getId).collect(Collectors.toSet());
|
||||
idsMap.values().removeIf(val -> ids.contains(val));
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
Reference in New Issue
Block a user