use of org.csstudio.opibuilder.visualparts.PropertiesSelectDialog in project yamcs-studio by yamcs.
the class CopyPropertiesAction method run.
@Override
public void run() {
PropertiesSelectDialog dialog = new PropertiesSelectDialog(null, getSelectedWidgetModels().get(0));
if (dialog.open() == Window.OK) {
List<String> propList = dialog.getOutput();
if (!propList.isEmpty()) {
AbstractWidgetModel widget = getSelectedWidgetModels().get(0);
Element widgetElement = XMLUtil.widgetToXMLElement(widget);
Element propertisElement = new Element(PROPID_ELEMENT);
for (String propID : propList) {
propertisElement.addContent(new Element(propID));
}
Element rootElement = new Element(ROOT_ELEMENT);
rootElement.addContent(widgetElement);
rootElement.addContent(propertisElement);
XMLOutputter xmlOutputter = new XMLOutputter(Format.getRawFormat());
String xmlString = xmlOutputter.outputString(rootElement);
((OPIEditor) getWorkbenchPart()).getClipboard().setContents(new Object[] { xmlString }, new Transfer[] { PropertiesCopyDataTransfer.getInstance() });
}
}
}
Aggregations