org.eclipse.ltk.core.refactoring.participants.RenameProcessor Java Examples
The following examples show how to use
org.eclipse.ltk.core.refactoring.participants.RenameProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractProcessorBasedRenameParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException { SubMonitor progress = SubMonitor.convert(pm).setWorkRemaining(100 * wrappedProcessors.size()); try { for (RenameProcessor wrappedProcessor : wrappedProcessors) { List<Object> targetElements = Arrays.asList(wrappedProcessor.getElements()); if (!disabledTargets.containsAll(targetElements)) { setNewName(wrappedProcessor, getNewName()); status.merge(wrappedProcessor.checkInitialConditions(progress.newChild(20))); if(!status.getRefactoringStatus().hasFatalError()) status.merge(wrappedProcessor.checkFinalConditions(progress.newChild(80), context)); } } } catch (OperationCanceledException e) { throw e; } catch (Exception ce) { status.add(ERROR, "Error checking conditions in refactoring participant: {0}. See log for details", ce, LOG); } return status.getRefactoringStatus(); }
Example #2
Source File: DefaultRenameRefactoringProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public ProcessorBasedRefactoring getRenameRefactoring(IRenameElementContext renameElementContext) { RenameProcessor processor = getRenameProcessor(renameElementContext); if (processor != null) { return new RenameRefactoring(processor); } return null; }
Example #3
Source File: RenameUserInterfaceStarter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException { RenameProcessor processor= (RenameProcessor)refactoring.getAdapter(RenameProcessor.class); Object[] elements= processor.getElements(); RenameSelectionState state= elements.length == 1 ? new RenameSelectionState(elements[0]) : null; boolean executed= super.activate(refactoring, parent, saveMode); INameUpdating nameUpdating= (INameUpdating)refactoring.getAdapter(INameUpdating.class); if (executed && nameUpdating != null && state != null) { Object newElement= nameUpdating.getNewElement(); if (newElement != null) { state.restore(newElement); } } return executed; }
Example #4
Source File: RenameUserInterfaceStarter.java From typescript.java with MIT License | 5 votes |
public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException { RenameProcessor processor = (RenameProcessor) refactoring.getAdapter(RenameProcessor.class); Object[] elements = processor.getElements(); RenameSelectionState state = null;//elements.length == 1 ? new RenameSelectionState(elements[0]) : null; boolean executed = super.activate(refactoring, parent, saveMode); TypeScriptRenameProcessor nameUpdating = (TypeScriptRenameProcessor) refactoring .getAdapter(TypeScriptRenameProcessor.class); if (executed && nameUpdating != null && state != null) { // Object newElement = nameUpdating.getNewElement(); // if (newElement != null) { // state.restore(newElement); // } } return executed; }
Example #5
Source File: RenameSupport.java From typescript.java with MIT License | 5 votes |
private RenameSelectionState createSelectionState() { RenameProcessor processor = (RenameProcessor) fRefactoring.getAdapter(RenameProcessor.class); Object[] elements = processor.getElements(); RenameSelectionState state = null;// elements.length == 1 ? new // RenameSelectionState(elements[0]) // : null; return state; }
Example #6
Source File: JdtRenameParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected RenameProcessor getRenameProcessor(IRenameElementContext participantContext) { RenameProcessor renameProcessor = super.getRenameProcessor(participantContext); // We need to do all changes for one language inside the same processor in order to be able to // restructure them to avoid collisions. That's why we add all processors to the same composite // which is only returned in the first context. CompositeRefactoringProcessor current = compositeRefactoringProcessorAccess.getCurrent(getProcessor()); current.addProcessor(renameProcessor); if (current.getNumProcessors() == 1) return current; else return null; }
Example #7
Source File: CombinedJvmJdtRenameRefactoringProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public RenameProcessor getRenameProcessor(IRenameElementContext renameElementContext) { RenameElementProcessor processor = null; if (renameElementContext instanceof JvmModelJdtRenameParticipantContext) processor = jdtRenameParticipantProcessorProvider.get(); else if (renameElementContext instanceof CombinedJvmJdtRenameContext) processor = combinedRenameProcessorProvider.get(); if (processor != null) { if (processor.initialize(renameElementContext)) return processor; else return null; } return super.getRenameProcessor(renameElementContext); }
Example #8
Source File: CombinedJvmJdtRenameRefactoringProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public ProcessorBasedRefactoring getRenameRefactoring(IRenameElementContext renameElementContext) { if (renameElementContext instanceof CombinedJvmJdtRenameContext) { RenameProcessor renameProcessor = getRenameProcessor(renameElementContext); if (renameProcessor != null) { return createChangeCombiningRefactoring(renameProcessor); } return null; } return super.getRenameRefactoring(renameElementContext); }
Example #9
Source File: AbstractProcessorBasedRenameParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public Object[] getElements() { List<Object> elements = newArrayList(); for (RenameProcessor wrappedProcessor : wrappedProcessors) { elements.addAll(Arrays.asList(wrappedProcessor.getElements())); } return toArray(elements, Object.class); }
Example #10
Source File: AbstractProcessorBasedRenameParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected RenameProcessor getRenameProcessor(IRenameElementContext participantContext) { IRenameRefactoringProvider renameRefactoringProvider = getRenameRefactoringProvider(participantContext); if (renameRefactoringProvider != null) return renameRefactoringProvider.getRenameProcessor(participantContext); else return null; }
Example #11
Source File: AbstractProcessorBasedRenameParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected List<RenameProcessor> getRenameProcessors(Object originalTargetElement) { List<? extends IRenameElementContext> participantContexts = createRenameElementContexts(originalTargetElement); if (participantContexts != null) { List<RenameProcessor> processors = newArrayList(); for (IRenameElementContext participantContext : participantContexts) { RenameProcessor renameProcessor = getRenameProcessor(participantContext); if (renameProcessor != null) { processors.add(renameProcessor); } } return processors; } return null; }
Example #12
Source File: DefaultRenameRefactoringProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public RenameProcessor getRenameProcessor(IRenameElementContext renameElementContext) { AbstractRenameProcessor processor = processorProvider.get(); if (processor != null && processor.initialize(renameElementContext)) { return processor; } return null; }
Example #13
Source File: AbstractProcessorBasedRenameParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected void setNewName(RenameProcessor processor, String newName) { ((AbstractRenameProcessor) processor).setNewName(newName); }
Example #14
Source File: CombinedJvmJdtRenameRefactoringProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected ProcessorBasedRefactoring createChangeCombiningRefactoring(RenameProcessor renameProcessor) { return new ChangeCombiningRenameRefactoring(renameProcessor, textChangeCombiner); }
Example #15
Source File: DefaultRenameRefactoringProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public RenameRefactoring(RenameProcessor processor) { super(processor); Assert.isNotNull(processor); fProcessor= processor; }
Example #16
Source File: RenameSupport.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private RenameSelectionState createSelectionState() { RenameProcessor processor= (RenameProcessor) fRefactoring.getProcessor(); Object[] elements= processor.getElements(); RenameSelectionState state= elements.length == 1 ? new RenameSelectionState(elements[0]) : null; return state; }
Example #17
Source File: TypeScriptRenameRefactoring.java From typescript.java with MIT License | 2 votes |
/** * Creates a new java rename refactoring. * * @param processor * the rename processor to use */ public TypeScriptRenameRefactoring(final RenameProcessor processor) { super(processor); }
Example #18
Source File: IRenameRefactoringProvider.java From xtext-eclipse with Eclipse Public License 2.0 | votes |
RenameProcessor getRenameProcessor(IRenameElementContext renameElementContext);