@Override public Object compute(IEclipseContext context) { MApplicationElement mApplicationElement = context.get(MApplicationElement.class); if (mApplicationElement == null) { return null; } else { return new MementoImpl(mApplicationElement.getPersistedState()); } }
/** * Initialize the context * * @param eo * the object the context should be populated with * @param context * the context */ @SuppressWarnings("static-method") protected void initContext(@NonNull EObject eo, @NonNull IEclipseContext context) { for (EAttribute e : eo.eClass().getEAllAttributes()) { context.set(e.getName(), eo.eGet(e)); } if (eo instanceof MApplicationElement) { for (Entry<String, String> e : ((MApplicationElement) eo).getPersistedState().entrySet()) { context.set(UIEvents.ApplicationElement.PERSISTEDSTATE + "_" //$NON-NLS-1$ + e.getKey(), e.getValue()); } } // // Localized Label/Tooltip treatment // if (eo instanceof MUILabel) { // MUILabel l = (MUILabel) eo; // context.set(ATTRIBUTE_localizedLabel, l.getLocalizedLabel()); // context.set(ATTRIBUTE_localizedTooltip, l.getLocalizedTooltip()); // } }
private void createIdentifierTracker(MApplicationElement item) { if (item.getElementId() != null && item.getElementId().length() > 0) { String id = namespaceIdentifier + "/" + item.getElementId(); //$NON-NLS-1$ item.getPersistedState().put(MenuManagerRenderer.VISIBILITY_IDENTIFIER, id); final IIdentifier identifier = activityManager.getIdentifier(id); if (identifier != null) { application.getContext().set(identifier.getId(), identifier.isEnabled()); identifier.addIdentifierListener(idUpdater); } } }
@Override public boolean openEditor(String uri) { List<MPart> list = modelService.findElements(application, MPart.class, EModelService.ANYWHERE, (p) -> { return uri.equals(p.getPersistedState().get(Constants.DOCUMENT_URL)); });
Object storedNewValue = appElement.getPersistedState().get(key); Object notificationNewValue = notification.getNewValue();