Search in sources :

Example 1 with RenameHandler

use of org.eclipse.wst.xsd.ui.internal.refactor.handlers.RenameHandler in project webtools.sourceediting by eclipse.

the class RefactoringSection method invokeRenameRefactoring.

/**
 * Invokes the refactor->rename action on the current selection.
 */
private void invokeRenameRefactoring() {
    IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    XSDSchema schema = (XSDSchema) editor.getAdapter(XSDSchema.class);
    ISelection selection = new StructuredSelection(input);
    ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class);
    selection = mapper != null ? mapper.mapSelection(selection) : selection;
    RenameHandler renameHandler = new RenameHandler();
    renameHandler.execute(selection, schema);
}
Also used : ISelectionMapper(org.eclipse.wst.xsd.ui.internal.editor.ISelectionMapper) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) RenameHandler(org.eclipse.wst.xsd.ui.internal.refactor.handlers.RenameHandler) IEditorPart(org.eclipse.ui.IEditorPart) XSDSchema(org.eclipse.xsd.XSDSchema)

Aggregations

ISelection (org.eclipse.jface.viewers.ISelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 IEditorPart (org.eclipse.ui.IEditorPart)1 ISelectionMapper (org.eclipse.wst.xsd.ui.internal.editor.ISelectionMapper)1 RenameHandler (org.eclipse.wst.xsd.ui.internal.refactor.handlers.RenameHandler)1 XSDSchema (org.eclipse.xsd.XSDSchema)1