use of org.csstudio.opibuilder.model.AbstractPVWidgetModel 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);
}
}
use of org.csstudio.opibuilder.model.AbstractPVWidgetModel in project yamcs-studio by yamcs.
the class WidgetTreeEditpart method getText.
@Override
protected String getText() {
StringBuilder sb = new StringBuilder();
Object obj = getViewer().getProperty(ShowIndexInTreeViewAction.SHOW_INDEX_PROPERTY);
if (obj != null && obj instanceof Boolean && (Boolean) obj) {
sb.append(Integer.toString(getWidgetModel().getIndex()));
// $NON-NLS-1$
sb.append("_");
}
sb.append(getWidgetModel().getName());
if (getWidgetModel() instanceof AbstractPVWidgetModel) {
AbstractPVWidgetModel pvWidgetModel = (AbstractPVWidgetModel) getWidgetModel();
String pvName = pvWidgetModel.getPVName();
if (pvName != null && !pvName.trim().equals("")) {
// $NON-NLS-1$
sb.append("(");
sb.append(pvName);
// $NON-NLS-1$
sb.append(")");
}
}
return sb.toString();
}
Aggregations