當前位置: 首頁>>代碼示例>>Java>>正文


Java WorkspaceModifyOperation類代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:Yakindu,項目名稱:solidity-ide,代碼行數:21,代碼來源:KickStartNewProjectAction.java

示例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);
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:17,代碼來源:DwFeatureModelWizard.java

示例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;
}
 
開發者ID:Yakindu,項目名稱:statecharts,代碼行數:19,代碼來源:SGenNewFileWizard.java

示例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();
	}
}
 
開發者ID:vogellacompany,項目名稱:languagetool-eclipse-plugin,代碼行數:29,代碼來源:Engine.java

示例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);
    }
}
 
開發者ID:henrikor2,項目名稱:eclipsensis,代碼行數:23,代碼來源:NSISEditor.java

示例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 );
	}
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:23,代碼來源:IDEOpenSampleReportAction.java

示例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;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:29,代碼來源:TemplateProvider.java

示例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;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:10,代碼來源:NoneTemplate.java

示例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);
       	}
       }
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:32,代碼來源:SetSvnPropertyAction.java

示例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);        
    	}
    }
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:29,代碼來源:UnlockAction.java

示例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);
      }
    	}
    }
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:37,代碼來源:LockAction.java

示例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);

}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:31,代碼來源:AddAction.java

示例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);
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:38,代碼來源:MarkMergedSynchronizeOperation.java

示例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;
}
 
開發者ID:dschaefer,項目名稱:andmore2,代碼行數:34,代碼來源:NewAppWizard.java

示例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();
			}
		}
	};
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:34,代碼來源:RefreshAction.java


注:本文中的org.eclipse.ui.actions.WorkspaceModifyOperation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。