use of org.erlide.wrangler.refactoring.codeinspection.ui.InputDialogWithCheckbox in project erlide_eclipse by erlang.
the class SimpleCodeInspectionHandler method handleLongFunctions.
private void handleLongFunctions(final IErlSelection wranglerSelection, final Shell shell) {
try {
CodeInspectionViewsManager.hideView(SimpleCodeInspectionHandler.LONG_FUNCTIONS);
// call inputdialog
final InputDialogWithCheckbox dialog = new InputDialogWithCheckbox(shell, "Search for long functions", "Number of lines:", "Search in the project", "", new IntegerInputValidator());
if (Window.OK == dialog.open()) {
final int linesVal = Integer.parseInt(dialog.getValue());
final boolean inProject = dialog.isCheckBoxChecked();
RpcResult res = null;
if (inProject) {
res = WranglerBackendManager.getRefactoringBackend().callInspection("long_functions_in_dirs_eclipse", "ixi", linesVal, wranglerSelection.getSearchPath(), GlobalParameters.getTabWidth());
} else {
res = WranglerBackendManager.getRefactoringBackend().callInspection("long_functions_in_file_eclipse", "sixi", wranglerSelection.getFilePath(), linesVal, wranglerSelection.getSearchPath(), GlobalParameters.getTabWidth());
}
// handle rpc
final ArrayList<IErlElement> elements = processFunctionResult(shell, res);
if (elements == null) {
return;
}
// show result
if (!elements.isEmpty()) {
CodeInspectionViewsManager.showErlElements("Long functions", elements, SimpleCodeInspectionHandler.LONG_FUNCTIONS);
} else {
MessageDialog.openInformation(shell, "No result", "Could not found any function which is longer, than " + linesVal + " lines.");
}
}
} catch (final Exception e) {
ErlLogger.error(e);
}
}
use of org.erlide.wrangler.refactoring.codeinspection.ui.InputDialogWithCheckbox in project erlide_eclipse by erlang.
the class SimpleCodeInspectionHandler method handleNested.
private void handleNested(final IErlSelection wranglerSelection, final Shell shell, final String type) {
try {
CodeInspectionViewsManager.hideView(SimpleCodeInspectionHandler.NESTED_EXPRESSIONS + type);
// call inputdialog
final InputDialogWithCheckbox dialog = new InputDialogWithCheckbox(shell, "Search for nested expression", "Nest level:", "Search in the project", "", new IntegerInputValidator());
if (Window.OK == dialog.open()) {
final int nestedVal = Integer.parseInt(dialog.getValue());
final boolean inProject = dialog.isCheckBoxChecked();
RpcResult res = null;
if (inProject) {
res = WranglerBackendManager.getRefactoringBackend().callInspection("nested_exprs_in_dirs_eclipse", "iaxi", nestedVal, type, wranglerSelection.getSearchPath(), GlobalParameters.getTabWidth());
} else {
res = WranglerBackendManager.getRefactoringBackend().callInspection("nested_exprs_in_file_eclipse", "siaxi", wranglerSelection.getFilePath(), nestedVal, type, wranglerSelection.getSearchPath(), GlobalParameters.getTabWidth());
}
// handle rpc
final ArrayList<IErlElement> elements = processFunctionResult(shell, res);
if (elements == null) {
return;
}
// show result
if (!elements.isEmpty()) {
CodeInspectionViewsManager.showErlElements("Nested " + type + " expressions", elements, SimpleCodeInspectionHandler.NESTED_EXPRESSIONS + type);
} else {
MessageDialog.openInformation(shell, "No result", "Could not found any " + nestedVal + " levels nested " + type + " expression!");
}
}
} catch (final Exception e) {
ErlLogger.error(e);
}
}
Aggregations