From 51ada9381a3f1f348a90b9103cd53a1019d35dba Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Tue, 16 Jun 2020 09:06:35 +0300 Subject: [PATCH] [Build tw] cleanup scheduled for removal api GitOrigin-RevId: 5865e40acd31af9587226302a269c295367ce2ad --- .../intellij/build/BuildProgressListener.java | 33 +------------------ .../intellij/build/AbstractViewManager.java | 32 ++---------------- 2 files changed, 4 insertions(+), 61 deletions(-) diff --git a/platform/lang-api/src/com/intellij/build/BuildProgressListener.java b/platform/lang-api/src/com/intellij/build/BuildProgressListener.java index ca8a474b2671..b6b6a5fe4d54 100644 --- a/platform/lang-api/src/com/intellij/build/BuildProgressListener.java +++ b/platform/lang-api/src/com/intellij/build/BuildProgressListener.java @@ -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); } diff --git a/platform/lang-impl/src/com/intellij/build/AbstractViewManager.java b/platform/lang-impl/src/com/intellij/build/AbstractViewManager.java index 6803b1cca31c..2d2f75183300 100644 --- a/platform/lang-impl/src/com/intellij/build/AbstractViewManager.java +++ b/platform/lang-impl/src/com/intellij/build/AbstractViewManager.java @@ -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 myBuildsViewValue; private final Set myPinnedViews; private final AtomicBoolean isDisposed = new AtomicBoolean(false); - // todo [Vlad] remove the map when BuildProgressListener.onEvent(BuildEvent) method will be removed - private final Map idsMap = new ConcurrentHashMap<>(); private final DisposableWrapperList 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 builds) { - if (idsMap.isEmpty()) return; - Set ids = builds.stream().map(BuildDescriptor::getId).collect(Collectors.toSet()); - idsMap.values().removeIf(val -> ids.contains(val)); } @ApiStatus.Internal