Search in sources :

Example 1 with RenameRefactoringWizard

use of org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard in project webtools.sourceediting by eclipse.

the class RenameHandler method run.

public void run(ISelection selection, XSDSchema schema, XSDNamedComponent selectedComponent) {
    if (selectedComponent.getName() == null) {
        selectedComponent.setName(new String());
    }
    if (selectedComponent.getSchema() == null) {
        if (schema != null) {
            schema.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());
    } catch (InterruptedException e) {
    // do nothing. User action got canceled
    }
}
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 2 with RenameRefactoringWizard

use of org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard in project webtools.sourceediting by eclipse.

the class RenameResourceAction method run.

public void run(IStructuredSelection selection) {
    IResource resource = getResource(selection);
    RenameResourceProcessor processor = new RenameResourceProcessor(resource);
    if (!processor.isApplicable())
        return;
    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());
    } catch (InterruptedException e) {
    // do nothing. User action got cancelled
    }
}
Also used : RenameResourceProcessor(org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameResourceProcessor) 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) IResource(org.eclipse.core.resources.IResource)

Example 3 with RenameRefactoringWizard

use of org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard 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 4 with RenameRefactoringWizard

use of org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard 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 5 with RenameRefactoringWizard

use of org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard 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

RenameRefactoring (org.eclipse.ltk.core.refactoring.participants.RenameRefactoring)5 RefactoringWizard (org.eclipse.ltk.ui.refactoring.RefactoringWizard)5 RefactoringWizardOpenOperation (org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation)5 RenameRefactoringWizard (org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard)5 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 IResource (org.eclipse.core.resources.IResource)1 RenameResourceProcessor (org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameResourceProcessor)1 RenameTargetNamespaceProcessor (org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameTargetNamespaceProcessor)1 MakeTypeGlobalProcessor (org.eclipse.wst.xsd.ui.internal.refactor.structure.MakeTypeGlobalProcessor)1