blob: 8d8fbdb3cbab9a4abafc426450e4786fdacb0831 [file] [log] [blame]
package org.eclipse.team.internal.ui;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
/**
* @author Administrator
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class NatureToPropertyAction extends TeamAction {
/**
* @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
*/
protected boolean isEnabled() throws TeamException {
return true;
}
/**
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public void run(IAction action) {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
IProject[] projects = getSelectedProjects();
for (int i = 0; i < projects.length; i++) {
RepositoryProvider.convertNatureToProperty(projects[i], true);
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
}, Policy.bind("NatureToPropertyAction.label"), this.PROGRESS_DIALOG); //$NON-NLS-1$
}
}