use of org.eclipse.sirius.ui.business.api.session.SessionEditorInput in project InformationSystem by ObeoNetwork.
the class BindingTreeEditor method init.
/**
* {@inheritDoc}
*
* @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
setSite(site);
setInput(input);
if (input instanceof SessionEditorInput) {
final URI uri = ((SessionEditorInput) input).getURI();
this.session = ((SessionEditorInput) input).getSession();
setBindingEditorRepresentation(getBindingEditorRepresentation(uri, false));
}
if (session != null) {
session.addListener(this);
}
final IEditingSession uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(this.session);
uiSession.open();
uiSession.attachEditor(this);
setAccessor(SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(getBindingEditorRepresentation()));
/*
* let's activate the model listening
*/
// final DTreeElementSynchronizer sync = new DTreeElementSynchronizerSpec(accessor, getInterpreter());
// getTreeModel().activate(sync);
/* Update title. Semantic tree could have been renamed */
notify(PROP_TITLE);
}
use of org.eclipse.sirius.ui.business.api.session.SessionEditorInput in project InformationSystem by ObeoNetwork.
the class ValidateRequirementsHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
IEditorInput editorInput = HandlerUtil.getActiveEditorInput(event);
if (editor instanceof RequirementEditor) {
shell = HandlerUtil.getActiveShell(event);
RequirementEditor ed = (RequirementEditor) editor;
resourceSet = ed.getEditingDomain().getResourceSet();
} else if (editorInput instanceof SessionEditorInput) {
shell = HandlerUtil.getActiveShell(event);
resourceSet = ((SessionEditorInput) editorInput).getSession().getTransactionalEditingDomain().getResourceSet();
} else {
return null;
}
Collection<EObject> objects = new ArrayList<EObject>();
for (Resource resource : resourceSet.getResources()) {
for (EObject eObject : resource.getContents()) {
if (eObject instanceof Repository || eObject instanceof Category || eObject instanceof Requirement) {
objects.add(eObject);
}
}
}
executeValidation(objects);
return null;
}
use of org.eclipse.sirius.ui.business.api.session.SessionEditorInput in project InformationSystem by ObeoNetwork.
the class ContainsISModelPropertyTester method test.
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IEditorPart) {
IEditorInput editorInput = ((IEditorPart) receiver).getEditorInput();
if (editorInput instanceof SessionEditorInput) {
SessionEditorInput sessionEditorInput = (SessionEditorInput) editorInput;
Session session = sessionEditorInput.getSession();
if (session != null) {
TransactionalEditingDomain ted = session.getTransactionalEditingDomain();
if (ted != null) {
return containsIsModel(ted.getResourceSet());
}
}
}
}
return false;
}
use of org.eclipse.sirius.ui.business.api.session.SessionEditorInput in project InformationSystem by ObeoNetwork.
the class RequirementsShouldBeTested method test.
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IEditorPart) {
if (receiver instanceof RequirementEditor) {
return true;
}
IEditorInput editorInput = ((IEditorPart) receiver).getEditorInput();
if (editorInput instanceof SessionEditorInput) {
SessionEditorInput sessionEditorInput = (SessionEditorInput) editorInput;
Session session = sessionEditorInput.getSession();
if (session != null) {
TransactionalEditingDomain ted = session.getTransactionalEditingDomain();
if (ted != null) {
return containsRequirementsModel(ted.getResourceSet());
}
}
}
}
return false;
}
use of org.eclipse.sirius.ui.business.api.session.SessionEditorInput in project InformationSystem by ObeoNetwork.
the class BindingDialectUIServices method openEditor.
@Override
public IEditorPart openEditor(Session session, DRepresentation representation, IProgressMonitor monitor) {
if (representation instanceof DBindingEditor) {
monitor.beginTask("Opening binding editor", 1);
URI uri = EcoreUtil.getURI(representation);
final TransactionalEditingDomain domain = session.getTransactionalEditingDomain();
final IEditorInput editorInput = new SessionEditorInput(uri, getEditorName(representation), session);
RunnableWithResult<IEditorPart> runnable = new RunnableWithResult.Impl<IEditorPart>() {
@Override
public void run() {
final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
setResult(page.openEditor(editorInput, BindingTreeEditor.ID));
} catch (final PartInitException e) {
// silent catch
}
}
};
PlatformUI.getWorkbench().getDisplay().syncExec(runnable);
Object result = runnable.getResult();
if (result instanceof IEditorPart && canHandleEditor((IEditorPart) result)) {
// Activation of the refresh of the DBindingEditor property page
if (result instanceof BindingTreeEditor) {
// TODO v�rifier s'il faut enlever des choses
doRefresh((DBindingEditor) representation, domain);
}
return (IEditorPart) result;
}
monitor.worked(1);
monitor.done();
}
return null;
}
Aggregations