Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. 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 /
 
 package org.eclipse.xtext.ui.refactoring.ui;
 
import  org.eclipse.core.resources.IWorkspace;
import  org.eclipse.core.resources.IWorkspaceRunnable;
import  org.eclipse.core.resources.ResourcesPlugin;
import  org.eclipse.core.runtime.Assert;
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.core.runtime.jobs.Job;
import  org.eclipse.jface.operation.IRunnableWithProgress;
import  org.eclipse.jface.operation.IThreadListener;

Author(s):
schill - Initial contribution and API Due to visibility problems copied from org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter
public class WorkbenchRunnableAdapter implements IRunnableWithProgress, IThreadListener {
	private IWorkspaceRunnable workspaceRunnable;
	private ISchedulingRule rule;
	private boolean fTransfer;

Runs a workspace runnable with the given lock or null to run with no lock at all.

Parameters:
runnable the workspace runnable
rule the scheduling rule
	public WorkbenchRunnableAdapter(IWorkspaceRunnable runnable, ISchedulingRule rule) {
		this(runnableruletrue);
	}

Runs a workspace runnable with the given lock or null to run with no lock at all.

Parameters:
runnable the workspace runnable
rule the scheduling rule
transfer true if the rule is to be transfered to the model context thread. Otherwise false
Since:
3.1
	public WorkbenchRunnableAdapter(IWorkspaceRunnable runnable, ISchedulingRule ruleboolean transfer) {
		Assert.isNotNull(runnable);
		Assert.isNotNull(rule);
		runnable;
		this.rule;
		transfer;
	}
	public ISchedulingRule getSchedulingRule() {
		return ;
	}

	public void threadChange(Thread thread) {
			Job.getJobManager().transferRule(thread);
	}
	/*
	 * @see IRunnableWithProgress#run(IProgressMonitor)
	 */
	public void run(IProgressMonitor monitorthrows InvocationTargetExceptionInterruptedException {
		try {
			ResourcesPlugin.getWorkspace().run(, IWorkspace.AVOID_UPDATE, monitor);
catch (OperationCanceledException e) {
			throw new InterruptedException(e.getMessage());
catch (CoreException e) {
		}
	}
New to GrepCode? Check out our FAQ X