use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project titan.EclipsePlug-ins by eclipse.
the class MinimizeScopeActionFromBrowser method performMinimizeScope.
private void performMinimizeScope() {
// getting the active editor
final TTCN3Editor targetEditor = Utils.getActiveEditor();
// find selection
if (!(selection instanceof IStructuredSelection)) {
return;
}
final IStructuredSelection structSelection = (IStructuredSelection) selection;
final Set<IProject> projsToUpdate = Utils.findAllProjectsInSelection(structSelection);
// update AST before refactoring
Utils.updateASTBeforeRefactoring(projsToUpdate, "MinimizeScope");
Activator.getDefault().pauseHandlingResourceChanges();
// create refactoring
final MinimizeScopeRefactoring refactoring = new MinimizeScopeRefactoring(structSelection, null);
// open wizard
final MinimizeScopeWizard wiz = new MinimizeScopeWizard(refactoring);
final RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(wiz);
try {
operation.run(targetEditor == null ? null : targetEditor.getEditorSite().getShell(), "");
} catch (InterruptedException irex) {
// operation was cancelled
} catch (Exception e) {
ErrorReporter.logError("MinimizeScopeActionFromBrowser: Error while performing refactoring change! ");
ErrorReporter.logExceptionStackTrace(e);
}
Activator.getDefault().resumeHandlingResourceChanges();
// update AST after refactoring
Utils.updateASTAfterRefactoring(wiz, refactoring.getAffectedObjects(), refactoring.getName());
}
use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project titan.EclipsePlug-ins by eclipse.
the class MinimizeScopeActionFromEditor method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
// update AST
Utils.updateASTForProjectActiveInEditor("MinimizeScope");
Activator.getDefault().pauseHandlingResourceChanges();
// getting the active editor
final TTCN3Editor targetEditor = Utils.getActiveEditor();
if (targetEditor == null) {
return null;
}
// get selected definition
selection = findSelection();
if (selection == null) {
return null;
}
final IResource selectedRes = selection.getLocation().getFile();
if (!(selectedRes instanceof IFile)) {
ErrorReporter.logError("MinimizeScopeActionFromEditor.execute(): Selected resource `" + selectedRes.getName() + "' is not a file.");
return null;
}
final IFile selectedFile = (IFile) selectedRes;
//
final MinimizeScopeRefactoring refactoring = new MinimizeScopeRefactoring(selection, null);
// open wizard
final MinimizeScopeWizard wiz = new MinimizeScopeWizard(refactoring);
final RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(wiz);
try {
operation.run(targetEditor.getEditorSite().getShell(), "");
} catch (InterruptedException irex) {
// operation was cancelled
} catch (Exception e) {
ErrorReporter.logError("MinimizeScopeActionFromEditor: Error while performing refactoring change! ");
ErrorReporter.logExceptionStackTrace(e);
}
// update AST again
Activator.getDefault().resumeHandlingResourceChanges();
final IProject project = selectedFile.getProject();
GlobalParser.getProjectSourceParser(project).reportOutdating(selectedFile);
GlobalParser.getProjectSourceParser(project).analyzeAll();
return null;
}
use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project titan.EclipsePlug-ins by eclipse.
the class UngroupModuleparActionFromBrowser method performUngroupModulepar.
private void performUngroupModulepar() {
// getting the active editor
final TTCN3Editor targetEditor = Utils.getActiveEditor();
// find selection
if (!(selection instanceof IStructuredSelection)) {
return;
}
final IStructuredSelection structSelection = (IStructuredSelection) selection;
final Set<IProject> projsToUpdate = Utils.findAllProjectsInSelection(structSelection);
// update AST before refactoring
Utils.updateASTBeforeRefactoring(projsToUpdate, "UngroupModulepar");
Activator.getDefault().pauseHandlingResourceChanges();
// create refactoring
final UngroupModuleparRefactoring refactoring = new UngroupModuleparRefactoring(structSelection);
// open wizard
final UngroupModuleparWizard wiz = new UngroupModuleparWizard(refactoring);
final RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(wiz);
try {
operation.run(targetEditor == null ? null : targetEditor.getEditorSite().getShell(), "");
} catch (InterruptedException irex) {
// operation was cancelled
} catch (Exception e) {
ErrorReporter.logError("UngroupModuleparActionFromBrowser: Error while performing refactoring change! ");
ErrorReporter.logExceptionStackTrace(e);
}
Activator.getDefault().resumeHandlingResourceChanges();
// update AST after refactoring
Utils.updateASTAfterRefactoring(wiz, refactoring.getAffectedObjects(), refactoring.getName());
}
use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project titan.EclipsePlug-ins by eclipse.
the class MinimizeVisibilityActionFromBrowser method performMinimizeVisibility.
private void performMinimizeVisibility() {
// getting the active editor
final TTCN3Editor targetEditor = Utils.getActiveEditor();
// find selection
if (!(selection instanceof IStructuredSelection)) {
return;
}
final IStructuredSelection structSelection = (IStructuredSelection) selection;
final Set<IProject> projsToUpdate = Utils.findAllProjectsInSelection(structSelection);
// update AST before refactoring
Utils.updateASTBeforeRefactoring(projsToUpdate, "MinimizeVisibility");
Activator.getDefault().pauseHandlingResourceChanges();
// create refactoring
final MinimizeVisibilityRefactoring refactoring = new MinimizeVisibilityRefactoring(structSelection);
// open wizard
final MinimizeVisibilityWizard wiz = new MinimizeVisibilityWizard(refactoring);
final RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(wiz);
try {
operation.run(targetEditor == null ? null : targetEditor.getEditorSite().getShell(), "");
} catch (InterruptedException irex) {
// operation was cancelled
} catch (Exception e) {
ErrorReporter.logError("MinimizeVisibilityActionFromBrowser: Error while performing refactoring change! ");
ErrorReporter.logExceptionStackTrace(e);
}
Activator.getDefault().resumeHandlingResourceChanges();
// update AST after refactoring
Utils.updateASTAfterRefactoring(wiz, refactoring.getAffectedObjects(), refactoring.getName());
}
use of org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation in project titan.EclipsePlug-ins by eclipse.
the class MinimizeVisibilityActionFromEditor method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
// update AST
Utils.updateASTForProjectActiveInEditor("MinimizeVisibility");
Activator.getDefault().pauseHandlingResourceChanges();
// getting the active editor
final TTCN3Editor targetEditor = Utils.getActiveEditor();
if (targetEditor == null) {
return null;
}
// getting selected file
final IFile selectedFile = Utils.getSelectedFileInEditor("MinimizeVisibility");
if (selectedFile == null) {
return null;
}
final IStructuredSelection structSelection = new StructuredSelection(selectedFile);
final MinimizeVisibilityRefactoring refactoring = new MinimizeVisibilityRefactoring(structSelection);
// open wizard
final MinimizeVisibilityWizard wiz = new MinimizeVisibilityWizard(refactoring);
final RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(wiz);
try {
operation.run(targetEditor.getEditorSite().getShell(), "");
} catch (InterruptedException irex) {
// operation was cancelled
} catch (Exception e) {
ErrorReporter.logError("MinimizeVisibilityActionFromEditor: Error while performing refactoring change! ");
ErrorReporter.logExceptionStackTrace(e);
}
// update AST again
Activator.getDefault().resumeHandlingResourceChanges();
final IProject project = selectedFile.getProject();
GlobalParser.getProjectSourceParser(project).reportOutdating(selectedFile);
GlobalParser.getProjectSourceParser(project).analyzeAll();
return null;
}
Aggregations