当前位置: 首页>>代码示例>>Java>>正文


Java CompositeChange.add方法代码示例

本文整理汇总了Java中org.eclipse.ltk.core.refactoring.CompositeChange.add方法的典型用法代码示例。如果您正苦于以下问题:Java CompositeChange.add方法的具体用法?Java CompositeChange.add怎么用?Java CompositeChange.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ltk.core.refactoring.CompositeChange的用法示例。


在下文中一共展示了CompositeChange.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postCreateChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
@Override
public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm)
    throws CoreException {
  if (fQualifiedNameSearchResult != null) {
    CompositeChange parent = (CompositeChange) fRenamePackageChange.getParent();
    try {
      /*
       * Sneak text changes in before the package rename to ensure
       * modified files are still at original location (see
       * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154238)
       */
      parent.remove(fRenamePackageChange);
      parent.add(
          fQualifiedNameSearchResult.getSingleChange(
              Changes.getModifiedFiles(participantChanges)));
    } finally {
      fQualifiedNameSearchResult = null;
      parent.add(fRenamePackageChange);
      fRenamePackageChange = null;
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:RenamePackageProcessor.java

示例2: createChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
public Change createChange(IProgressMonitor pm, INewNameQueries copyQueries) {
  IFile[] file = getFiles();
  IFolder[] folders = getFolders();
  ICompilationUnit[] cus = getCus();
  pm.beginTask("", cus.length + file.length + folders.length); // $NON-NLS-1$
  NewNameProposer nameProposer = new NewNameProposer();
  CompositeChange composite =
      new DynamicValidationStateChange(RefactoringCoreMessages.ReorgPolicy_copy);
  composite.markAsSynthetic();
  for (int i = 0; i < cus.length; i++) {
    composite.add(createChange(cus[i], nameProposer, copyQueries));
    pm.worked(1);
  }
  if (pm.isCanceled()) throw new OperationCanceledException();
  for (int i = 0; i < file.length; i++) {
    composite.add(createChange(file[i], nameProposer, copyQueries));
    pm.worked(1);
  }
  if (pm.isCanceled()) throw new OperationCanceledException();
  for (int i = 0; i < folders.length; i++) {
    composite.add(createChange(folders[i], nameProposer, copyQueries));
    pm.worked(1);
  }
  pm.done();
  return composite;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:ReorgPolicyFactory.java

示例3: createSimpleMoveChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
private Change createSimpleMoveChange(IProgressMonitor pm) {
  CompositeChange result =
      new DynamicValidationStateChange(RefactoringCoreMessages.ReorgPolicy_move);
  result.markAsSynthetic();
  IFile[] files = getFiles();
  IFolder[] folders = getFolders();
  ICompilationUnit[] cus = getCus();
  pm.beginTask("", files.length + folders.length + cus.length); // $NON-NLS-1$
  for (int i = 0; i < files.length; i++) {
    result.add(createChange(files[i]));
    pm.worked(1);
  }
  if (pm.isCanceled()) throw new OperationCanceledException();
  for (int i = 0; i < folders.length; i++) {
    result.add(createChange(folders[i]));
    pm.worked(1);
  }
  if (pm.isCanceled()) throw new OperationCanceledException();
  for (int i = 0; i < cus.length; i++) {
    result.add(createChange(cus[i]));
    pm.worked(1);
  }
  pm.done();
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ReorgPolicyFactory.java

示例4: createPackageFragmentRootDeleteChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
private static Change createPackageFragmentRootDeleteChange(IPackageFragmentRoot root)
    throws JavaModelException {
  IResource resource = root.getResource();
  if (resource != null && resource.isLinked()) {
    // XXX using this code is a workaround for jcore bug 31998
    // jcore cannot handle linked stuff
    // normally, we should always create DeletePackageFragmentRootChange
    CompositeChange composite =
        new DynamicValidationStateChange(
            RefactoringCoreMessages.DeleteRefactoring_delete_package_fragment_root);

    ClasspathChange change =
        ClasspathChange.removeEntryChange(root.getJavaProject(), root.getRawClasspathEntry());
    if (change != null) {
      composite.add(change);
    }
    Assert.isTrue(!Checks.isClasspathDelete(root)); // checked in preconditions
    composite.add(createDeleteChange(resource));

    return composite;
  } else {
    Assert.isTrue(!root.isExternal());
    // TODO remove the query argument
    return new DeletePackageFragmentRootChange(root, true, null);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:DeleteChangeCreator.java

示例5: getSingleChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
public Change getSingleChange(IFile[] alreadyTouchedFiles) {
  Collection<TextChange> values = fChanges.values();
  if (values.size() == 0) return null;

  CompositeChange result =
      new CompositeChange(RefactoringCoreMessages.QualifiedNameSearchResult_change_name);
  result.markAsSynthetic();
  List<IFile> files = Arrays.asList(alreadyTouchedFiles);
  for (Iterator<TextChange> iter = values.iterator(); iter.hasNext(); ) {
    TextFileChange change = (TextFileChange) iter.next();
    if (!files.contains(change.getFile())) {
      result.add(change);
    }
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:QualifiedNameSearchResult.java

示例6: createChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
public Change createChange(IProgressMonitor pm) throws CoreException {
  pm.beginTask("", fResourcesToMove.length); // $NON-NLS-1$
  try {
    CompositeChange compositeChange = new CompositeChange(getMoveDescription());
    compositeChange.markAsSynthetic();

    RefactoringChangeDescriptor descriptor = new RefactoringChangeDescriptor(createDescriptor());
    for (int i = 0; i < fResourcesToMove.length; i++) {
      MoveResourceChange moveChange = new MoveResourceChange(fResourcesToMove[i], fDestination);
      moveChange.setDescriptor(descriptor);
      compositeChange.add(moveChange);
    }
    return compositeChange;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:MoveResourcesProcessor.java

示例7: createChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
  pm.beginTask(RefactoringCoreMessages.DeleteResourcesProcessor_create_task, fResources.length);
  try {
    RefactoringChangeDescriptor descriptor = new RefactoringChangeDescriptor(createDescriptor());
    CompositeChange change =
        new CompositeChange(RefactoringCoreMessages.DeleteResourcesProcessor_change_name);
    change.markAsSynthetic();
    for (int i = 0; i < fResources.length; i++) {
      pm.worked(1);
      DeleteResourceChange dc =
          new DeleteResourceChange(fResources[i].getFullPath(), true, fDeleteContents);
      dc.setDescriptor(descriptor);
      change.add(dc);
    }
    return change;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:DeleteResourcesProcessor.java

示例8: insertChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
/**
 * Inserts a change at the specified index.
 * 
 * @param change the change to insert
 * @param insertIndex the index to insert at (if >= the number of children, it
 *          will be added to the end)
 * @param parentChange the new parent of the change
 */
public static void insertChange(Change change, int insertIndex,
    CompositeChange parentChange) {
  Change[] changes = parentChange.getChildren();

  if (insertIndex >= changes.length) {
    parentChange.add(change);
  } else {
    // CompositeChange.clear does not clear the parent field on the removed
    // changes, but CompositeChange.remove does
    for (Change curChange : changes) {
      parentChange.remove(curChange);
    }

    for (int i = 0; i < changes.length; i++) {
      if (i == insertIndex) {
        parentChange.add(change);
      }
      parentChange.add(changes[i]);
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:30,代码来源:ChangeUtilities.java

示例9: postCreateChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
@Override
public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException {
	if (fQualifiedNameSearchResult != null) {
		CompositeChange parent= (CompositeChange) fRenamePackageChange.getParent();
		try {
			/*
			 * Sneak text changes in before the package rename to ensure
			 * modified files are still at original location (see
			 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154238)
			 */
			parent.remove(fRenamePackageChange);
			parent.add(fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges)));
		} finally {
			fQualifiedNameSearchResult= null;
			parent.add(fRenamePackageChange);
			fRenamePackageChange= null;
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:RenamePackageProcessor.java

示例10: createChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
public Change createChange(IProgressMonitor pm, INewNameQueries copyQueries) {
	NewNameProposer nameProposer= new NewNameProposer();
	IPackageFragmentRoot[] roots= getPackageFragmentRoots();
	pm.beginTask("", roots.length); //$NON-NLS-1$
	CompositeChange composite= new DynamicValidationStateChange(RefactoringCoreMessages.ReorgPolicy_copy_source_folder);
	composite.markAsSynthetic();
	IJavaProject destination= getDestinationJavaProject();
	for (int i= 0; i < roots.length; i++) {
		if (destination == null) {
			composite.add(createChange(roots[i], (IContainer) getResourceDestination(), nameProposer, copyQueries));
		} else {
			composite.add(createChange(roots[i], destination, nameProposer, copyQueries));
		}
		pm.worked(1);
	}
	pm.done();
	return composite;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:ReorgPolicyFactory.java

示例11: createSimpleMoveChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
private Change createSimpleMoveChange(IProgressMonitor pm) {
	CompositeChange result= new DynamicValidationStateChange(RefactoringCoreMessages.ReorgPolicy_move);
	result.markAsSynthetic();
	IFile[] files= getFiles();
	IFolder[] folders= getFolders();
	ICompilationUnit[] cus= getCus();
	pm.beginTask("", files.length + folders.length + cus.length); //$NON-NLS-1$
	for (int i= 0; i < files.length; i++) {
		result.add(createChange(files[i]));
		pm.worked(1);
	}
	if (pm.isCanceled())
		throw new OperationCanceledException();
	for (int i= 0; i < folders.length; i++) {
		result.add(createChange(folders[i]));
		pm.worked(1);
	}
	if (pm.isCanceled())
		throw new OperationCanceledException();
	for (int i= 0; i < cus.length; i++) {
		result.add(createChange(cus[i]));
		pm.worked(1);
	}
	pm.done();
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:ReorgPolicyFactory.java

示例12: createPackageFragmentRootDeleteChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
private static Change createPackageFragmentRootDeleteChange(IPackageFragmentRoot root) throws JavaModelException {
	IResource resource= root.getResource();
	if (resource != null && resource.isLinked()){
		//XXX using this code is a workaround for jcore bug 31998
		//jcore cannot handle linked stuff
		//normally, we should always create DeletePackageFragmentRootChange
		CompositeChange composite= new DynamicValidationStateChange(RefactoringCoreMessages.DeleteRefactoring_delete_package_fragment_root);

		ClasspathChange change= ClasspathChange.removeEntryChange(root.getJavaProject(), root.getRawClasspathEntry());
		if (change != null) {
			composite.add(change);
		}
		Assert.isTrue(! Checks.isClasspathDelete(root));//checked in preconditions
		composite.add(createDeleteChange(resource));

		return composite;
	} else {
		Assert.isTrue(! root.isExternal());
		// TODO remove the query argument
		return new DeletePackageFragmentRootChange(root, true, null);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:23,代码来源:DeleteChangeCreator.java

示例13: createChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
public Change createChange(IProgressMonitor pm) throws JavaModelException {
	IPackageFragment[] fragments= getPackages();
	pm.beginTask("", fragments.length); //$NON-NLS-1$
	CompositeChange result= new DynamicValidationStateChange(RefactoringCoreMessages.ReorgPolicy_move_package);
	result.markAsSynthetic();
	IPackageFragmentRoot root= getDestinationAsPackageFragmentRoot();
	for (int i= 0; i < fragments.length; i++) {
		if (root == null) {
			result.add(createChange(fragments[i], (IContainer)getResourceDestination()));
		} else {
			result.add(createChange(fragments[i], root));
		}
		pm.worked(1);
		if (pm.isCanceled())
			throw new OperationCanceledException();
	}
	pm.done();
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:ReorgPolicyFactory.java

示例14: getSingleChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
public Change getSingleChange(IFile[] alreadyTouchedFiles) {
	Collection<TextChange> values= fChanges.values();
	if (values.size() == 0)
		return null;

	CompositeChange result= new CompositeChange(RefactoringCoreMessages.QualifiedNameSearchResult_change_name);
	result.markAsSynthetic();
	List<IFile> files= Arrays.asList(alreadyTouchedFiles);
	for (Iterator<TextChange> iter= values.iterator(); iter.hasNext();) {
		TextFileChange change= (TextFileChange)iter.next();
		if (!files.contains(change.getFile())) {
			result.add(change);
		}
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:QualifiedNameSearchResult.java

示例15: createChange

import org.eclipse.ltk.core.refactoring.CompositeChange; //导入方法依赖的package包/类
@Override
public Change createChange(IProgressMonitor pm)
	throws CoreException, OperationCanceledException
{
	if (editsPerFiles.isEmpty())
		return null;

	pm.beginTask("Searching for references.", editsPerFiles.size());
	final CompositeChange changes = new CompositeChange("Update mapper element ID");
	int workCount = 0;
	for (Entry<IFile, List<ReplaceEdit>> editsPerFile : editsPerFiles.entrySet())
	{
		IFile file = editsPerFile.getKey();
		TextChange change = new TextFileChange(file.getName(), file);
		TextEdit editRoot = new MultiTextEdit();
		change.setEdit(editRoot);
		for (ReplaceEdit edit : editsPerFile.getValue())
		{
			editRoot.addChild(edit);
		}
		changes.add(change);
		pm.worked(++workCount);
	}
	pm.done();
	return changes;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:27,代码来源:ElementRenameRefactoring.java


注:本文中的org.eclipse.ltk.core.refactoring.CompositeChange.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。