use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class E4FindReplaceDialog method selectAndReveal.
protected void selectAndReveal(IEntity entity) {
IEntityPartViewer viewer = (IEntityPartViewer) selection.wGetValue("viewer");
viewer.selectAndReveal(entity);
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class ActivateToolAction 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"))
setEnabled(!tool.isActive((IEntityPartViewer) bm.wGetValue("viewer")));
}
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class ActivateToolAction method run.
@Override
public void run() {
ESelectionService selectionService = getContext().get(ESelectionService.class);
IBindingManager bm = (IBindingManager) selectionService.getSelection();
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
boolean clearCaret = Tools.TEXTUAL != tool && Tools.TEXTUAL.isActive(viewer);
if (tool.ensureActive(viewer) && clearCaret) {
IEntity focusEntity = bm.wGet("focusEntity");
IEntityPart focusPart = viewer.getEditPartRegistry().get(focusEntity);
if (focusPart instanceof ITextualEntityPart) {
ITextualEntityPart textualPart = (ITextualEntityPart) focusPart;
textualPart.setCaretVisible(false);
viewer.setSelection(new StructuredSelection(textualPart));
}
}
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class DerivedLinkableSelectionListener method updateViewerContents.
protected void updateViewerContents(boolean relink) {
if (lastSelection == null)
return;
if (shareEditDomain && relink) {
IEntityPartViewer toViewer = (IEntityPartViewer) lastSelection.wGetValue("viewer");
viewer.linkEditDomain(toViewer);
fireViewerLinked(toViewer);
}
if (!changeTracker.testChangedAndUpdate(lastSelection, lastSelection.wGet("self")))
return;
if (functionUri != null) {
ISynchronizableRunnable runnable = new DeriveModelRunnable(context, lastSelection, LABEL, functionUri, functionIsTransactional, resultShowingPolicy) {
@Override
protected void updateUI(IEntity result) {
super.updateUI(result);
if (result != null)
fireContentsDerived(result);
}
};
runnable.asyncExec("Executing " + LABEL + " operation...");
} else {
IEntity newContents = lastSelection.wGet("self");
if (viewer.getEntityContents() != newContents)
viewer.setContents(newContents);
}
if (isSynchronizeSelection() && lastSelection.wIsSet("primarySelectedEntity")) {
IEntity selectedEntities = lastSelection.wGet("selectedEntities");
List<IEntity> selection = new ArrayList<>();
for (int i = 0, size = selectedEntities.wSize(); i < size; i++) selection.add(selectedEntities.wGet(i));
viewer.selectAndReveal(selection);
}
}
use of org.whole.lang.ui.viewers.IEntityPartViewer in project whole by wholeplatform.
the class EntityLocationHyperlink method linkActivated.
public void linkActivated() {
try {
IEclipseContext context = (IEclipseContext) PlatformUI.getWorkbench().getService(IEclipseContext.class);
EPartService partService = context.get(EPartService.class);
Collection<MPart> parts = partService.getParts();
for (MPart part : parts) {
IEclipseContext partContext = part.getContext();
if (partContext == null)
continue;
IModelInput modelInput = partContext.get(IModelInput.class);
if (modelInput != null && ((IFilePersistenceProvider) modelInput.getPersistenceProvider()).getStore().equals(file)) {
partService.activate(part, true);
IEntityPartViewer viewer = partContext.get(IEntityPartViewer.class);
IEntity entityContents = viewer.getEntityContents();
final IEntity entity = EntityUtils.getEntity(entityContents, location);
viewer.selectAndReveal(entity);
}
}
} catch (Exception e) {
E4CompatibilityPlugin.log(e);
}
}
Aggregations