org.eclipse.ui.ide.undo.MoveResourcesOperation Java Examples
The following examples show how to use
org.eclipse.ui.ide.undo.MoveResourcesOperation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamicWorkingSetUpdaterPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
private IProject renameProjectTo( IProject project, String name ) throws ExecutionException { IProject result = project.getWorkspace().getRoot().getProject( name ); IPath path = result.getFullPath(); AbstractOperation operation = new MoveResourcesOperation( project, path, "Rename project" ); operation.execute( new NullProgressMonitor(), null ); renamedProjects.add( result ); return result; }
Example #2
Source File: RenameResourceAction.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) { return monitor -> { final IResource[] resources = getActionResources().toArray(new IResource[getActionResources().size()]); // Rename is only valid for a single resource. This has already // been validated. if (resources.length == 1) { // check for overwrite final IWorkspaceRoot workspaceRoot = resources[0].getWorkspace().getRoot(); final IResource newResource = workspaceRoot.findMember(newPath); boolean go = true; if (newResource != null) { go = checkOverwrite(WorkbenchHelper.getShell(), newResource); } if (go) { final MoveResourcesOperation op = new MoveResourcesOperation(resources[0], newPath, IDEWorkbenchMessages.RenameResourceAction_operationTitle); op.setModelProviderIds(getModelProviderIds()); try { PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, monitor, WorkspaceUndoUtil.getUIInfoAdapter(WorkbenchHelper.getShell())); } catch (final ExecutionException e) { if (e.getCause() instanceof CoreException) { errorStatus[0] = ((CoreException) e.getCause()).getStatus(); } else { errorStatus[0] = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, getProblemsMessage(), e); } } } } }; }
Example #3
Source File: RenameResourceAndCloseEditorAction.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) { return new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { IResource[] resources = (IResource[]) getActionResources() .toArray(new IResource[getActionResources().size()]); // Rename is only valid for a single resource. This has already // been validated. if (resources.length == 1) { // check for overwrite IWorkspaceRoot workspaceRoot = resources[0].getWorkspace() .getRoot(); IResource newResource = workspaceRoot.findMember(newPath); boolean go = true; if (newResource != null) { go = checkOverwrite(shellProvider.getShell(), newResource); } if (go) { MoveResourcesOperation op = new MoveResourcesOperation( resources[0], newPath, IDEWorkbenchMessages.RenameResourceAction_operationTitle); op.setModelProviderIds(getModelProviderIds()); try { PlatformUI .getWorkbench() .getOperationSupport() .getOperationHistory() .execute( op, monitor, WorkspaceUndoUtil .getUIInfoAdapter(shellProvider.getShell())); } catch (ExecutionException e) { if (e.getCause() instanceof CoreException) { errorStatus[0] = ((CoreException) e.getCause()) .getStatus(); } else { errorStatus[0] = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, getProblemsMessage(), e); } } } } } }; }
Example #4
Source File: RenameResourceAndCloseEditorAction.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) { return new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { IResource[] resources = (IResource[]) getActionResources() .toArray(new IResource[getActionResources().size()]); // Rename is only valid for a single resource. This has already // been validated. if (resources.length == 1) { // check for overwrite IWorkspaceRoot workspaceRoot = resources[0].getWorkspace() .getRoot(); IResource newResource = workspaceRoot.findMember(newPath); boolean go = true; if (newResource != null) { go = checkOverwrite(shellProvider.getShell(), newResource); } if (go) { MoveResourcesOperation op = new MoveResourcesOperation( resources[0], newPath, IDEWorkbenchMessages.RenameResourceAction_operationTitle); op.setModelProviderIds(getModelProviderIds()); try { PlatformUI .getWorkbench() .getOperationSupport() .getOperationHistory() .execute( op, monitor, WorkspaceUndoUtil .getUIInfoAdapter(shellProvider.getShell())); } catch (ExecutionException e) { if (e.getCause() instanceof CoreException) { errorStatus[0] = ((CoreException) e.getCause()) .getStatus(); } else { errorStatus[0] = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, getProblemsMessage(), e); } } } } } }; }