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


Java RefactoringDescriptor类代码示例

本文整理汇总了Java中org.eclipse.ltk.core.refactoring.RefactoringDescriptor的典型用法代码示例。如果您正苦于以下问题:Java RefactoringDescriptor类的具体用法?Java RefactoringDescriptor怎么用?Java RefactoringDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: helper3

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
private void helper3(
    String oldName,
    String newName,
    boolean updateRef,
    boolean updateTextual,
    boolean updateSimilar,
    String nonJavaFiles)
    throws JavaModelException, CoreException, IOException, Exception {
  RefactoringDescriptor descriptor =
      initWithAllOptions(
          oldName,
          oldName,
          newName,
          updateRef,
          updateTextual,
          updateSimilar,
          nonJavaFiles,
          RenamingNameSuggestor.STRATEGY_EMBEDDED);
  Refactoring ref = createRefactoring(descriptor);
  RefactoringStatus status = performRefactoring(ref);
  Assert.assertNull("was supposed to pass", status);
  checkResultInClass(newName);
  checkMappedSimilarElementsExist(ref);
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:RenameTypeTest.java

示例2: helper3_inner

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
private void helper3_inner(
    String oldName,
    String oldInnerName,
    String newName,
    String innerNewName,
    boolean updateRef,
    boolean updateTextual,
    boolean updateSimilar,
    String nonJavaFiles)
    throws JavaModelException, CoreException, IOException, Exception {
  RefactoringDescriptor descriptor =
      initWithAllOptions(
          oldName,
          oldInnerName,
          innerNewName,
          updateRef,
          updateTextual,
          updateSimilar,
          nonJavaFiles,
          RenamingNameSuggestor.STRATEGY_EMBEDDED);
  Refactoring ref = createRefactoring(descriptor);
  Assert.assertNull("was supposed to pass", performRefactoring(ref));
  checkResultInClass(newName);
  checkMappedSimilarElementsExist(ref);
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:RenameTypeTest.java

示例3: helper3_fail

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
private void helper3_fail(
    String oldName,
    String newName,
    boolean updateSimilar,
    boolean updateTextual,
    boolean updateRef,
    int matchStrategy)
    throws JavaModelException, CoreException, IOException, Exception {
  RefactoringDescriptor descriptor =
      initWithAllOptions(
          oldName,
          oldName,
          newName,
          updateRef,
          updateTextual,
          updateSimilar,
          null,
          matchStrategy);
  Assert.assertNotNull("was supposed to fail", performRefactoring(descriptor));
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:RenameTypeTest.java

示例4: initWithAllOptions

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
private RefactoringDescriptor initWithAllOptions(
    String oldName,
    String innerOldName,
    String innerNewName,
    boolean updateReferences,
    boolean updateTextualMatches,
    boolean updateSimilar,
    String nonJavaFiles,
    int matchStrategy)
    throws Exception, JavaModelException, CoreException {
  ICompilationUnit cu = createCUfromTestFile(getPackageP(), oldName);
  IType classA = getType(cu, innerOldName);
  RenameJavaElementDescriptor descriptor = createRefactoringDescriptor(classA, innerNewName);
  setTheOptions(
      descriptor,
      updateReferences,
      updateTextualMatches,
      updateSimilar,
      nonJavaFiles,
      matchStrategy);
  return descriptor;
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:RenameTypeTest.java

示例5: createDescriptor

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
protected RenameResourceDescriptor createDescriptor() {
  IResource resource = getResource();

  RenameResourceDescriptor descriptor = new RenameResourceDescriptor();
  descriptor.setProject(resource instanceof IProject ? null : resource.getProject().getName());
  descriptor.setDescription(
      Messages.format(
          RefactoringCoreMessages.RenameResourceProcessor_description,
          BasicElementLabels.getResourceName(resource)));
  descriptor.setComment(
      Messages.format(
          RefactoringCoreMessages.RenameResourceProcessor_comment,
          new String[] {
            BasicElementLabels.getPathLabel(resource.getFullPath(), false),
            BasicElementLabels.getResourceName(getNewResourceName())
          }));
  descriptor.setFlags(
      RefactoringDescriptor.STRUCTURAL_CHANGE
          | RefactoringDescriptor.MULTI_CHANGE
          | RefactoringDescriptor.BREAKING_CHANGE);
  descriptor.setResourcePath(resource.getFullPath());
  descriptor.setNewName(getNewResourceName());
  descriptor.setUpdateReferences(isUpdateReferences());
  return descriptor;
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:RenameResourceProcessor.java

示例6: createDescriptor

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
protected MoveResourcesDescriptor createDescriptor() {
  MoveResourcesDescriptor descriptor = new MoveResourcesDescriptor();
  descriptor.setProject(fDestination.getProject().getName());
  descriptor.setDescription(getMoveDescription());
  if (fResourcesToMove.length <= 1) {
    descriptor.setComment(descriptor.getDescription());
  } else {
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < fResourcesToMove.length; i++) {
      if (i > 0) buf.append(", "); // $NON-NLS-1$
      buf.append(fResourcesToMove[i].getName());
    }
    descriptor.setComment(
        Messages.format(
            RefactoringCoreMessages.MoveResourceProcessor_comment,
            new String[] {buf.toString(), BasicElementLabels.getResourceName(fDestination)}));
  }
  descriptor.setFlags(
      RefactoringDescriptor.STRUCTURAL_CHANGE
          | RefactoringDescriptor.MULTI_CHANGE
          | RefactoringDescriptor.BREAKING_CHANGE);
  descriptor.setDestination(fDestination);
  descriptor.setUpdateReferences(isUpdateReferences());
  descriptor.setResourcesToMove(fResourcesToMove);
  return descriptor;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:MoveResourcesProcessor.java

示例7: retrieveArgumentMap

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
public Map retrieveArgumentMap(RefactoringDescriptor descriptor) {
  if (descriptor instanceof DeleteResourcesDescriptor) {
    DeleteResourcesDescriptor deleteDesc = (DeleteResourcesDescriptor) descriptor;
    HashMap map = new HashMap();
    IPath[] resources = deleteDesc.getResourcePaths();
    String project = deleteDesc.getProject();
    map.put(ATTRIBUTE_NUMBER_OF_RESOURCES, String.valueOf(resources.length));
    for (int i = 0; i < resources.length; i++) {
      map.put(
          ATTRIBUTE_ELEMENT + (i + 1),
          ResourceProcessors.resourcePathToHandle(project, resources[i]));
    }

    map.put(ATTRIBUTE_DELETE_CONTENTS, deleteDesc.isDeleteContents() ? TRUE : FALSE);
    return map;
  }
  return Collections.EMPTY_MAP;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:DeleteResourcesRefactoringContribution.java

示例8: retrieveArgumentMap

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
public Map retrieveArgumentMap(final RefactoringDescriptor descriptor) {
  HashMap map = new HashMap();

  if (descriptor instanceof RenameResourceDescriptor) {
    RenameResourceDescriptor resourceDescriptor = (RenameResourceDescriptor) descriptor;
    map.put(
        ATTRIBUTE_INPUT,
        ResourceProcessors.resourcePathToHandle(
            descriptor.getProject(), resourceDescriptor.getResourcePath()));
    map.put(ATTRIBUTE_NAME, resourceDescriptor.getNewName());
    map.put(
        ATTRIBUTE_UPDATE_REFERENCES,
        resourceDescriptor.isUpdateReferences() ? "true" : "false"); // $NON-NLS-1$//$NON-NLS-2$
    return map;
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:RenameResourceRefactoringContribution.java

示例9: createDescriptor

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
public RefactoringDescriptor createDescriptor(
    String id, String project, String description, String comment, Map arguments, int flags) {
  String pathString = (String) arguments.get(ATTRIBUTE_INPUT);
  String newName = (String) arguments.get(ATTRIBUTE_NAME);

  boolean updateReferences =
      "true".equals(arguments.get(ATTRIBUTE_UPDATE_REFERENCES)); // $NON-NLS-1$

  if (pathString != null && newName != null) {
    IPath path = ResourceProcessors.handleToResourcePath(project, pathString);
    RenameResourceDescriptor descriptor = new RenameResourceDescriptor();
    descriptor.setProject(project);
    descriptor.setDescription(description);
    descriptor.setComment(comment);
    descriptor.setFlags(flags);
    descriptor.setNewName(newName);
    descriptor.setResourcePath(path);
    descriptor.setUpdateReferences(updateReferences);
    return descriptor;
  }
  throw new IllegalArgumentException(
      "Can not restore RenameResourceDescriptor from map"); // $NON-NLS-1$
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:RenameResourceRefactoringContribution.java

示例10: retrieveArgumentMap

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
public Map retrieveArgumentMap(final RefactoringDescriptor descriptor) {
  HashMap map = new HashMap();

  if (descriptor instanceof MoveResourcesDescriptor) {
    MoveResourcesDescriptor moveDescriptor = (MoveResourcesDescriptor) descriptor;
    IPath[] paths = moveDescriptor.getResourcePathsToMove();
    String project = moveDescriptor.getProject();
    IPath destinationPath = moveDescriptor.getDestinationPath();

    map.put(ATTRIBUTE_NUMBER_OF_RESOURCES, String.valueOf(paths.length));
    for (int i = 0; i < paths.length; i++) {
      map.put(
          ATTRIBUTE_ELEMENT + (i + 1),
          ResourceProcessors.resourcePathToHandle(project, paths[i]));
    }
    map.put(
        ATTRIBUTE_DESTINATION, ResourceProcessors.resourcePathToHandle(project, destinationPath));
    map.put(
        ATTRIBUTE_UPDATE_REFERENCES,
        moveDescriptor.isUpdateReferences() ? "true" : "false"); // $NON-NLS-1$//$NON-NLS-2$
    return map;
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:MoveResourcesRefactoringContribution.java

示例11: sortRefactoringDescriptorsAscending

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
/**
 * Sorts the refactoring descriptor proxies in ascending order of their time stamps.
 *
 * @param descriptors the refactoring descriptors
 */
public static void sortRefactoringDescriptorsAscending(
    final RefactoringDescriptor[] descriptors) {
  Arrays.sort(
      descriptors,
      new Comparator() {

        public final int compare(final Object first, final Object second) {
          final RefactoringDescriptor predecessor = (RefactoringDescriptor) first;
          final RefactoringDescriptor successor = (RefactoringDescriptor) second;
          final long delta = predecessor.getTimeStamp() - successor.getTimeStamp();
          if (delta > 0) return 1;
          else if (delta < 0) return -1;
          return 0;
        }
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:RefactoringHistoryManager.java

示例12: createDescriptor

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
/**
 * Creates a new refactoring descriptor for the specified input data.
 *
 * @param id the unique id of the refactoring
 * @param project the project name, or <code>null</code>
 * @param description a description
 * @param comment the comment, or <code>null</code>
 * @param arguments the argument map
 * @param flags the flags
 * @return the refactoring descriptor
 * @throws IllegalArgumentException if the argument map contains invalid keys/values
 */
public RefactoringDescriptor createDescriptor(
    final String id,
    final String project,
    final String description,
    final String comment,
    final Map arguments,
    final int flags)
    throws IllegalArgumentException {
  Assert.isNotNull(id);
  Assert.isNotNull(description);
  Assert.isNotNull(arguments);
  Assert.isLegal(flags >= RefactoringDescriptor.NONE);
  final RefactoringContribution contribution = getRefactoringContribution(id);
  if (contribution != null)
    return contribution.createDescriptor(id, project, description, comment, arguments, flags);
  return new DefaultRefactoringDescriptor(id, project, description, comment, arguments, flags);
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:RefactoringContributionManager.java

示例13: filterRefactoringDescriptors

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
/**
 * Filters the given array of refactoring proxies and returns the result in the specified
 * refactoring descriptor proxy set.
 *
 * <p>Clients wishing to benefit from the resolving of refactoring descriptors to determine its
 * flags can set resolve to <code>true</code> if they would like to have resolved refactoring
 * descriptor proxies as result.
 *
 * @param proxies the refactoring descriptor proxies
 * @param set the result set
 * @param resolve <code>true</code> to return the filtered refactoring descriptors as resolved
 *     refactoring proxies, <code>false</code> otherwise
 * @param flags the refactoring descriptor flags which must be present in order to be returned in
 *     the refactoring history object
 * @param monitor the progress monitor to use
 */
private static void filterRefactoringDescriptors(
    final RefactoringDescriptorProxy[] proxies,
    final Set set,
    final boolean resolve,
    final int flags,
    final IProgressMonitor monitor) {
  Assert.isTrue(flags > RefactoringDescriptor.NONE);
  try {
    monitor.beginTask(
        RefactoringCoreMessages.RefactoringHistoryService_retrieving_history, proxies.length);
    for (int offset = 0; offset < proxies.length; offset++) {
      final RefactoringDescriptor descriptor =
          proxies[offset].requestDescriptor(new SubProgressMonitor(monitor, 1));
      if (descriptor != null) {
        final int filter = descriptor.getFlags();
        if ((filter | flags) == filter) {
          if (resolve) set.add(new RefactoringDescriptorProxyAdapter(descriptor));
          else set.add(proxies[offset]);
        }
      }
    }
  } finally {
    monitor.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:42,代码来源:RefactoringHistoryService.java

示例14: readRefactoringHistory

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
/** {@inheritDoc} */
public RefactoringHistory readRefactoringHistory(final InputStream stream, final int flags)
    throws CoreException {
  Assert.isNotNull(stream);
  Assert.isTrue(flags >= RefactoringDescriptor.NONE);
  final List list = new ArrayList();
  final RefactoringSessionDescriptor descriptor =
      new RefactoringSessionReader(false, null).readSession(new InputSource(stream));
  if (descriptor != null) {
    final RefactoringDescriptor[] descriptors = descriptor.getRefactorings();
    if (flags > RefactoringDescriptor.NONE) {
      for (int index = 0; index < descriptors.length; index++) {
        final int current = descriptors[index].getFlags();
        if ((current | flags) == current) list.add(descriptors[index]);
      }
    } else list.addAll(Arrays.asList(descriptors));
  }
  final RefactoringDescriptorProxy[] proxies = new RefactoringDescriptorProxy[list.size()];
  for (int index = 0; index < list.size(); index++)
    proxies[index] =
        new RefactoringDescriptorProxyAdapter((RefactoringDescriptor) list.get(index));
  return new RefactoringHistoryImplementation(proxies);
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:RefactoringHistoryService.java

示例15: processHistoryNotification

import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; //导入依赖的package包/类
/**
 * Processes the history event.
 *
 * @param store the file store
 * @param event the history event
 * @param name the project name, or <code>null</code>
 * @throws CoreException if an error occurs
 */
private void processHistoryNotification(
    final IFileStore store, final RefactoringHistoryEvent event, final String name)
    throws CoreException {
  final RefactoringDescriptorProxy proxy = event.getDescriptor();
  final int type = event.getEventType();
  final RefactoringHistoryManager manager = new RefactoringHistoryManager(store, name);
  final NullProgressMonitor monitor = new NullProgressMonitor();
  if (type == RefactoringHistoryEvent.PUSHED || type == RefactoringHistoryEvent.ADDED) {
    final RefactoringDescriptor descriptor = proxy.requestDescriptor(monitor);
    if (descriptor != null)
      manager.addRefactoringDescriptor(
          descriptor, type == RefactoringHistoryEvent.ADDED, monitor);
  } else if (type == RefactoringHistoryEvent.POPPED)
    manager.removeRefactoringDescriptors(
        new RefactoringDescriptorProxy[] {proxy},
        monitor,
        RefactoringCoreMessages.RefactoringHistoryService_updating_history);
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:RefactoringHistorySerializer.java


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