// run fold expression against a local function
} else if (actionId.equals("org.erlide.wrangler.refactoring.foldlocalexpression")) {
refactoring = new FoldLocalExpressionRefactoring();
pages.add(new SelectionInputPage("Fold expression",
"Please select expression which should be fold!",
"Select expressions which should be folded!",
(CostumWorkflowRefactoringWithPositionsSelection) refactoring));
// run fold expression against a remote function
} else {
final Shell activeShell = PlatformUI.getWorkbench().getDisplay()
.getActiveShell();
if (actionId.equals("org.erlide.wrangler.refactoring.foldremoteexpression")) {
// must store the selection, because, the user through the
// dialog
// may change it
final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters
.getWranglerSelection();
final RemoteFunctionClauseDialog dialog = new RemoteFunctionClauseDialog(
activeShell, "Fold expression");
dialog.open();
dialog.resetSelection();
if (dialog.isFinished()) {
final IErlFunctionClause functionClause = dialog.getFunctionClause();
refactoring = new FoldRemoteExpressionRefactoring(functionClause, sel);
pages.add(new SelectionInputPage("Fold expression",
"Please select expression which should be fold!",
"Select expressions which should be folded!",
(CostumWorkflowRefactoringWithPositionsSelection) refactoring));
} else {
return null;
}
// run introduce macro refactoring
} else if (actionId.equals("org.erlide.wrangler.refactoring.introducemacro")) {
refactoring = new IntroduceMacroRefactoring();
pages.add(new SimpleInputPage("Introduce macro definition",
"Please type the new macro name!", "New macro name:",
"Macro name cannot be empty!", new NonEmptyStringValidator()));
// run rename process refactoring
} else if (actionId.equals("org.erlide.wrangler.refactoring.renameprocess")) {
refactoring = new RenameProcessRefactoring();
pages.add(new SimpleInputPage("Rename process",
"Please type the new process name!", "New process name:",
"New process name must be an Erlang atom!", new AtomValidator()));
// run function to process refactoring
} else if (actionId
.equals("org.erlide.wrangler.refactoring.functiontoprocess")) {
refactoring = new FunctionToProcessRefactoring();
pages.add(new SimpleInputPage("Convert function to process",
"Please type the new process name!", "New process name:",
"New process name must be an Erlang atom!", new AtomValidator()));
// run tuple function parameters refactoring
} else if (actionId
.equals("org.erlide.wrangler.refactoring.tuplefunctonparameters")) {
refactoring = new TupleFunctionParametersRefactoring();
// run generalise function refactoring
} else if (actionId.equals("org.erlide.wrangler.refactoring.generalise")) {
/*
* pages.add(new CostumworkFlowInputPage("Generalise function",
* "Please type the new parameter name!", "New parameter name:",
* "New parameter name must be a valid Erlang variable name!",
* new VariableNameValidator()));
*/
try {
refactoring = runGenFunRefactoring(pages, activeShell);
} catch (final OtpErlangRangeException e) {
ErlLogger.error(e);
return null;
}
if (refactoring == null) {
return null;
}
// fold against macro definition
} else if (actionId
.equals("org.erlide.wrangler.refactoring.foldagainstmacro")) {
refactoring = new FoldAgainstMacro();
pages.add(new SelectionInputPage("Fold against macro definition",
"Please select expression which should be fold!",
"Select expressions which should be folded!",
(CostumWorkflowRefactoringWithPositionsSelection) refactoring));
// normalize record expression
} else if (actionId
.equals("org.erlide.wrangler.refactoring.normalizerecordexpression")) {
final boolean showDefaultFields = MessageDialog.openQuestion(activeShell,
"Showing defaults", "Show record fields with default values?");
refactoring = new NormalizeRecordExpression(showDefaultFields);
} else if (actionId.equals("org.erlide.wrangler.refactoring.introducelet")) {
pages.add(new CostumworkFlowInputPage("Introduce ?LET",
"Please type the pattern variable name!",
"Pattern variable name:",
"New name must be a valid Erlang atom!",
new VariableNameValidator()));
refactoring = new IntroduceLetRefactoring();
} else if (actionId.equals("org.erlide.wrangler.refactoring.mergelet")) {
refactoring = new MergeLetRefactoring();
pages.add(new SelectionInputPage("Merge ?LET expressions",
"Please select expressions which whould be merged!",
"Select expressions which should be merged",
(CostumWorkflowRefactoringWithPositionsSelection) refactoring));
} else if (actionId.equals("org.erlide.wrangler.refactoring.mergeforall")) {
refactoring = new MergeForAllRefactoring();
pages.add(new SelectionInputPage("Merge ?FORALL expressions",
"Please select expressions which should be merged!",
"Select expressions which should be merged",
(CostumWorkflowRefactoringWithPositionsSelection) refactoring));
} else if (actionId