use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class AbstractE4DerivedGraphicalPart method createEntityViewer.
@Override
protected IEntityPartViewer createEntityViewer(Composite parent) {
IEntityPartViewer viewer = super.createEntityViewer(parent);
setSelectionLinkable(createSelectionLinkable(viewer));
return viewer;
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class HandlersBehavior method canCopyAsImage.
public static boolean canCopyAsImage(IBindingManager bm) {
if (!isValidFocusEntityPart(bm))
return false;
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
IEntity focusEntity = bm.wGet("focusEntity");
return viewer.getEditPartRegistry().get(focusEntity) instanceof IGraphicalEntityPart;
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class HandlersBehavior method canSelectAll.
public static boolean canSelectAll(IBindingManager bm) {
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
IEntity entityContents = viewer.getEntityContents();
IGraphicalEntityPart contents = (IGraphicalEntityPart) viewer.getEditPartRegistry().get(entityContents);
return ((IEntityFigure) contents.getFigure()).isInteractiveEdit();
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class OperationHandler method canExecute.
@CanExecute
public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) IBindingManager bm) throws Exception {
ITransactionScope ts = BindingManagerFactory.instance.createTransactionScope();
try {
bm.wEnterScope(ts);
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
return !viewer.getEditDomain().isDisabled() && isEnabled(bm);
} catch (Exception e) {
return false;
} finally {
ts.rollback();
bm.wExitScope();
}
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class PasteHandler method execute.
@Override
@Execute
public void execute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) IBindingManager bm) {
if (bm.wIsSet("viewer") && Clipboard.instance().getInternalOrNativeEntityContents() == null) {
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
if (ClipboardUtils.hasTextFocus(viewer) || ClipboardUtils.hasTextSeletion(viewer)) {
IEntity focusEntity = bm.wGet("focusEntity");
ITextualEntityPart focusPart = (ITextualEntityPart) viewer.getEditPartRegistry().get(focusEntity);
String textContents = Clipboard.instance().getTextContents();
Command command = focusPart.getCommand(TextualRequest.createInsertRequest(textContents));
CommandStack commandStack = viewer.getEditDomain().getCommandStack();
if (command instanceof ITextCommand) {
TextTransactionCommand transactionCommand = new TextTransactionCommand();
transactionCommand.setModel(focusEntity);
transactionCommand.merge((ITextCommand) command);
transactionCommand.setLabel(getLabel(bm));
commandStack.execute(transactionCommand);
} else {
command.setLabel(getLabel(bm) + " text");
commandStack.execute(command);
}
return;
}
}
super.execute(bm);
}
Aggregations