use of org.csstudio.opibuilder.editparts.AbstractPVWidgetEditPart in project yamcs-studio by yamcs.
the class RuntimePatchedSelectionTool method handleButtonUp.
/**
* Intercept middle clicks and restore original cursor if it has changed.
*/
@Override
protected boolean handleButtonUp(int button) {
if (button == 2) {
EditPart editPart = getTargetEditPart();
if (editPart instanceof AbstractPVWidgetEditPart) {
AbstractPVWidgetEditPart apvwep = (AbstractPVWidgetEditPart) editPart;
IFigure figure = apvwep.getFigure();
if (cursorChanged) {
figure.setCursor(oldCursor);
oldCursor = null;
cursorChanged = false;
}
}
return true;
} else {
return super.handleButtonUp(button);
}
}
use of org.csstudio.opibuilder.editparts.AbstractPVWidgetEditPart in project yamcs-studio by yamcs.
the class RuntimePatchedSelectionTool method handleButtonDown.
/**
* Intercept middle clicks and copy PV name to pastebuffer if available.
* Change cursor to copy symbol.
*/
@Override
protected boolean handleButtonDown(int button) {
if (button == 2) {
EditPart editPart = getTargetEditPart();
if (editPart instanceof AbstractPVWidgetEditPart) {
AbstractPVWidgetEditPart apvwep = (AbstractPVWidgetEditPart) editPart;
String pvName = ((AbstractPVWidgetModel) editPart.getModel()).getPVName();
if (pvName != "" && pvName != null) {
Display display = Display.getCurrent();
Clipboard clipboard = new Clipboard(display);
// Copies to middle button paste buffer,
// to be pasted via another middle-button click
clipboard.setContents(new Object[] { pvName }, new Transfer[] { TextTransfer.getInstance() }, DND.SELECTION_CLIPBOARD);
// Copies to normal clipboard,
// to be pasted via Ctrl-V or Edit/Paste
clipboard.setContents(new String[] { pvName }, new Transfer[] { TextTransfer.getInstance() });
clipboard.dispose();
IFigure figure = apvwep.getFigure();
oldCursor = figure.getCursor();
figure.setCursor(ResourceUtil.getCopyPvCursor());
cursorChanged = true;
}
}
return true;
} else {
return super.handleButtonDown(button);
}
}
Aggregations