Java Code Examples for org.eclipse.core.resources.mapping.ResourceMapping

The following are top voted examples for showing how to use org.eclipse.core.resources.mapping.ResourceMapping. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: subclipse   File: TeamAction.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the selected resources.
 * 
 * @return the selected resources
 */
protected IResource[] getSelectedResources() {
	ArrayList resourceArray = new ArrayList();
	IResource[] resources = (IResource[])getSelectedResources(IResource.class);
	for (int i = 0; i < resources.length; i++) resourceArray.add(resources[i]);
	ResourceMapping[] resourceMappings = (ResourceMapping[])getSelectedAdaptables(selection, ResourceMapping.class);
	for (int i = 0; i < resourceMappings.length; i++) {
		ResourceMapping resourceMapping = (ResourceMapping)resourceMappings[i];
		try {
			ResourceTraversal[] traversals = resourceMapping.getTraversals(null, null);
			for (int j = 0; j < traversals.length; j++) {
				IResource[] traversalResources = traversals[j].getResources();
				for (int k = 0; k < traversalResources.length; k++) {
					if (!resourceArray.contains(traversalResources[k]))
						resourceArray.add(traversalResources[k]);
				}
			}
		} catch (CoreException e) {
			SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
		}
	}		
	IResource[] selectedResources = new IResource[resourceArray.size()];
	resourceArray.toArray(selectedResources);
	return selectedResources;
}
 
Example 2
Project: che   File: JavaElementResourceMapping.java   Source Code and License 6 votes vote down vote up
public static ResourceMapping create(IJavaElement element) {
  switch (element.getElementType()) {
    case IJavaElement.TYPE:
      return create((IType) element);
    case IJavaElement.COMPILATION_UNIT:
      return create((ICompilationUnit) element);
    case IJavaElement.CLASS_FILE:
      return create((IClassFile) element);
    case IJavaElement.PACKAGE_FRAGMENT:
      return create((IPackageFragment) element);
    case IJavaElement.PACKAGE_FRAGMENT_ROOT:
      return create((IPackageFragmentRoot) element);
    case IJavaElement.JAVA_PROJECT:
      return create((IJavaProject) element);
    case IJavaElement.JAVA_MODEL:
      return create((IJavaModel) element);
    default:
      return null;
  }
}
 
Example 3
Project: che   File: CopyModifications.java   Source Code and License 6 votes vote down vote up
public void copy(
    IPackageFragmentRoot sourceFolder, CopyArguments javaArgs, CopyArguments resourceArgs) {
  add(sourceFolder, javaArgs, null);
  ResourceMapping mapping = JavaElementResourceMapping.create(sourceFolder);
  if (mapping != null) {
    add(mapping, resourceArgs, null);
  }
  IResource sourceResource = sourceFolder.getResource();
  if (sourceResource != null) {
    getResourceModifications().addCopyDelta(sourceResource, resourceArgs);
    IFile classpath = getClasspathFile((IResource) resourceArgs.getDestination());
    if (classpath != null) {
      getResourceModifications().addChanged(classpath);
    }
  }
}
 
Example 4
Project: che   File: PackageFragmentRootReorgChange.java   Source Code and License 6 votes vote down vote up
@Override
public final Change perform(IProgressMonitor pm)
    throws CoreException, OperationCanceledException {
  pm.beginTask(getName(), 2);
  try {
    String newName = getNewResourceName();
    IPackageFragmentRoot root = getRoot();
    ResourceMapping mapping = JavaElementResourceMapping.create(root);
    final Change result =
        doPerformReorg(
            getDestinationProjectPath().append(newName), new SubProgressMonitor(pm, 1));
    markAsExecuted(root, mapping);
    return result;
  } finally {
    pm.done();
  }
}
 
Example 5
Project: chromedevtools   File: FileBasedAction.java   Source Code and License 6 votes vote down vote up
private static <RES> List<RES> readFiles(ResourceMapping resourceMapping,
    final FileFilter<RES> fileFilter) {
  final List<RES> fileList = new ArrayList<RES>(1);
  IResourceVisitor visitor = new IResourceVisitor() {
    public boolean visit(IResource resource) throws CoreException {
      if (resource instanceof IFile == false) {
        return true;
      } else {
        IFile file = (IFile) resource;
        RES res = fileFilter.accept(file);
        if (res != null) {
          fileList.add(res);
        }
        return false;
      }
    }
  };
  try {
    resourceMapping.accept(null, visitor, null);
  } catch (CoreException e) {
    throw new RuntimeException(e);
  }
  return fileList;
}
 
Example 6
Project: APICloud-Studio   File: TeamAction.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the selected resources.
 * 
 * @return the selected resources
 */
protected IResource[] getSelectedResources() {
	ArrayList resourceArray = new ArrayList();
	IResource[] resources = (IResource[])getSelectedResources(IResource.class);
	for (int i = 0; i < resources.length; i++) resourceArray.add(resources[i]);
	ResourceMapping[] resourceMappings = (ResourceMapping[])getSelectedAdaptables(selection, ResourceMapping.class);
	for (int i = 0; i < resourceMappings.length; i++) {
		ResourceMapping resourceMapping = (ResourceMapping)resourceMappings[i];
		try {
			ResourceTraversal[] traversals = resourceMapping.getTraversals(null, null);
			for (int j = 0; j < traversals.length; j++) {
				IResource[] traversalResources = traversals[j].getResources();
				for (int k = 0; k < traversalResources.length; k++) {
					if (!resourceArray.contains(traversalResources[k]))
						resourceArray.add(traversalResources[k]);
				}
			}
		} catch (CoreException e) {
			SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
		}
	}		
	IResource[] selectedResources = new IResource[resourceArray.size()];
	resourceArray.toArray(selectedResources);
	return selectedResources;
}
 
Example 7
Project: Eclipse-Postfix-Code-Completion   File: JavaElementResourceMapping.java   Source Code and License 6 votes vote down vote up
public static ResourceMapping create(IJavaElement element) {
	switch (element.getElementType()) {
		case IJavaElement.TYPE:
			return create((IType)element);
		case IJavaElement.COMPILATION_UNIT:
			return create((ICompilationUnit)element);
		case IJavaElement.CLASS_FILE:
			return create((IClassFile)element);
		case IJavaElement.PACKAGE_FRAGMENT:
			return create((IPackageFragment)element);
		case IJavaElement.PACKAGE_FRAGMENT_ROOT:
			return create((IPackageFragmentRoot)element);
		case IJavaElement.JAVA_PROJECT:
			return create((IJavaProject)element);
		case IJavaElement.JAVA_MODEL:
			return create((IJavaModel)element);
		default:
			return null;
	}

}
 
Example 8
Project: Eclipse-Postfix-Code-Completion   File: JavaModelAdapterFactory.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Object getAdapter(final Object adaptable, final Class adapter) {
	if (adaptable instanceof JavaModelProvider) {
		if (adapter == IResourceMappingMerger.class)
			return new JavaModelMerger((ModelProvider) adaptable);
		else if (adapter == ISynchronizationCompareAdapter.class)
			return new JavaSynchronizationCompareAdapter();
	} else if (adaptable instanceof RefactoringHistory) {
		if (adapter == ResourceMapping.class)
			return new JavaRefactoringHistoryResourceMapping((RefactoringHistory) adaptable);
		else if (adapter == IResource.class)
			return new JavaRefactoringHistoryResourceMapping((RefactoringHistory) adaptable).getResource();
	} else if (adaptable instanceof RefactoringDescriptorProxy) {
		if (adapter == ResourceMapping.class)
			return new JavaRefactoringDescriptorResourceMapping((RefactoringDescriptorProxy) adaptable);
	}
	return null;
}
 
Example 9
Project: Eclipse-Postfix-Code-Completion-Juno38   File: JavaElementResourceMapping.java   Source Code and License 6 votes vote down vote up
public static ResourceMapping create(IJavaElement element) {
	switch (element.getElementType()) {
		case IJavaElement.TYPE:
			return create((IType)element);
		case IJavaElement.COMPILATION_UNIT:
			return create((ICompilationUnit)element);
		case IJavaElement.CLASS_FILE:
			return create((IClassFile)element);
		case IJavaElement.PACKAGE_FRAGMENT:
			return create((IPackageFragment)element);
		case IJavaElement.PACKAGE_FRAGMENT_ROOT:
			return create((IPackageFragmentRoot)element);
		case IJavaElement.JAVA_PROJECT:
			return create((IJavaProject)element);
		case IJavaElement.JAVA_MODEL:
			return create((IJavaModel)element);
		default:
			return null;
	}

}
 
Example 10
Project: Eclipse-Postfix-Code-Completion-Juno38   File: JavaModelAdapterFactory.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Object getAdapter(final Object adaptable, final Class adapter) {
	if (adaptable instanceof JavaModelProvider) {
		if (adapter == IResourceMappingMerger.class)
			return new JavaModelMerger((ModelProvider) adaptable);
		else if (adapter == ISynchronizationCompareAdapter.class)
			return new JavaSynchronizationCompareAdapter();
	} else if (adaptable instanceof RefactoringHistory) {
		if (adapter == ResourceMapping.class)
			return new JavaRefactoringHistoryResourceMapping((RefactoringHistory) adaptable);
		else if (adapter == IResource.class)
			return new JavaRefactoringHistoryResourceMapping((RefactoringHistory) adaptable).getResource();
	} else if (adaptable instanceof RefactoringDescriptorProxy) {
		if (adapter == ResourceMapping.class)
			return new JavaRefactoringDescriptorResourceMapping((RefactoringDescriptorProxy) adaptable);
	}
	return null;
}
 
Example 11
Project: n4js   File: WorkingSet.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
default <T> T getAdapter(final Class<T> adapter) {

	if (IWorkingSet.class == adapter || ResourceMapping.class == adapter) {
		return (T) new WorkingSetAdapter(this);
	}

	return Platform.getAdapterManager().getAdapter(this, adapter);
}
 
Example 12
Project: subclipse   File: SVNLightweightDecorator.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the resource for the given input object, or
 * null if there is no resource associated with it.
 *
 * @param object  the object to find the resource for
 * @return the resource for the given object, or null
 */
private IResource getResource(Object object) {
	if (object instanceof ResourceMapping) {
		object = ((ResourceMapping) object).getModelObject();
		return getModelObjectResource(object);
	}
	if (object instanceof IResource) {
		return (IResource) object;
	}
	if (object instanceof IAdaptable) {
		return (IResource) ((IAdaptable) object).getAdapter(
			IResource.class);
	}
	return null;
}
 
Example 13
Project: che   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
@Override
public boolean contains(ResourceMapping mapping) {
  if (mapping instanceof JavaElementResourceMapping) {
    JavaElementResourceMapping javaMapping = (JavaElementResourceMapping) mapping;
    IJavaElement element = getJavaElement();
    IJavaElement other = javaMapping.getJavaElement();
    if (other != null && element != null) return element.getPath().isPrefixOf(other.getPath());
  }
  return false;
}
 
Example 14
Project: che   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
public static ResourceMapping create(final IPackageFragment pack) {
  // test if in an archive
  IPackageFragmentRoot root =
      (IPackageFragmentRoot) pack.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
  if (!root.isArchive() && !root.isExternal()) {
    return new PackageFragmentResourceMapping(pack);
  }
  return null;
}
 
Example 15
Project: che   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
public static ResourceMapping create(IClassFile classFile) {
  // test if in a archive
  IPackageFragmentRoot root =
      (IPackageFragmentRoot) classFile.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
  if (!root.isArchive() && !root.isExternal()) {
    return new ClassFileResourceMapping(classFile);
  }
  return null;
}
 
Example 16
Project: che   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
public static ResourceMapping create(IType type) {
  // top level types behave like the CU
  IJavaElement parent = type.getParent();
  if (parent instanceof ICompilationUnit) {
    return create((ICompilationUnit) parent);
  }
  return null;
}
 
Example 17
Project: che   File: CreateCopyOfCompilationUnitChange.java   Source Code and License 5 votes vote down vote up
private void markAsExecuted(ICompilationUnit unit, ResourceMapping mapping) {
  ReorgExecutionLog log = (ReorgExecutionLog) getAdapter(ReorgExecutionLog.class);
  if (log != null) {
    log.markAsProcessed(unit);
    log.markAsProcessed(mapping);
  }
}
 
Example 18
Project: che   File: CreateCopyOfCompilationUnitChange.java   Source Code and License 5 votes vote down vote up
@Override
public Change perform(IProgressMonitor monitor) throws CoreException {
  ResourceMapping mapping = JavaElementResourceMapping.create(fOldCu);
  final Change result = super.perform(monitor);
  markAsExecuted(fOldCu, mapping);
  return result;
}
 
Example 19
Project: che   File: CopyModifications.java   Source Code and License 5 votes vote down vote up
public void copy(ICompilationUnit unit, CopyArguments javaArgs, CopyArguments resourceArgs) {
  add(unit, javaArgs, null);
  ResourceMapping mapping = JavaElementResourceMapping.create(unit);
  if (mapping != null) {
    add(mapping, resourceArgs, null);
  }
  if (unit.getResource() != null) {
    getResourceModifications().addCopyDelta(unit.getResource(), resourceArgs);
  }
}
 
Example 20
Project: che   File: PackageFragmentRootReorgChange.java   Source Code and License 5 votes vote down vote up
private void markAsExecuted(IPackageFragmentRoot root, ResourceMapping mapping) {
  //		ReorgExecutionLog log= (ReorgExecutionLog)getAdapter(ReorgExecutionLog.class);
  //		if (log != null) {
  //			log.markAsProcessed(root);
  //			log.markAsProcessed(mapping);
  //		}
}
 
Example 21
Project: che   File: CompilationUnitReorgChange.java   Source Code and License 5 votes vote down vote up
@Override
public final Change perform(IProgressMonitor pm)
    throws CoreException, OperationCanceledException {
  pm.beginTask(getName(), 1);
  try {
    ICompilationUnit unit = getCu();
    ResourceMapping mapping = JavaElementResourceMapping.create(unit);
    Change result = doPerformReorg(new SubProgressMonitor(pm, 1));
    markAsExecuted(unit, mapping);
    return result;
  } finally {
    pm.done();
  }
}
 
Example 22
Project: che   File: CompilationUnitReorgChange.java   Source Code and License 5 votes vote down vote up
private void markAsExecuted(ICompilationUnit unit, ResourceMapping mapping) {
  //		ReorgExecutionLog log= (ReorgExecutionLog)getAdapter(ReorgExecutionLog.class);
  //		if (log != null) {
  //			log.markAsProcessed(unit);
  //			log.markAsProcessed(mapping);
  //		}
}
 
Example 23
Project: che   File: PackageReorgChange.java   Source Code and License 5 votes vote down vote up
@Override
public final Change perform(IProgressMonitor pm)
    throws CoreException, OperationCanceledException {
  pm.beginTask(getName(), 1);
  try {
    IPackageFragment pack = getPackage();
    ResourceMapping mapping = JavaElementResourceMapping.create(pack);
    final Change result = doPerformReorg(pm);
    // markAsExecuted(pack, mapping);
    return result;
  } finally {
    pm.done();
  }
}
 
Example 24
Project: che   File: PackageReorgChange.java   Source Code and License 5 votes vote down vote up
private void markAsExecuted(IPackageFragment pack, ResourceMapping mapping) {
  ReorgExecutionLog log = (ReorgExecutionLog) getAdapter(ReorgExecutionLog.class);
  if (log != null) {
    log.markAsProcessed(pack);
    log.markAsProcessed(mapping);
  }
}
 
Example 25
Project: datahierarchy   File: ElementAdapterFactory.java   Source Code and License 5 votes vote down vote up
@Override
public ResourceMapping getAdaptedResourceMapping(IAdaptable adaptable) {
    if (adaptable instanceof TreeElement<?, ?>) {
        TreeElement<?, ?> elt = (TreeElement<?, ?>) adaptable;
        return super.getAdaptedResourceMapping(elt.getJavaElement());
    }
    return super.getAdaptedResourceMapping(adaptable);
}
 
Example 26
Project: gama   File: OpenActionProvider.java   Source Code and License 5 votes vote down vote up
private void addOpenWithMenu(final IMenuManager aMenu) {
	final IStructuredSelection ss = (IStructuredSelection) getContext().getSelection();
	if (ss == null || ss.size() != 1) { return; }
	final Object o = ss.getFirstElement();
	// first try IResource
	IAdaptable openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, IResource.class);
	// otherwise try ResourceMapping
	if (openable == null) {
		openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, ResourceMapping.class);
	} else if (((IResource) openable).getType() != IResource.FILE) {
		openable = null;
	}
	if (openable != null) {
		// Create a menu flyout.
		final IMenuManager submenu =
				new MenuManager(WorkbenchNavigatorMessages.OpenActionProvider_OpenWithMenu_label,
						ICommonMenuConstants.GROUP_OPEN_WITH);
		submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_TOP));
		submenu.add(new OpenWithMenu(viewSite.getPage(), openable));
		submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_ADDITIONS));

		// Add the submenu.
		if (submenu.getItems().length > 2 && submenu.isEnabled()) {
			aMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN_WITH, submenu);
		}
	}
}
 
Example 27
Project: chromedevtools   File: FileBasedAction.java   Source Code and License 5 votes vote down vote up
private static <RES> List<RES> readFilesFromSelectionObject(Object element,
    FileFilter<RES> fileFilter) {
  if (element instanceof ResourceMapping == false) {
    return null;
  }
  ResourceMapping resourceMapping = (ResourceMapping) element;
  return readFiles(resourceMapping, fileFilter);
}
 
Example 28
Project: APICloud-Studio   File: SVNLightweightDecorator.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the resource for the given input object, or
 * null if there is no resource associated with it.
 *
 * @param object  the object to find the resource for
 * @return the resource for the given object, or null
 */
private IResource getResource(Object object) {
	if (object instanceof ResourceMapping) {
		object = ((ResourceMapping) object).getModelObject();
		return getModelObjectResource(object);
	}
	if (object instanceof IResource) {
		return (IResource) object;
	}
	if (object instanceof IAdaptable) {
		return (IResource) ((IAdaptable) object).getAdapter(
			IResource.class);
	}
	return null;
}
 
Example 29
Project: Eclipse-Postfix-Code-Completion   File: CreateCopyOfCompilationUnitChange.java   Source Code and License 5 votes vote down vote up
private void markAsExecuted(ICompilationUnit unit, ResourceMapping mapping) {
	ReorgExecutionLog log= (ReorgExecutionLog) getAdapter(ReorgExecutionLog.class);
	if (log != null) {
		log.markAsProcessed(unit);
		log.markAsProcessed(mapping);
	}
}
 
Example 30
Project: Eclipse-Postfix-Code-Completion   File: CreateCopyOfCompilationUnitChange.java   Source Code and License 5 votes vote down vote up
@Override
public Change perform(IProgressMonitor monitor) throws CoreException {
	ResourceMapping mapping= JavaElementResourceMapping.create(fOldCu);
	final Change result= super.perform(monitor);
	markAsExecuted(fOldCu, mapping);
	return result;
}
 
Example 31
Project: Eclipse-Postfix-Code-Completion   File: CopyModifications.java   Source Code and License 5 votes vote down vote up
public void copy(IPackageFragmentRoot sourceFolder, CopyArguments javaArgs, CopyArguments resourceArgs) {
	add(sourceFolder, javaArgs, null);
	ResourceMapping mapping= JavaElementResourceMapping.create(sourceFolder);
	if (mapping != null) {
		add(mapping, resourceArgs, null);
	}
	IResource sourceResource= sourceFolder.getResource();
	if (sourceResource != null) {
		getResourceModifications().addCopyDelta(sourceResource, resourceArgs);
		IFile classpath= getClasspathFile((IResource) resourceArgs.getDestination());
		if (classpath != null) {
			getResourceModifications().addChanged(classpath);
		}
	}
}
 
Example 32
Project: Eclipse-Postfix-Code-Completion   File: CopyModifications.java   Source Code and License 5 votes vote down vote up
public void copy(ICompilationUnit unit, CopyArguments javaArgs, CopyArguments resourceArgs) {
	add(unit, javaArgs, null);
	ResourceMapping mapping= JavaElementResourceMapping.create(unit);
	if (mapping != null) {
		add(mapping, resourceArgs, null);
	}
	if (unit.getResource() != null) {
		getResourceModifications().addCopyDelta(unit.getResource(), resourceArgs);
	}
}
 
Example 33
Project: Eclipse-Postfix-Code-Completion   File: MonitoringNewNameQueries.java   Source Code and License 5 votes vote down vote up
public INewNameQuery createNewCompilationUnitNameQuery(final ICompilationUnit cu, final String initialSuggestedName) {
	return new INewNameQuery() {
		public String getNewName() throws OperationCanceledException {
			String result= fDelegate.createNewCompilationUnitNameQuery(cu, initialSuggestedName).getNewName();
			String newName= JavaModelUtil.getRenamedCUName(cu, result);
			fExecutionLog.setNewName(cu, newName);
			ResourceMapping mapping= JavaElementResourceMapping.create(cu);
			if (mapping != null) {
				fExecutionLog.setNewName(mapping, newName);
			}
			return result;
		}
	};
}
 
Example 34
Project: Eclipse-Postfix-Code-Completion   File: MonitoringNewNameQueries.java   Source Code and License 5 votes vote down vote up
public INewNameQuery createNewPackageFragmentRootNameQuery(final IPackageFragmentRoot root, final String initialSuggestedName) {
	return new INewNameQuery() {
		public String getNewName() throws OperationCanceledException {
			String result= fDelegate.createNewPackageFragmentRootNameQuery(root, initialSuggestedName).getNewName();
			fExecutionLog.setNewName(root, result);
			ResourceMapping mapping= JavaElementResourceMapping.create(root);
			if (mapping != null) {
				fExecutionLog.setNewName(mapping, result);
			}
			return result;
		}
	};
}
 
Example 35
Project: Eclipse-Postfix-Code-Completion   File: MonitoringNewNameQueries.java   Source Code and License 5 votes vote down vote up
public INewNameQuery createNewPackageNameQuery(final IPackageFragment pack, final String initialSuggestedName) {
	return new INewNameQuery() {
		public String getNewName() throws OperationCanceledException {
			String result= fDelegate.createNewPackageNameQuery(pack, initialSuggestedName).getNewName();
			fExecutionLog.setNewName(pack, result);
			ResourceMapping mapping= JavaElementResourceMapping.create(pack);
			if (mapping != null) {
				int index= result.lastIndexOf('.');
				String newFolderName= index == -1 ? result : result.substring(index + 1);
				fExecutionLog.setNewName(mapping, newFolderName);
			}
			return result;
		}
	};
}
 
Example 36
Project: Eclipse-Postfix-Code-Completion   File: PackageFragmentRootReorgChange.java   Source Code and License 5 votes vote down vote up
@Override
public final Change perform(IProgressMonitor pm) throws CoreException, OperationCanceledException {
	pm.beginTask(getName(), 2);
	try {
		String newName= getNewResourceName();
		IPackageFragmentRoot root= getRoot();
		ResourceMapping mapping= JavaElementResourceMapping.create(root);
		final Change result= doPerformReorg(getDestinationProjectPath().append(newName), new SubProgressMonitor(pm, 1));
		markAsExecuted(root, mapping);
		return result;
	} finally {
		pm.done();
	}
}
 
Example 37
Project: Eclipse-Postfix-Code-Completion   File: PackageFragmentRootReorgChange.java   Source Code and License 5 votes vote down vote up
private void markAsExecuted(IPackageFragmentRoot root, ResourceMapping mapping) {
	ReorgExecutionLog log= (ReorgExecutionLog)getAdapter(ReorgExecutionLog.class);
	if (log != null) {
		log.markAsProcessed(root);
		log.markAsProcessed(mapping);
	}
}
 
Example 38
Project: Eclipse-Postfix-Code-Completion   File: CompilationUnitReorgChange.java   Source Code and License 5 votes vote down vote up
@Override
public final Change perform(IProgressMonitor pm) throws CoreException, OperationCanceledException {
	pm.beginTask(getName(), 1);
	try {
		ICompilationUnit unit= getCu();
		ResourceMapping mapping= JavaElementResourceMapping.create(unit);
		Change result= doPerformReorg(new SubProgressMonitor(pm, 1));
		markAsExecuted(unit, mapping);
		return result;
	} finally {
		pm.done();
	}
}
 
Example 39
Project: Eclipse-Postfix-Code-Completion   File: CompilationUnitReorgChange.java   Source Code and License 5 votes vote down vote up
private void markAsExecuted(ICompilationUnit unit, ResourceMapping mapping) {
	ReorgExecutionLog log= (ReorgExecutionLog)getAdapter(ReorgExecutionLog.class);
	if (log != null) {
		log.markAsProcessed(unit);
		log.markAsProcessed(mapping);
	}
}
 
Example 40
Project: Eclipse-Postfix-Code-Completion   File: PackageReorgChange.java   Source Code and License 5 votes vote down vote up
@Override
public final Change perform(IProgressMonitor pm) throws CoreException, OperationCanceledException {
	pm.beginTask(getName(), 1);
	try {
		IPackageFragment pack= getPackage();
		ResourceMapping mapping= JavaElementResourceMapping.create(pack);
		final Change result= doPerformReorg(pm);
		markAsExecuted(pack, mapping);
		return result;
	} finally {
		pm.done();
	}
}