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


Java ProcessorBasedRefactoring类代码示例

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


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

示例1: createRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
public static ProcessorBasedRefactoring createRefactoring(IMethod[] methods, Optional<IProgressMonitor> monitor)
		throws JavaModelException {
	IJavaProject project = null;

	if (methods != null && methods.length > 0)
		project = methods[0].getJavaProject();

	return createRefactoring(project, methods, monitor);
}
 
开发者ID:ponder-lab,项目名称:Migrate-Skeletal-Implementation-to-Interface-Refactoring,代码行数:10,代码来源:Util.java

示例2: isApplicable

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
protected boolean isApplicable(Shell parent, ProcessorBasedRefactoring refactoring) {
	try {
		if (refactoring.isApplicable()) {
			return true;
		}
		showFatalErrorMessage(parent, "Refactoring is not applicable");
	} catch (CoreException e) {
		LOG.error("Error detecting applicability of refactoring", e);
		showFatalErrorMessage(parent, "Cannot apply refactoring. See log for details.");
	}
	return false;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:RenameRefactoringExecuter.java

示例3: getRenameRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
public ProcessorBasedRefactoring getRenameRefactoring(IRenameElementContext renameElementContext) {
	RenameProcessor processor = getRenameProcessor(renameElementContext);
	if (processor != null) {
		return new RenameRefactoring(processor);
	}
	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:8,代码来源:DefaultRenameRefactoringProvider.java

示例4: helper1

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
private void helper1(String[] newNames, String[] signature) throws Exception {
  ICompilationUnit cu = createCUfromTestFile(getPackageP(), true, true);
  IType classA = getType(cu, "A");
  IMethod method = classA.getMethod("m", signature);
  Assert.assertTrue(
      "refactoring not available",
      RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
  ChangeSignatureProcessor processor = new ChangeSignatureProcessor(method);
  Refactoring ref = new ProcessorBasedRefactoring(processor);
  // ref.setUpdateReferences(updateReferences);
  // ref.setNewParameterNames(newNames);
  // ref.setNewNames(createRenamings(method, newNames));
  modifyInfos(processor.getParameterInfos(), newNames);

  RefactoringStatus result = performRefactoring(ref);
  Assert.assertEquals("precondition was supposed to pass", null, result);

  IPackageFragment pack = (IPackageFragment) cu.getParent();
  String newCuName = getSimpleTestFileName(true, true);
  ICompilationUnit newcu = pack.getCompilationUnit(newCuName);
  Assert.assertTrue(newCuName + " does not exist", newcu.exists());
  Assert.assertEquals(
      "invalid renaming",
      getFileContents(getTestFileName(true, false)).length(),
      newcu.getSource().length());
  assertEqualLines(
      "invalid renaming", getFileContents(getTestFileName(true, false)), newcu.getSource());
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:RenameParametersTest.java

示例5: helper2

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
private void helper2(String[] newNames, String[] signature) throws Exception {
  IType classA = getType(createCUfromTestFile(getPackageP(), false, false), "A");
  // DebugUtils.dump("classA" + classA);
  IMethod method = classA.getMethod("m", signature);
  Assert.assertTrue(
      "refactoring not available",
      RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
  ChangeSignatureProcessor processor = new ChangeSignatureProcessor(method);
  Refactoring ref = new ProcessorBasedRefactoring(processor);
  modifyInfos(processor.getParameterInfos(), newNames);

  RefactoringStatus result = performRefactoring(ref);
  Assert.assertNotNull("precondition was supposed to fail", result);
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:RenameParametersTest.java

示例6: createChangeForMethodRename

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
private Change createChangeForMethodRename(IMethod methodToRename)
    throws RefactoringException {
  MethodRenameChangeBuilder builder = new MethodRenameChangeBuilder(
      methodToRename, newMethodName, processor,
      methodToRename.getJavaProject().getProject().getWorkspace());

  ProcessorBasedRefactoring refactoring = (ProcessorBasedRefactoring) builder.createRefactoring();
  RefactoringProcessor nestedProcessor = refactoring.getProcessor();
  NestedRefactoringContext.storeForProcessor(
      nestedProcessor,
      MethodRenameRefactoringContext.newNestedRefactoringContext(refactoringContext));

  return builder.createChange();
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:15,代码来源:PairedMethodRenameParticipant.java

示例7: createChangeForInterfaceRename

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
private Change createChangeForInterfaceRename() throws RefactoringException {
  InterfaceRenameChangeBuilder builder = new InterfaceRenameChangeBuilder(
      typeContainer.getPairedType(),
      pairedNewName,
      processor,
      typeContainer.getPairedType().getJavaProject().getProject().getWorkspace());

  ProcessorBasedRefactoring refactoring = (ProcessorBasedRefactoring) builder.createRefactoring();
  RefactoringProcessor nestedProcessor = refactoring.getProcessor();
  NestedRefactoringContext.storeForProcessor(
      nestedProcessor,
      InterfaceRenameRefactoringContext.newNestedRefactoringContext(typeContainer.getBaseType()));

  return builder.createChange();
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:16,代码来源:PairedInterfaceRenameParticipant.java

示例8: createRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public final Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException {
	JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
	PushDownRefactoringProcessor processor= new PushDownRefactoringProcessor(arguments, status);
	return new ProcessorBasedRefactoring(processor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:PushDownRefactoringContribution.java

示例9: createRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public final Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException {
	JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
	UseSuperTypeProcessor processor= new UseSuperTypeProcessor(arguments, status);
	return new ProcessorBasedRefactoring(processor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:UseSupertypeRefactoringContribution.java

示例10: createRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public final Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException {
	JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
	PullUpRefactoringProcessor processor= new PullUpRefactoringProcessor(arguments, status);
	return new ProcessorBasedRefactoring(processor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:PullUpRefactoringContribution.java

示例11: createRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public final Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException {
	JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
	ExtractSupertypeProcessor processor= new ExtractSupertypeProcessor(arguments, status);
	return new ProcessorBasedRefactoring(processor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:ExtractSupertypeRefactoringContribution.java

示例12: createRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
@Override
public Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException {
	if (descriptor instanceof IntroduceParameterObjectDescriptor) {
		IntroduceParameterObjectProcessor processor= new IntroduceParameterObjectProcessor((IntroduceParameterObjectDescriptor) descriptor);
		return new ProcessorBasedRefactoring(processor);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:IntroduceParameterObjectContribution.java

示例13: createRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException {
	JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
	ChangeSignatureProcessor processor= new ChangeSignatureProcessor(arguments, status);
	return new ProcessorBasedRefactoring(processor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:ChangeMethodSignatureRefactoringContribution.java

示例14: createRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public final Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException {
	JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
	ExtractInterfaceProcessor processor= new ExtractInterfaceProcessor(arguments, status);
	return new ProcessorBasedRefactoring(processor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:ExtractInterfaceRefactoringContribution.java

示例15: startChangeSignatureRefactoring

import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
public static void startChangeSignatureRefactoring(final IMethod method, final SelectionDispatchAction action, final Shell shell) throws JavaModelException {
	if (!RefactoringAvailabilityTester.isChangeSignatureAvailable(method))
		return;
	try {
		ChangeSignatureProcessor processor= new ChangeSignatureProcessor(method);
		RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor());
		if (status.hasFatalError()) {
			final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
			if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
				Object element= entry.getData();
				if (element != null) {
					String message= Messages.format(RefactoringMessages.RefactoringErrorDialogUtil_okToPerformQuestion, entry.getMessage());
					if (MessageDialog.openQuestion(shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, message)) {
						IStructuredSelection selection= new StructuredSelection(element);
						// TODO: should not hijack this
						// ModifiyParametersAction.
						// The action is set up on an editor, but we use it
						// as if it were set up on a ViewPart.
						boolean wasEnabled= action.isEnabled();
						action.selectionChanged(selection);
						if (action.isEnabled()) {
							action.run(selection);
						} else {
							MessageDialog.openInformation(shell, ActionMessages.ModifyParameterAction_problem_title, ActionMessages.ModifyParameterAction_problem_message);
						}
						action.setEnabled(wasEnabled);
					}
				}
				return;
			}
		}

		Refactoring refactoring= new ProcessorBasedRefactoring(processor);
		ChangeSignatureWizard wizard= new ChangeSignatureWizard(processor, refactoring);
		new RefactoringStarter().activate(wizard, shell, wizard.getDefaultPageTitle(), RefactoringSaveHelper.SAVE_REFACTORING);
	} catch (CoreException e) {
		ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.RefactoringStarter_unexpected_exception);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:40,代码来源:RefactoringExecutionStarter.java


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