use of org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.AbstractResultTreeObject in project erlide_eclipse by erlang.
the class DuplicatesView method makeActions.
private void makeActions() {
copyGeneralisedToClipboard = new ClipboardAction(PlatformUI.getWorkbench().getDisplay());
copyGeneralisedToClipboard.setToolTipText("Copy generalised function to the clipboard");
copyGeneralisedToClipboard.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
copyFunCallToClipboard.setToolTipText("Copy FunCall to the clipboard");
copyFunCallToClipboard.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
final ISelection sel = event.getSelection();
if (sel == null || sel.isEmpty()) {
return;
}
final TreeSelection tsel = (TreeSelection) sel;
final AbstractResultTreeObject selection = (AbstractResultTreeObject) tsel.getFirstElement();
copyGeneralisedToClipboard.setText(selection.getSuggestedCode());
if (selection instanceof DuplicatedCodeInstanceElement) {
final DuplicatedCodeInstanceElement dcie = (DuplicatedCodeInstanceElement) selection;
copyFunCallToClipboard.setText(dcie.getReplicationFunction());
}
}
});
}
Aggregations