Search in sources :

Example 1 with OtpErlangBoolean

use of com.ericsson.otp.erlang.OtpErlangBoolean in project erlide_eclipse by erlang.

the class GraphResultingInspectionHandler method execute.

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final String actionId = event.getCommand().getId();
    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().setFocus();
    try {
        GlobalParameters.setSelection(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection());
    } catch (final WranglerException e1) {
        MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", e1.getMessage());
        return null;
    }
    try {
        final File tmpFile = File.createTempFile("wrangler_graph_", ".dot");
        tmpFile.deleteOnExit();
        final IErlSelection wranglerSelection = GlobalParameters.getWranglerSelection();
        if ("org.erlide.wrangler.refactoring.codeinspection.cyclicdependencies".equals(actionId)) {
            final Boolean answer = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Labels", "Label edges with function names called?");
            runInspection("Cyclic module dependency", GraphResultingInspectionHandler.CYCLYC_VIEW_ID, "There is no cyclic dependent modules in the project!", tmpFile, "cyclic_dependent_modules", "ssx", tmpFile.getAbsolutePath(), wranglerSelection.getSearchPath(), new OtpErlangBoolean(answer));
        } else if ("org.erlide.wrangler.refactoring.codeinspection.generatefunctioncallgraph".equals(actionId)) {
            runInspection("Function callgraph", GraphResultingInspectionHandler.FUNCTION_CALL_GRAPH_VIEW_ID, "There is no dependent functions in the module!", tmpFile, "gen_function_callgraph", "sss", tmpFile.getAbsolutePath(), wranglerSelection.getFilePath(), wranglerSelection.getSearchPath());
        } else if ("org.erlide.wrangler.refactoring.codeinspection.generatemodulegraph".equals(actionId)) {
            final Boolean answer = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Labels", "Label edges with function names called?");
            runInspection("Module dependency graph", GraphResultingInspectionHandler.MODULE_GRAPH_VIEW_ID, "There is no dependent modules in the project!", tmpFile, "gen_module_graph", "ssx", tmpFile.getAbsolutePath(), wranglerSelection.getSearchPath(), new OtpErlangBoolean(answer));
        } else if ("org.erlide.wrangler.refactoring.codeinspection.improperdependecies".equals(actionId)) {
            runInspection("Improper module dependencies", GraphResultingInspectionHandler.IMPROPER_DEPENDECIES_VIEW_ID, "There is no improper module dependecies!", tmpFile, "improper_inter_module_calls", "ss", tmpFile.getAbsolutePath(), wranglerSelection.getSearchPath());
        }
    } catch (final Exception e) {
        ErlLogger.error(e);
    }
    return event;
}
Also used : IErlSelection(org.erlide.wrangler.refactoring.selection.IErlSelection) OtpErlangBoolean(com.ericsson.otp.erlang.OtpErlangBoolean) WranglerException(org.erlide.wrangler.refactoring.exception.WranglerException) OtpErlangBoolean(com.ericsson.otp.erlang.OtpErlangBoolean) File(java.io.File) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException) ExecutionException(org.eclipse.core.commands.ExecutionException) WranglerException(org.erlide.wrangler.refactoring.exception.WranglerException)

Aggregations

OtpErlangBoolean (com.ericsson.otp.erlang.OtpErlangBoolean)1 File (java.io.File)1 IOException (java.io.IOException)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 CoreException (org.eclipse.core.runtime.CoreException)1 WranglerException (org.erlide.wrangler.refactoring.exception.WranglerException)1 IErlSelection (org.erlide.wrangler.refactoring.selection.IErlSelection)1