use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project eclipse.platform.text by eclipse.
the class ReplaceAction method run.
@Override
public void run() {
try {
ReplaceRefactoring refactoring = new ReplaceRefactoring(fResult, fSelection);
ReplaceWizard refactoringWizard = new ReplaceWizard(refactoring);
if (fSelection == null) {
refactoringWizard.setDefaultPageTitle(SearchMessages.ReplaceAction_title_all);
} else {
refactoringWizard.setDefaultPageTitle(SearchMessages.ReplaceAction_title_selected);
}
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(refactoringWizard);
op.run(fShell, SearchMessages.ReplaceAction_description_operation);
} catch (InterruptedException e) {
// refactoring got cancelled
}
}
use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project erlide_eclipse by erlang.
the class MoveFunctionDropHandler method handleDrop.
@Override
public IStatus handleDrop(final CommonDropAdapter dropAdapter, final DropTargetEvent dropTargetEvent, final Object target) {
// get the source data
final TransferData td = dropAdapter.getCurrentTransfer();
final ISelection sel = (ISelection) LocalSelectionTransfer.getTransfer().nativeToJava(td);
final TreeSelection s = (TreeSelection) sel;
try {
GlobalParameters.setSelection(s);
} catch (final WranglerException e1) {
e1.printStackTrace();
}
// get the target data
String moduleName;
IFile file;
if (target instanceof IFile) {
file = (IFile) target;
} else {
file = (IFile) ((IErlElement) target).getResource();
}
moduleName = file.getName();
moduleName = moduleName.substring(0, moduleName.lastIndexOf("."));
final MoveFunctionRefactoring refactoring = new MoveFunctionRefactoring();
refactoring.setUserInput(moduleName);
final RefactoringWizard wizard = new DefaultWranglerRefactoringWizard(refactoring, RefactoringWizard.DIALOG_BASED_USER_INTERFACE, new ArrayList<WranglerPage>());
final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
final RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
try {
op.run(shell, refactoring.getName());
} catch (final Exception e) {
ErlLogger.error(e);
}
return Status.OK_STATUS;
}
use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project webtools.sourceediting by eclipse.
the class RenameComponentAction method run.
public void run(ISelection selection) {
if (selectedComponent.getName() == null) {
selectedComponent.setName(new String());
}
if (selectedComponent.getSchema() == null) {
if (getSchema() != null) {
getSchema().updateElement(true);
}
}
boolean rc = SaveDirtyFilesDialog.saveDirtyFiles();
if (!rc) {
return;
}
RefactoringComponent component = new XMLRefactoringComponent(selectedComponent, (IDOMElement) selectedComponent.getElement(), selectedComponent.getName(), selectedComponent.getTargetNamespace());
RenameComponentProcessor processor = new RenameComponentProcessor(component, selectedComponent.getName());
RenameRefactoring refactoring = new RenameRefactoring(processor);
try {
RefactoringWizard wizard = new RenameRefactoringWizard(refactoring, RefactoringWizardMessages.RenameComponentWizard_defaultPageTitle, RefactoringWizardMessages.RenameComponentWizard_inputPage_description, null);
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
op.run(XSDEditorPlugin.getShell(), wizard.getDefaultPageTitle());
// TODO (cs) I'm not sure why we need to do this. See bug 145700
// triggerBuild();
} catch (InterruptedException e) {
// do nothing. User action got cancelled
}
}
use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project webtools.sourceediting by eclipse.
the class MakeAnonymousTypeGlobalAction method run1.
public void run1() {
if (fSelectedComponent == null) {
return;
}
if (fSelectedComponent.getSchema() == null) {
getSchema().updateElement(true);
}
MakeTypeGlobalProcessor processor = new MakeTypeGlobalProcessor(fSelectedComponent, getNewDefaultName());
RenameRefactoring refactoring = new RenameRefactoring(processor);
try {
RefactoringWizard wizard = new RenameRefactoringWizard(refactoring, // TODO: provide correct strings
RefactoringWizardMessages.RenameComponentWizard_defaultPageTitle, RefactoringWizardMessages.RenameComponentWizard_inputPage_description, null);
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
op.run(XSDEditorPlugin.getShell(), wizard.getDefaultPageTitle());
// triggerBuild();
} catch (InterruptedException e) {
// do nothing. User action got cancelled
}
}
use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project webtools.sourceediting by eclipse.
the class RenameTargetNamespaceAction method run.
public void run(ISelection selection) {
RenameTargetNamespaceProcessor processor = new RenameTargetNamespaceProcessor(getSchema(), getSchema().getTargetNamespace());
RenameRefactoring refactoring = new RenameRefactoring(processor);
try {
RefactoringWizard wizard = new RenameRefactoringWizard(refactoring, // TODO: provide correct strings
RefactoringWizardMessages.RenameComponentWizard_defaultPageTitle, RefactoringWizardMessages.RenameComponentWizard_inputPage_description, null);
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
op.run(XSDEditorPlugin.getShell(), wizard.getDefaultPageTitle());
triggerBuild();
} catch (InterruptedException e) {
// do nothing. User action got cancelled
}
}
Aggregations