That way it can be used by actions defined in other plugins.
Change-Id: I561d93211c75344a07f8b649d1561db1af46f781
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tracecompass.internal.tmf.remote.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.remote.ui.messages.RemoteMessages;
-import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ArchiveUtil;
import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.FileSystemObjectImportStructureProvider;
import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.IFileSystemObject;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceTypeUIUtils;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTracesFolder;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
+import org.eclipse.tracecompass.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
/**
org.eclipse.tracecompass.tmf.ui.markers,
org.eclipse.tracecompass.tmf.ui.project.handlers,
org.eclipse.tracecompass.tmf.ui.project.model,
+ org.eclipse.tracecompass.tmf.ui.project.operations,
org.eclipse.tracecompass.tmf.ui.project.wizards,
org.eclipse.tracecompass.tmf.ui.properties,
org.eclipse.tracecompass.tmf.ui.signal,
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swt.widgets.Display;
import org.eclipse.tracecompass.internal.tmf.ui.editors.TmfTableColumnUtils;
-import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.tracecompass.tmf.core.TmfProjectNature;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectRegistry;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
+import org.eclipse.tracecompass.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.ui.PlatformUI;
/**
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
+import org.eclipse.tracecompass.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
-import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTracesFolder;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
+import org.eclipse.tracecompass.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.swt.widgets.Display;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.ui.project.dialogs.SelectSupplementaryResourcesDialog;
-import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfCommonProjectElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
+import org.eclipse.tracecompass.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tracecompass.internal.tmf.ui.project.dialogs.offset.OffsetDialog;
-import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
+import org.eclipse.tracecompass.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tracecompass.common.core.StreamUtils;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
-import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.Statedump;
import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
+import org.eclipse.tracecompass.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.internal.tmf.ui.project.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * Operation to modify the workspace that refreshes workspace at the end of the operation.
- *
- * For refreshing periodically use {@link WorkspaceModifyOperation} instead.
- *
- * @author Bernd Hufmann
- *
- */
-public abstract class TmfWorkspaceModifyOperation implements IRunnableWithProgress {
-
- private ISchedulingRule rule;
-
- /**
- * Creates a new operation.
- */
- protected TmfWorkspaceModifyOperation() {
- this(ResourcesPlugin.getWorkspace().getRoot());
- }
-
- /**
- * Creates a new operation that will run using the provided scheduling rule.
- *
- * @param rule
- * The ISchedulingRule to use or <code>null</code>.
- */
- protected TmfWorkspaceModifyOperation(ISchedulingRule rule) {
- this.rule = rule;
- }
-
- @Override
- public final synchronized void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- final InvocationTargetException[] iteHolder = new InvocationTargetException[1];
- try {
- IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- execute(pm);
- } catch (InvocationTargetException e) {
- // Pass it outside the workspace runnable
- iteHolder[0] = e;
- } catch (InterruptedException e) {
- // Re-throw as OperationCanceledException, which will be
- // caught and re-thrown as InterruptedException below.
- throw new OperationCanceledException(e.getMessage());
- }
- // CoreException and OperationCanceledException are propagated
- }
- };
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.run(workspaceRunnable, rule, IWorkspace.AVOID_UPDATE, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- }
- // Re-throw the InvocationTargetException, if any occurred
- if (iteHolder[0] != null) {
- throw iteHolder[0];
- }
- }
-
- /**
- * Performs the steps that are to be treated as a single logical workspace
- * change.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param monitor
- * the progress monitor to use to display progress and field user
- * requests to cancel
- * @exception CoreException
- * if the operation fails due to a CoreException
- * @exception InvocationTargetException
- * if the operation fails due to an exception other than
- * CoreException
- * @exception InterruptedException
- * if the operation detects a request to cancel, using
- * <code>IProgressMonitor.isCanceled()</code>, it should exit
- * by throwing <code>InterruptedException</code>. It is also
- * possible to throw <code>OperationCanceledException</code>,
- * which gets mapped to <code>InterruptedException</code> by
- * the <code>run</code> method.
- */
- protected abstract void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException;
-}
\ No newline at end of file
import org.eclipse.jface.operation.ModalContext;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
-import org.eclipse.tracecompass.internal.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceImportException;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceTypeUIUtils;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
+import org.eclipse.tracecompass.tmf.ui.project.operations.TmfWorkspaceModifyOperation;
import org.eclipse.ui.dialogs.FileSystemElement;
import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ui.project.operations;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+/**
+ * Operation to modify the workspace that refreshes workspace at the end of the operation.
+ *
+ * For refreshing periodically use {@link WorkspaceModifyOperation} instead.
+ *
+ * @author Bernd Hufmann
+ * @since 2.3
+ */
+public abstract class TmfWorkspaceModifyOperation implements IRunnableWithProgress {
+
+ private ISchedulingRule rule;
+
+ /**
+ * Creates a new operation.
+ */
+ protected TmfWorkspaceModifyOperation() {
+ this(ResourcesPlugin.getWorkspace().getRoot());
+ }
+
+ /**
+ * Creates a new operation that will run using the provided scheduling rule.
+ *
+ * @param rule
+ * The ISchedulingRule to use or <code>null</code>.
+ */
+ protected TmfWorkspaceModifyOperation(ISchedulingRule rule) {
+ this.rule = rule;
+ }
+
+ @Override
+ public final synchronized void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ final InvocationTargetException[] iteHolder = new InvocationTargetException[1];
+ try {
+ IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor pm) throws CoreException {
+ try {
+ execute(pm);
+ } catch (InvocationTargetException e) {
+ // Pass it outside the workspace runnable
+ iteHolder[0] = e;
+ } catch (InterruptedException e) {
+ // Re-throw as OperationCanceledException, which will be
+ // caught and re-thrown as InterruptedException below.
+ throw new OperationCanceledException(e.getMessage());
+ }
+ // CoreException and OperationCanceledException are propagated
+ }
+ };
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ workspace.run(workspaceRunnable, rule, IWorkspace.AVOID_UPDATE, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } catch (OperationCanceledException e) {
+ throw new InterruptedException(e.getMessage());
+ }
+ // Re-throw the InvocationTargetException, if any occurred
+ if (iteHolder[0] != null) {
+ throw iteHolder[0];
+ }
+ }
+
+ /**
+ * Performs the steps that are to be treated as a single logical workspace
+ * change.
+ * <p>
+ * Subclasses must implement this method.
+ * </p>
+ *
+ * @param monitor
+ * the progress monitor to use to display progress and field user
+ * requests to cancel
+ * @exception CoreException
+ * if the operation fails due to a CoreException
+ * @exception InvocationTargetException
+ * if the operation fails due to an exception other than
+ * CoreException
+ * @exception InterruptedException
+ * if the operation detects a request to cancel, using
+ * <code>IProgressMonitor.isCanceled()</code>, it should exit
+ * by throwing <code>InterruptedException</code>. It is also
+ * possible to throw <code>OperationCanceledException</code>,
+ * which gets mapped to <code>InterruptedException</code> by
+ * the <code>run</code> method.
+ */
+ protected abstract void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException;
+}
\ No newline at end of file