Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
TaskCancellable.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019-2019 Basis Technology Corp. Contact: carrier <at> sleuthkit
5  * <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
8  * use this file except in compliance with the License. You may obtain a copy of
9  * the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16  * License for the specific language governing permissions and limitations under
17  * the License.
18  */
19 package org.sleuthkit.autopsy.progress;
20 
21 import java.util.concurrent.Future;
22 import org.openide.util.Cancellable;
23 import org.openide.util.NbBundle;
24 
32 public class TaskCancellable implements Cancellable {
33 
34  private final ProgressIndicator progress;
35  private Future<?> future;
36 
47  this.progress = progress;
48  }
49 
55  public synchronized void setFuture(Future<?> future) {
56  this.future = future;
57  }
58 
59  @Override
60  @NbBundle.Messages({
61  "TaskCanceller.progress.cancellingMessage=Cancelling..."
62  })
63  public synchronized boolean cancel() {
64  progress.setCancelling(Bundle.TaskCanceller_progress_cancellingMessage());
65  return future.cancel(true);
66  }
67 
68 }
default void setCancelling(String cancellingMessage)
synchronized void setFuture(Future<?> future)

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.