use of org.eclipse.e4.ui.workbench.modeling.ESelectionService in project portfolio by buchen.
the class OpenBookmarksHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, ESelectionService selectionService) {
Object object = selectionService.getSelection();
if (!(object instanceof SecuritySelection))
return;
SecuritySelection selection = (SecuritySelection) object;
if (selection.getClient().getSettings().getBookmarks().isEmpty())
return;
List<Bookmark> bookmarks = selection.getClient().getSettings().getBookmarks().stream().filter(b -> !b.isSeparator()).collect(Collectors.toList());
BookmarkPopup<Bookmark> popup = new //
BookmarkPopup<>(//
shell, //
selection.getSecurity().getName(), //
bookmarks, //
Bookmark::getLabel, bm -> DesktopAPI.browse(bm.constructURL(selection.getClient(), selection.getSecurity())));
popup.open();
}
use of org.eclipse.e4.ui.workbench.modeling.ESelectionService in project whole by wholeplatform.
the class AbstractModelTextAction method run.
@Override
public void run() {
ESelectionService selectionService = getContext().get(ESelectionService.class);
IBindingManager bm = (IBindingManager) selectionService.getSelection();
ISynchronizableRunnable runnable = new TextualFunctionRunnable(getContext(), bm, getText(), getBehaviorUri());
runnable.syncExec(3000);
}
use of org.eclipse.e4.ui.workbench.modeling.ESelectionService in project whole by wholeplatform.
the class AbstractModelTextAction method update.
@Override
public void update() {
setEnabled(false);
ESelectionService selectionService = getContext().get(ESelectionService.class);
if (selectionService.getSelection() instanceof IBindingManager) {
IBindingManager bm = (IBindingManager) selectionService.getSelection();
setEnabled(calculateEnabled(bm));
}
}
use of org.eclipse.e4.ui.workbench.modeling.ESelectionService in project whole by wholeplatform.
the class DirectEditAction method update.
@Override
public void update() {
setEnabled(false);
ESelectionService selectionService = getContext().get(ESelectionService.class);
if (selectionService.getSelection() instanceof IBindingManager) {
IBindingManager bm = (IBindingManager) selectionService.getSelection();
if (bm.wIsSet("viewer")) {
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
IEntity focusEntity = bm.wGet("focusEntity");
IEntityPart entityPart = viewer.getEditPartRegistry().get(focusEntity);
setEnabled(entityPart.understandsRequest(request));
}
}
}
use of org.eclipse.e4.ui.workbench.modeling.ESelectionService in project whole by wholeplatform.
the class DirectEditAction method run.
@Override
public void run() {
ESelectionService selectionService = getContext().get(ESelectionService.class);
IBindingManager bm = (IBindingManager) selectionService.getSelection();
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
IEntity focusEntity = bm.wGet("focusEntity");
IEntityPart entityPart = viewer.getEditPartRegistry().get(focusEntity);
try {
entityPart.performRequest(request);
} catch (Exception e) {
e.getCause();
}
}
Aggregations