use of org.csstudio.opibuilder.editparts.AbstractLayoutEditpart in project yamcs-studio by yamcs.
the class LayoutWidgetsHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart activeEditor = page.getActiveEditor();
if (activeEditor instanceof OPIEditor) {
ISelection currentSelection = ((GraphicalViewer) ((OPIEditor) activeEditor).getAdapter(GraphicalViewer.class)).getSelection();
if (currentSelection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection) currentSelection).getFirstElement();
if (element instanceof AbstractLayoutEditpart) {
CommandStack commandStack = (CommandStack) ((OPIEditor) activeEditor).getAdapter(CommandStack.class);
if (commandStack != null)
LayoutWidgetsImp.run((AbstractLayoutEditpart) element, commandStack);
}
}
} else {
return null;
}
return null;
}
use of org.csstudio.opibuilder.editparts.AbstractLayoutEditpart in project yamcs-studio by yamcs.
the class LinkingContainerEditpart method layout.
@Override
public void layout() {
AbstractLayoutEditpart layoutter = getLayoutWidget();
if (layoutter != null && layoutter.getWidgetModel().isEnabled()) {
List<AbstractWidgetModel> modelChildren = new ArrayList<AbstractWidgetModel>();
for (Object child : getChildren()) {
if (child instanceof AbstractBaseEditPart && !(child instanceof AbstractLayoutEditpart)) {
modelChildren.add(((AbstractBaseEditPart) child).getWidgetModel());
}
}
layoutter.layout(modelChildren, getFigure().getClientArea());
}
}
use of org.csstudio.opibuilder.editparts.AbstractLayoutEditpart in project yamcs-studio by yamcs.
the class LayoutWidgetsAction method run.
@Override
public void run(IAction action) {
AbstractLayoutEditpart layoutWidget = getLayoutWidget();
LayoutWidgetsImp.run(layoutWidget, getCommandStack());
}
Aggregations