blob: 7a80433f5c646017aceb3d6c327f3581969044be [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.examples.jobs.actions;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class ForegroundAction implements IWorkbenchWindowActionDelegate {
@Override
public void run(IAction action) {
try {
ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor -> {
// no-op
}, null);
} catch (OperationCanceledException e) {
e.printStackTrace();
} catch (CoreException e) {
e.printStackTrace();
}
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
//do nothing
}
@Override
public void dispose() {
//do nothing
}
@Override
public void init(IWorkbenchWindow window) {
//do nothing
}
}