mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[external system api][IJPL-158355] progress event api: converted ExternalSystemProgressEvent to Kotlin
GitOrigin-RevId: 99de1dbb062fb9fa64de6cc856d08a694d969b12
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1a05d17750
commit
fb737d1fd4
@@ -897,36 +897,37 @@ f:com.intellij.openapi.externalSystem.model.task.TaskData
|
||||
- com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationEvent
|
||||
- <init>(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId,com.intellij.build.events.BuildEvent):V
|
||||
- getBuildEvent():com.intellij.build.events.BuildEvent
|
||||
c:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemFinishEvent
|
||||
f:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemFinishEvent
|
||||
- com.intellij.openapi.externalSystem.model.task.event.ExternalSystemProgressEvent
|
||||
- <init>(java.lang.String,java.lang.String,com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor,com.intellij.openapi.externalSystem.model.task.event.OperationResult):V
|
||||
- getOperationResult():com.intellij.openapi.externalSystem.model.task.event.OperationResult
|
||||
c:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemMessageEvent
|
||||
- f:getOperationResult():com.intellij.openapi.externalSystem.model.task.event.OperationResult
|
||||
f:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemMessageEvent
|
||||
- com.intellij.openapi.externalSystem.model.task.event.ExternalSystemProgressEvent
|
||||
- <init>(java.lang.String,java.lang.String,com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor,java.lang.String):V
|
||||
- <init>(java.lang.String,java.lang.String,com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor,Z,java.lang.String,java.lang.String):V
|
||||
- getDescription():java.lang.String
|
||||
- getMessage():java.lang.String
|
||||
- isStdOut():Z
|
||||
- f:getDescription():java.lang.String
|
||||
- f:getMessage():java.lang.String
|
||||
- f:isStdOut():Z
|
||||
c:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemProgressEvent
|
||||
- java.io.Serializable
|
||||
- <init>(java.lang.String,java.lang.String,com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor):V
|
||||
- getDescriptor():com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor
|
||||
- getDisplayName():java.lang.String
|
||||
- getEventId():java.lang.String
|
||||
- getEventTime():J
|
||||
- getParentEventId():java.lang.String
|
||||
c:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemStartEvent
|
||||
- f:getDescriptor():com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor
|
||||
- f:getDisplayName():java.lang.String
|
||||
- f:getEventId():java.lang.String
|
||||
- f:getEventTime():J
|
||||
- f:getParentEventId():java.lang.String
|
||||
f:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemStartEvent
|
||||
- com.intellij.openapi.externalSystem.model.task.event.ExternalSystemProgressEvent
|
||||
- <init>(java.lang.String,java.lang.String,com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor):V
|
||||
c:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemStatusEvent
|
||||
f:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemStatusEvent
|
||||
- com.intellij.openapi.externalSystem.model.task.event.ExternalSystemProgressEvent
|
||||
- <init>(java.lang.String,java.lang.String,com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor,J,J,java.lang.String):V
|
||||
- <init>(java.lang.String,java.lang.String,com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor,J,J,java.lang.String,java.lang.String):V
|
||||
- getDescription():java.lang.String
|
||||
- getProgress():J
|
||||
- getTotal():J
|
||||
- getUnit():java.lang.String
|
||||
- b:<init>(java.lang.String,java.lang.String,com.intellij.openapi.externalSystem.model.task.event.OperationDescriptor,J,J,java.lang.String,java.lang.String,I,kotlin.jvm.internal.DefaultConstructorMarker):V
|
||||
- f:getDescription():java.lang.String
|
||||
- f:getProgress():J
|
||||
- f:getTotal():J
|
||||
- f:getUnit():java.lang.String
|
||||
c:com.intellij.openapi.externalSystem.model.task.event.ExternalSystemTaskExecutionEvent
|
||||
- com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationEvent
|
||||
- <init>(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId,com.intellij.openapi.externalSystem.model.task.event.ExternalSystemProgressEvent):V
|
||||
|
||||
-40
@@ -1,40 +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.openapi.externalSystem.model.task.event;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
public class ExternalSystemFinishEvent<T extends OperationDescriptor> extends ExternalSystemProgressEvent<T> {
|
||||
|
||||
@NotNull
|
||||
private final OperationResult myResult;
|
||||
|
||||
public ExternalSystemFinishEvent(@NotNull String eventId,
|
||||
@Nullable String parentEventId,
|
||||
@NotNull T descriptor,
|
||||
@NotNull OperationResult result) {
|
||||
super(eventId, parentEventId, descriptor);
|
||||
myResult = result;
|
||||
}
|
||||
|
||||
public OperationResult getOperationResult() {
|
||||
return myResult;
|
||||
}
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
// Copyright 2000-2021 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.openapi.externalSystem.model.task.event;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An event with textual description.
|
||||
* @param <T>
|
||||
*/
|
||||
public class ExternalSystemMessageEvent<T extends OperationDescriptor> extends ExternalSystemProgressEvent<T> {
|
||||
|
||||
private final boolean myStdOut;
|
||||
private final @Nullable @Nls String myMessage;
|
||||
private final @Nullable String myDescription;
|
||||
|
||||
public ExternalSystemMessageEvent(
|
||||
@NotNull String eventId,
|
||||
@Nullable String parentEventId,
|
||||
@NotNull T descriptor,
|
||||
boolean isStdOut,
|
||||
@Nullable @Nls String message,
|
||||
@Nullable String description
|
||||
) {
|
||||
super(eventId, parentEventId, descriptor);
|
||||
myStdOut = isStdOut;
|
||||
myMessage = message;
|
||||
myDescription = description;
|
||||
}
|
||||
|
||||
public ExternalSystemMessageEvent(@NotNull String eventId,
|
||||
@Nullable String parentEventId,
|
||||
@NotNull T descriptor,
|
||||
@Nullable @NlsSafe String description) {
|
||||
this(eventId, parentEventId, descriptor, true, description, description);
|
||||
}
|
||||
|
||||
public boolean isStdOut() {
|
||||
return myStdOut;
|
||||
}
|
||||
|
||||
public @Nullable String getMessage() {
|
||||
return myMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Textual description of the event.
|
||||
*
|
||||
* @return arbitrary additional information about status update
|
||||
*/
|
||||
public @Nullable String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +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.openapi.externalSystem.model.task.event;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
public class ExternalSystemProgressEvent<T extends OperationDescriptor> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull private final String myEventId;
|
||||
@NotNull private final T myDescriptor;
|
||||
@Nullable private final String myParentEventId;
|
||||
|
||||
public ExternalSystemProgressEvent(@NotNull String eventId,
|
||||
@Nullable String parentEventId,
|
||||
@NotNull T descriptor) {
|
||||
myEventId = eventId;
|
||||
myDescriptor = descriptor;
|
||||
myParentEventId = parentEventId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getEventId() {
|
||||
return myEventId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getParentEventId() {
|
||||
return myParentEventId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public T getDescriptor() {
|
||||
return myDescriptor;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return myDescriptor.getDisplayName();
|
||||
}
|
||||
|
||||
public long getEventTime() {
|
||||
return myDescriptor.getEventTime();
|
||||
}
|
||||
}
|
||||
-28
@@ -1,28 +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.openapi.externalSystem.model.task.event;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
public class ExternalSystemStartEvent<T extends OperationDescriptor> extends ExternalSystemProgressEvent<T> {
|
||||
public ExternalSystemStartEvent(@NotNull String eventId, @Nullable String parentEventId, @NotNull T descriptor) {
|
||||
super(eventId, parentEventId, descriptor);
|
||||
}
|
||||
}
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.openapi.externalSystem.model.task.event;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An event that informs about an interim result of the operation.
|
||||
*
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
public class ExternalSystemStatusEvent<T extends OperationDescriptor> extends ExternalSystemProgressEvent<T> {
|
||||
|
||||
private final long myTotal;
|
||||
private final long myProgress;
|
||||
private final String myUnit;
|
||||
@Nullable
|
||||
private final String myDescription;
|
||||
|
||||
public ExternalSystemStatusEvent(@NotNull String eventId, @Nullable String parentEventId, @NotNull T descriptor,
|
||||
long total, long progress, String unit) {
|
||||
this(eventId, parentEventId, descriptor, total, progress, unit, null);
|
||||
}
|
||||
|
||||
public ExternalSystemStatusEvent(@NotNull String eventId, @Nullable String parentEventId, @NotNull T descriptor,
|
||||
long total, long progress, String unit, @Nullable String description) {
|
||||
super(eventId, parentEventId, descriptor);
|
||||
myTotal = total;
|
||||
myProgress = progress;
|
||||
myUnit = unit;
|
||||
myDescription = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of work already performed by the build operation.
|
||||
*
|
||||
* @return The amount of performed work
|
||||
*/
|
||||
public long getProgress() {
|
||||
return myProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* The total amount of work that the build operation is in the progress of performing, or -1 if not known.
|
||||
*
|
||||
* @return The total amount of work, or -1 if not known.
|
||||
*/
|
||||
public long getTotal() {
|
||||
return myTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* The measure used to express the amount of work.
|
||||
*
|
||||
* @return The measure used to express the amount of work.
|
||||
*/
|
||||
public String getUnit() {
|
||||
return myUnit;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.externalSystem.model.task.event
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import org.jetbrains.annotations.Nls
|
||||
import java.io.Serializable
|
||||
|
||||
open class ExternalSystemProgressEvent<T : OperationDescriptor>(
|
||||
val eventId: String,
|
||||
val parentEventId: String?,
|
||||
val descriptor: T,
|
||||
) : Serializable {
|
||||
|
||||
val displayName: String
|
||||
get() = descriptor.displayName
|
||||
|
||||
val eventTime: Long
|
||||
get() = descriptor.eventTime
|
||||
}
|
||||
|
||||
class ExternalSystemStartEvent<T : OperationDescriptor>(
|
||||
eventId: String,
|
||||
parentEventId: String?,
|
||||
descriptor: T,
|
||||
) : ExternalSystemProgressEvent<T>(eventId = eventId, parentEventId = parentEventId, descriptor = descriptor)
|
||||
|
||||
class ExternalSystemFinishEvent<T : OperationDescriptor>(
|
||||
eventId: String,
|
||||
parentEventId: String?,
|
||||
descriptor: T,
|
||||
val operationResult: OperationResult,
|
||||
) : ExternalSystemProgressEvent<T>(eventId = eventId, parentEventId = parentEventId, descriptor = descriptor)
|
||||
|
||||
/**
|
||||
* An event with textual description.
|
||||
*
|
||||
* @property description Textual description of the event. Arbitrary additional information about status update.
|
||||
*/
|
||||
class ExternalSystemMessageEvent<T : OperationDescriptor>(
|
||||
eventId: String,
|
||||
parentEventId: String?,
|
||||
descriptor: T,
|
||||
val isStdOut: Boolean,
|
||||
val message: @Nls String?,
|
||||
val description: String?,
|
||||
) : ExternalSystemProgressEvent<T>(eventId = eventId, parentEventId = parentEventId, descriptor = descriptor) {
|
||||
|
||||
constructor(
|
||||
eventId: String,
|
||||
parentEventId: String?,
|
||||
descriptor: T,
|
||||
description: @NlsSafe String?,
|
||||
) : this(eventId = eventId,
|
||||
parentEventId = parentEventId,
|
||||
descriptor = descriptor,
|
||||
isStdOut = true,
|
||||
message = description,
|
||||
description = description)
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that informs about an interim result of the operation.
|
||||
*
|
||||
* @property total The total amount of work that the build operation is in the progress of performing, or -1 if not known.
|
||||
* @property progress The amount of work already performed by the build operation.
|
||||
* @property unit The measure used to express the amount of work.
|
||||
*/
|
||||
class ExternalSystemStatusEvent<T : OperationDescriptor> @JvmOverloads constructor(
|
||||
eventId: String,
|
||||
parentEventId: String?,
|
||||
descriptor: T,
|
||||
val total: Long,
|
||||
val progress: Long,
|
||||
val unit: String,
|
||||
val description: String? = null,
|
||||
) : ExternalSystemProgressEvent<T>(eventId = eventId, parentEventId = parentEventId, descriptor = descriptor)
|
||||
+3
-3
@@ -53,9 +53,9 @@ abstract class ExternalSystemTaskProgressIndicatorUpdater {
|
||||
}
|
||||
event is ExternalSystemTaskExecutionEvent && event.progressEvent is ExternalSystemStatusEvent<*> -> {
|
||||
val progressEvent = event.progressEvent as ExternalSystemStatusEvent<*>
|
||||
total = progressEvent.getTotal()
|
||||
progress = progressEvent.getProgress()
|
||||
unit = progressEvent.getUnit()
|
||||
total = progressEvent.total
|
||||
progress = progressEvent.progress
|
||||
unit = progressEvent.unit
|
||||
}
|
||||
else -> return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user