Search in sources :

Example 1 with ChangePreviewViewerDescriptor

use of org.eclipse.ltk.internal.ui.refactoring.ChangePreviewViewerDescriptor in project che by eclipse.

the class RefactoringManager method getChangePreview.

/**
     * generate preview for refactoring change
     *
     * @param change
     *         the refactoring change
     * @return refactoring change preview
     * @throws RefactoringException
     *         when refactoring session or change not found.
     */
public ChangePreview getChangePreview(RefactoringChange change) throws RefactoringException {
    RefactoringSession session = getRefactoringSession(change.getSessionId());
    PreviewNode previewNode = session.getChangePreview(change.getChangeId());
    try {
        ChangePreviewViewerDescriptor descriptor = previewNode.getChangePreviewViewerDescriptor();
        if (descriptor != null) {
            IChangePreviewViewer viewer = descriptor.createViewer();
            if (viewer != null) {
                return previewNode.feedInput(viewer, Collections.EMPTY_LIST);
            }
        }
    } catch (CoreException e) {
        throw new RefactoringException(e.getMessage());
    }
    return null;
}
Also used : ChangePreviewViewerDescriptor(org.eclipse.ltk.internal.ui.refactoring.ChangePreviewViewerDescriptor) CoreException(org.eclipse.core.runtime.CoreException) MoveRefactoringSession(org.eclipse.che.plugin.java.server.refactoring.session.MoveRefactoringSession) RenameLinkedModeRefactoringSession(org.eclipse.che.plugin.java.server.refactoring.session.RenameLinkedModeRefactoringSession) ReorgRefactoringSession(org.eclipse.che.plugin.java.server.refactoring.session.ReorgRefactoringSession) RefactoringSession(org.eclipse.che.plugin.java.server.refactoring.session.RefactoringSession) RenameRefactoringSession(org.eclipse.che.ide.ext.java.shared.dto.refactoring.RenameRefactoringSession) PreviewNode(org.eclipse.ltk.internal.ui.refactoring.PreviewNode) IChangePreviewViewer(org.eclipse.ltk.ui.refactoring.IChangePreviewViewer)

Aggregations

RenameRefactoringSession (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RenameRefactoringSession)1 MoveRefactoringSession (org.eclipse.che.plugin.java.server.refactoring.session.MoveRefactoringSession)1 RefactoringSession (org.eclipse.che.plugin.java.server.refactoring.session.RefactoringSession)1 RenameLinkedModeRefactoringSession (org.eclipse.che.plugin.java.server.refactoring.session.RenameLinkedModeRefactoringSession)1 ReorgRefactoringSession (org.eclipse.che.plugin.java.server.refactoring.session.ReorgRefactoringSession)1 CoreException (org.eclipse.core.runtime.CoreException)1 ChangePreviewViewerDescriptor (org.eclipse.ltk.internal.ui.refactoring.ChangePreviewViewerDescriptor)1 PreviewNode (org.eclipse.ltk.internal.ui.refactoring.PreviewNode)1 IChangePreviewViewer (org.eclipse.ltk.ui.refactoring.IChangePreviewViewer)1