本文整理汇总了Java中org.eclipse.ui.actions.WorkspaceModifyOperation类的典型用法代码示例。如果您正苦于以下问题:Java WorkspaceModifyOperation类的具体用法?Java WorkspaceModifyOperation怎么用?Java WorkspaceModifyOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkspaceModifyOperation类属于org.eclipse.ui.actions包,在下文中一共展示了WorkspaceModifyOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
@Override
public void run(IIntroSite site, Properties params) {
WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IProject project = createProject(monitor);
createExample(project);
}
};
try {
PlatformUI.getWorkbench().getProgressService().run(true, true, op);
final IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
IIntroPart part = introManager.getIntro();
introManager.closeIntro(part);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(page, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("hello-world/greeter.sol")));
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: saveModel
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
protected void saveModel(final IFile file) throws InvocationTargetException, InterruptedException {
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor progressMonitor) {
try {
EObject model = createInitialModel();
EcoreIOUtil.saveModelAs(model, file);
} finally {
progressMonitor.done();
}
}
};
IWizardContainer container = getContainer();
container.run(false, false, operation);
}
示例3: performFinish
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
@Override
public boolean performFinish() {
IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
ensureSCTNature(getProject(modelFilePage.getContainerFullPath()));
Resource resource = createDefaultModel(modelFilePage.getURI());
openModel(resource);
}
};
try {
getContainer().run(false, true, op);
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
示例4: processMatches
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
/**
* Tdestings
*
* @param collector
* @param matches
*/
private void processMatches(ISpellingProblemCollector collector, List<RuleMatch> matches) {
WorkspaceModifyOperation workspaceRunnable = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor)
throws CoreException, InvocationTargetException, InterruptedException {
// TODO
deleteMarkers();
matches.forEach(match -> {
collector.accept(new LTSpellingProblem(match));
addMarker(match);
});
}
};
try {
workspaceRunnable.run(null);
} catch (InvocationTargetException | InterruptedException e) {
e.printStackTrace();
}
}
示例5: editorSaved
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
@Override
protected void editorSaved()
{
super.editorSaved();
updateOutlinePage();
updateActionsState();
WorkspaceModifyOperation op = new WorkspaceModifyOperation()
{
@Override
protected void execute(IProgressMonitor monitor)
{
NSISTaskTagUpdater taskTagUpdater = new NSISTaskTagUpdater();
updateTaskTagMarkers(taskTagUpdater);
}
};
try {
op.run(null);
}
catch (Exception e) {
EclipseNSISPlugin.getDefault().log(e);
}
}
示例6: refreshReportProject
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
private void refreshReportProject( final IProject project )
{
WorkspaceModifyOperation op = new WorkspaceModifyOperation( ) {
protected void execute( IProgressMonitor monitor )
throws CoreException
{
project.refreshLocal( IResource.DEPTH_INFINITE, monitor );
}
};
try
{
new ProgressMonitorDialog( composite.getShell( ) ).run( false,
true,
op );
}
catch ( Exception e )
{
ExceptionUtil.handle( e );
}
}
示例7: createResourceOperation
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
protected IRunnableWithProgress createResourceOperation(IFolder folder,InitialBuildPolicies policies) {
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) {
String resource = "";
String targetFile = "";
try {
for (int i = 0; i < resources.length; i++) {
resource = resources[i];
targetFile = targetFiles[i];
IFile file = create(folder, resource, targetFile, monitor);
if (file != null) {
createdResources.add(file);
policies.setFile(file);
policies.run();
BasicNewResourceWizard.selectAndReveal(file,
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
}
}
} catch (Exception exception) {
ResourceManager.logException(exception, "Unable to create " + resource);
} finally {
monitor.done();
}
}
};
return operation;
}
示例8: createResourceOperation
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
protected IRunnableWithProgress createResourceOperation(IFolder folder) {
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor)
throws CoreException, InvocationTargetException, InterruptedException {
}
};
return operation;
}
示例9: execute
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
protected void execute(final IAction action) throws InvocationTargetException, InterruptedException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
}
else {
if(getSelectedResources().length > 0) {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
IResource resource = getSelectedResources()[0];
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
SvnWizardSetPropertyPage setPropertyPage = new SvnWizardSetPropertyPage(svnResource);
SvnWizard wizard = new SvnWizard(setPropertyPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() != SvnWizardDialog.OK) return;
try {
if (setPropertyPage.getPropertyValue() != null) {
svnResource.setSvnProperty(setPropertyPage.getPropertyName(), setPropertyPage.getPropertyValue(),setPropertyPage.getRecurse());
} else {
svnResource.setSvnProperty(setPropertyPage.getPropertyName(), setPropertyPage.getPropertyFile(),setPropertyPage.getRecurse());
}
SvnPropertiesView.refreshView();
} catch (SVNException e) {
throw new InvocationTargetException(e);
}
}
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
}
}
示例10: execute
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
}
else {
if (getSelectedResources() != null && getSelectedResources().length > 0) {
final IResource[] resources = getSelectedResources();
run(new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
try {
Hashtable table = getProviderMapping(getSelectedResources());
Set keySet = table.keySet();
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
SVNTeamProvider provider = (SVNTeamProvider)iterator.next();
UnlockResourcesCommand command = new UnlockResourcesCommand(provider.getSVNWorkspaceRoot(), resources, false);
command.run(Policy.subMonitorFor(monitor,1000));
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
}, true /* cancelable */, PROGRESS_DIALOG);
}
}
}
示例11: execute
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
}
else {
if (getSelectedResources() != null && getSelectedResources().length > 0) {
final IResource[] resources = getSelectedResources();
SvnWizardLockPage lockPage = new SvnWizardLockPage(resources);
SvnWizard wizard = new SvnWizard(lockPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.OK) {
final String comment = lockPage.getComment();
final boolean stealLock = lockPage.isStealLock();
run(new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
try {
Hashtable table = getProviderMapping(getSelectedResources());
Set keySet = table.keySet();
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
SVNTeamProvider provider = (SVNTeamProvider)iterator.next();
LockResourcesCommand command = new LockResourcesCommand(provider.getSVNWorkspaceRoot(), resources, stealLock, comment);
command.run(Policy.subMonitorFor(monitor,1000));
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
}, true /* cancelable */, PROGRESS_DIALOG);
}
}
}
}
示例12: execute
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
// first we ask the user if he really want to add the selected resources if some of them are marked as ignored
if (!promptForAddOfIgnored()) {
return;
}
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InvocationTargetException {
try {
// associate the resources with their respective RepositoryProvider
Hashtable table = getProviderMapping(getSelectedResources());
Set keySet = table.keySet();
monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
monitor.setTaskName(Policy.bind("AddAction.adding")); //$NON-NLS-1$
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = Policy.subMonitorFor(monitor, 1000);
SVNTeamProvider provider = (SVNTeamProvider)iterator.next();
List list = (List)table.get(provider);
IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
provider.add(providerResources, IResource.DEPTH_INFINITE, subMonitor);
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
}, true /* cancelable */, PROGRESS_DIALOG);
}
示例13: run
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
protected void run(SVNTeamProvider provider, SyncInfoSet set, final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
final IResource[] resources = set.getResources();
run(new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor mon) throws CoreException, InvocationTargetException, InterruptedException {
for (int i = 0; i < resources.length; i++) {
File tempFile = null;
try {
tempFile = copyToTempFile(resources[i]);
} catch (Exception e) {
SVNUIPlugin.log(e.getMessage());
showErrorMessage(e);
return;
}
if (monitor.isCanceled()) {
if (tempFile != null) tempFile.delete();
return;
}
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
if (svnResource instanceof LocalResource) ((LocalResource)svnResource).revert(false);
else svnResource.revert();
new UpdateOperation(getPart(), resources[i], SVNRevision.HEAD).run(monitor);
if (monitor.isCanceled()) {
if (tempFile != null) tempFile.delete();
return;
}
File file = new File(resources[i].getLocation().toString());
try {
copy(tempFile, file);
} catch (Exception e1) {
SVNUIPlugin.log(e1.getMessage());
showErrorMessage(e1);
}
if (tempFile != null) tempFile.delete();
}
}
}, true /* cancelable */, PROGRESS_BUSYCURSOR);
}
示例14: performFinish
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
@Override
public boolean performFinish() {
AppProjectGenerator generator = new AppProjectGenerator(getTemplateManifestPath());
generator.setProjectName(mainPage.getProjectName());
if (!mainPage.useDefaults()) {
generator.setLocationURI(mainPage.getLocationURI());
}
generator.setPackageName("com.example.emptyapp");
generator.setActivityName("MainActivity");
generator.setLayoutName("activity_main");
Map<String, Object> model = new HashMap<>();
try {
getContainer().run(true, true, new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor)
throws CoreException, InvocationTargetException, InterruptedException {
monitor.beginTask("Generating project", 1); //$NON-NLS-1$
generator.generate(model, monitor);
monitor.done();
}
@Override
public ISchedulingRule getRule() {
return ResourcesPlugin.getWorkspace().getRoot();
}
});
} catch (InterruptedException | InvocationTargetException e) {
throw new RuntimeException(e);
}
return true;
}
示例15: createOperation
import org.eclipse.ui.actions.WorkspaceModifyOperation; //导入依赖的package包/类
@Override
final protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) {
final ISchedulingRule rule = null;
// final IResourceRuleFactory factory = ResourcesPlugin.getWorkspace().getRuleFactory();
// List<? extends IResource> actionResources = new ArrayList<>(resources);
// if (shouldPerformResourcePruning()) {
// actionResources = pruneResources2(actionResources);
// }
// final List<? extends IResource> resources = actionResources;
// final Iterator<? extends IResource> res = resources.iterator();
// while (res.hasNext()) {
// rule = MultiRule.combine(rule, factory.refreshRule(res.next()));
// }
return new WorkspaceModifyOperation() {
@Override
public void execute(final IProgressMonitor monitor) {
final Iterator<? extends IResource> resourcesEnum = resources.iterator();
try {
while (resourcesEnum.hasNext()) {
try {
final IResource resource = resourcesEnum.next();
refreshResource(resource, null);
} catch (final CoreException e) {}
if (monitor.isCanceled()) { throw new OperationCanceledException(); }
}
} finally {
monitor.done();
}
}
};
}