Search in sources :

Example 11 with RefactoringWizardOpenOperation

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
    }
}
Also used : RefactoringWizardOpenOperation(org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation)

Example 12 with RefactoringWizardOpenOperation

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;
}
Also used : IFile(org.eclipse.core.resources.IFile) MoveFunctionRefactoring(org.erlide.wrangler.refactoring.core.internal.MoveFunctionRefactoring) WranglerException(org.erlide.wrangler.refactoring.exception.WranglerException) WranglerException(org.erlide.wrangler.refactoring.exception.WranglerException) IErlElement(org.erlide.engine.model.IErlElement) Shell(org.eclipse.swt.widgets.Shell) RefactoringWizardOpenOperation(org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation) TransferData(org.eclipse.swt.dnd.TransferData) DefaultWranglerRefactoringWizard(org.erlide.wrangler.refactoring.ui.wizard.DefaultWranglerRefactoringWizard) RefactoringWizard(org.eclipse.ltk.ui.refactoring.RefactoringWizard) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ISelection(org.eclipse.jface.viewers.ISelection) DefaultWranglerRefactoringWizard(org.erlide.wrangler.refactoring.ui.wizard.DefaultWranglerRefactoringWizard) WranglerPage(org.erlide.wrangler.refactoring.ui.wizardpages.WranglerPage)

Example 13 with RefactoringWizardOpenOperation

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
    }
}
Also used : RefactoringWizardOpenOperation(org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation) RenameComponentProcessor(org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameComponentProcessor) RenameRefactoringWizard(org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard) RenameRefactoringWizard(org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard) RefactoringWizard(org.eclipse.ltk.ui.refactoring.RefactoringWizard) XMLRefactoringComponent(org.eclipse.wst.xsd.ui.internal.refactor.XMLRefactoringComponent) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring) XMLRefactoringComponent(org.eclipse.wst.xsd.ui.internal.refactor.XMLRefactoringComponent) RefactoringComponent(org.eclipse.wst.xsd.ui.internal.refactor.RefactoringComponent)

Example 14 with RefactoringWizardOpenOperation

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
    }
}
Also used : RefactoringWizardOpenOperation(org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation) RenameRefactoringWizard(org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard) RenameRefactoringWizard(org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard) RefactoringWizard(org.eclipse.ltk.ui.refactoring.RefactoringWizard) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring) MakeTypeGlobalProcessor(org.eclipse.wst.xsd.ui.internal.refactor.structure.MakeTypeGlobalProcessor)

Example 15 with RefactoringWizardOpenOperation

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
    }
}
Also used : RefactoringWizardOpenOperation(org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation) RenameRefactoringWizard(org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard) RenameTargetNamespaceProcessor(org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameTargetNamespaceProcessor) RenameRefactoringWizard(org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard) RefactoringWizard(org.eclipse.ltk.ui.refactoring.RefactoringWizard) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring)

Aggregations

RefactoringWizardOpenOperation (org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation)22 ExecutionException (org.eclipse.core.commands.ExecutionException)14 IProject (org.eclipse.core.resources.IProject)14 TTCN3Editor (org.eclipse.titan.designer.editors.ttcn3editor.TTCN3Editor)13 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 IFile (org.eclipse.core.resources.IFile)9 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)6 RefactoringWizard (org.eclipse.ltk.ui.refactoring.RefactoringWizard)6 RenameRefactoring (org.eclipse.ltk.core.refactoring.participants.RenameRefactoring)5 RenameRefactoringWizard (org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard)5 ArrayList (java.util.ArrayList)2 IResource (org.eclipse.core.resources.IResource)2 TextSelection (org.eclipse.jface.text.TextSelection)2 ISelection (org.eclipse.jface.viewers.ISelection)2 Shell (org.eclipse.swt.widgets.Shell)2 RefactoringComponent (org.eclipse.wst.xsd.ui.internal.refactor.RefactoringComponent)2 XMLRefactoringComponent (org.eclipse.wst.xsd.ui.internal.refactor.XMLRefactoringComponent)2 RenameComponentProcessor (org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameComponentProcessor)2 OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)1 HashSet (java.util.HashSet)1