本文整理汇总了Java中org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring类的典型用法代码示例。如果您正苦于以下问题:Java ProcessorBasedRefactoring类的具体用法?Java ProcessorBasedRefactoring怎么用?Java ProcessorBasedRefactoring使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessorBasedRefactoring类属于org.eclipse.ltk.core.refactoring.participants包,在下文中一共展示了ProcessorBasedRefactoring类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: startExtractSupertypeRefactoring
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
public static void startExtractSupertypeRefactoring(final IMember[] members, final Shell shell) throws JavaModelException {
if (!RefactoringAvailabilityTester.isExtractSupertypeAvailable(members))
return;
IJavaProject project= null;
if (members != null && members.length > 0)
project= members[0].getJavaProject();
ExtractSupertypeProcessor processor= new ExtractSupertypeProcessor(members, JavaPreferencesSettings.getCodeGenerationSettings(project));
Refactoring refactoring= new ProcessorBasedRefactoring(processor);
ExtractSupertypeWizard wizard= new ExtractSupertypeWizard(processor, refactoring);
new RefactoringStarter().activate(wizard, shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringSaveHelper.SAVE_REFACTORING);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:RefactoringExecutionStarter.java
示例17: startPullUpRefactoring
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
public static void startPullUpRefactoring(final IMember[] members, final Shell shell) throws JavaModelException {
if (!RefactoringAvailabilityTester.isPullUpAvailable(members))
return;
IJavaProject project= null;
if (members != null && members.length > 0)
project= members[0].getJavaProject();
PullUpRefactoringProcessor processor= new PullUpRefactoringProcessor(members, JavaPreferencesSettings.getCodeGenerationSettings(project));
Refactoring refactoring= new ProcessorBasedRefactoring(processor);
new RefactoringStarter().activate(new PullUpWizard(processor, refactoring), shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringSaveHelper.SAVE_REFACTORING);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:RefactoringExecutionStarter.java
示例18: startPushDownRefactoring
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
public static void startPushDownRefactoring(final IMember[] members, final Shell shell) throws JavaModelException {
if (!RefactoringAvailabilityTester.isPushDownAvailable(members))
return;
PushDownRefactoringProcessor processor= new PushDownRefactoringProcessor(members);
Refactoring refactoring= new ProcessorBasedRefactoring(processor);
PushDownWizard wizard= new PushDownWizard(processor, refactoring);
new RefactoringStarter().activate(wizard, shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringSaveHelper.SAVE_REFACTORING);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:RefactoringExecutionStarter.java
示例19: startIntroduceParameterObject
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
public static void startIntroduceParameterObject(IMethod method, Shell shell) throws CoreException {
RefactoringStatus availability= Checks.checkAvailability(method);
if (availability.hasError()){
MessageDialog.openError(shell, RefactoringMessages.RefactoringExecutionStarter_IntroduceParameterObject_problem_title, RefactoringMessages.RefactoringExecutionStarter_IntroduceParameterObject_problem_description);
return;
}
IntroduceParameterObjectDescriptor ipod= RefactoringSignatureDescriptorFactory.createIntroduceParameterObjectDescriptor();
ipod.setMethod(method);
IntroduceParameterObjectProcessor processor= new IntroduceParameterObjectProcessor(ipod);
final 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) {
final Object element= entry.getData();
IMethod superMethod= (IMethod) element;
availability= Checks.checkAvailability(superMethod);
if (availability.hasError()){
MessageDialog.openError(shell, RefactoringMessages.RefactoringExecutionStarter_IntroduceParameterObject_problem_title, RefactoringMessages.RefactoringExecutionStarter_IntroduceParameterObject_problem_description);
return;
}
String message= Messages.format(RefactoringMessages.RefactoringErrorDialogUtil_okToPerformQuestion, entry.getMessage());
if (element != null && MessageDialog.openQuestion(shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, message)) {
ipod= RefactoringSignatureDescriptorFactory.createIntroduceParameterObjectDescriptor();
ipod.setMethod(superMethod);
processor= new IntroduceParameterObjectProcessor(ipod);
}
else processor=null;
}
}
if (processor != null) {
Refactoring refactoring= new ProcessorBasedRefactoring(processor);
IntroduceParameterObjectWizard wizard= new IntroduceParameterObjectWizard(processor, refactoring);
new RefactoringStarter().activate(wizard, shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringSaveHelper.SAVE_REFACTORING);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:38,代码来源:RefactoringExecutionStarter.java
示例20: RenameElementWizard
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring; //导入依赖的package包/类
public RenameElementWizard(ProcessorBasedRefactoring refactoring, SaveHelper saveHelper, IRenameElementContext context) {
super(refactoring, DIALOG_BASED_USER_INTERFACE);
this.saveHelper = saveHelper;
this.context = context;
renameProcessor = (AbstractRenameProcessor) refactoring.getProcessor();
}
开发者ID:cplutte,项目名称:bts,代码行数:7,代码来源:RenameElementWizard.java
注:本文中的org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论