use of org.erlide.wrangler.refactoring.exception.WranglerException in project erlide_eclipse by erlang.
the class MoveFunctionDropHandler method handleDrop.
@Override
public IStatus handleDrop(final CommonDropAdapter dropAdapter, final DropTargetEvent dropTargetEvent, final Object target) {
// get the source data
final TransferData td = dropAdapter.getCurrentTransfer();
final ISelection sel = (ISelection) LocalSelectionTransfer.getTransfer().nativeToJava(td);
final TreeSelection s = (TreeSelection) sel;
try {
GlobalParameters.setSelection(s);
} catch (final WranglerException e1) {
e1.printStackTrace();
}
// get the target data
String moduleName;
IFile file;
if (target instanceof IFile) {
file = (IFile) target;
} else {
file = (IFile) ((IErlElement) target).getResource();
}
moduleName = file.getName();
moduleName = moduleName.substring(0, moduleName.lastIndexOf("."));
final MoveFunctionRefactoring refactoring = new MoveFunctionRefactoring();
refactoring.setUserInput(moduleName);
final RefactoringWizard wizard = new DefaultWranglerRefactoringWizard(refactoring, RefactoringWizard.DIALOG_BASED_USER_INTERFACE, new ArrayList<WranglerPage>());
final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
final RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
try {
op.run(shell, refactoring.getName());
} catch (final Exception e) {
ErlLogger.error(e);
}
return Status.OK_STATUS;
}
use of org.erlide.wrangler.refactoring.exception.WranglerException in project erlide_eclipse by erlang.
the class StateDataToRecordRpcMessage method parseRefactoringMessage.
@Override
protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) throws WranglerException {
final OtpErlangObject wranglerResult = resultTuple.elementAt(1);
if (!"ok".equals(resultTuple.elementAt(0).toString())) {
final OtpErlangString msg = (OtpErlangString) wranglerResult;
setUnsuccessful(msg.stringValue());
} else {
if ("non_tuple".equals(wranglerResult.toString())) {
fieldCount = 1;
} else {
try {
fieldCount = ((OtpErlangLong) ((OtpErlangTuple) wranglerResult).elementAt(1)).intValue();
} catch (final OtpErlangRangeException e) {
throw new WranglerException(e.getMessage());
}
}
stateFuns = resultTuple.elementAt(2);
setSuccessful();
}
}
Aggregations