Search in sources :

Example 1 with Environment

use of org.whole.lang.environment.model.Environment in project whole by wholeplatform.

the class EnvironmentPart method getModelSpecificChildren.

@Override
protected List<IEntity> getModelSpecificChildren() {
    Environment entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(3);
    list.add(entity.getName());
    list.add(entity.getFilter());
    list.add(entity.getBindings());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) Environment(org.whole.lang.environment.model.Environment)

Example 2 with Environment

use of org.whole.lang.environment.model.Environment in project whole by wholeplatform.

the class EnvironmentPart method createFigure.

protected IFigure createFigure() {
    Environment entity = getModelEntity();
    return new EnvironmentFigure(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            Environment entity = getModelEntity();
            ModelTransactionCommand command = new ModelTransactionCommand(entity);
            try {
                command.begin();
                IBindingManager bm = entity.getBindingManager().getValue();
                if (Matcher.match(EnvironmentEntityDescriptorEnum.Bindings, entity.getBindings()))
                    entity.setBindings((BindingsModel) BindingManagerFactory.instance.createFlatScopedBindingsModel(bm));
                else
                    entity.setBindings((BindingsModel) BindingManagerFactory.instance.createFlatBindingsModel(bm));
                command.commit();
                getViewer().getEditDomain().getCommandStack().execute(command);
            } catch (Exception e) {
                command.rollbackIfNeeded();
            }
        }
    }, Matcher.matchImpl(EnvironmentEntityDescriptorEnum.ScopedBindings, entity.getBindings()));
}
Also used : ModelTransactionCommand(org.whole.lang.ui.commands.ModelTransactionCommand) ActionListener(org.eclipse.draw2d.ActionListener) ActionEvent(org.eclipse.draw2d.ActionEvent) IBindingManager(org.whole.lang.bindings.IBindingManager) Environment(org.whole.lang.environment.model.Environment) EnvironmentFigure(org.whole.lang.environment.ui.figures.EnvironmentFigure)

Aggregations

Environment (org.whole.lang.environment.model.Environment)2 ArrayList (java.util.ArrayList)1 ActionEvent (org.eclipse.draw2d.ActionEvent)1 ActionListener (org.eclipse.draw2d.ActionListener)1 IBindingManager (org.whole.lang.bindings.IBindingManager)1 EnvironmentFigure (org.whole.lang.environment.ui.figures.EnvironmentFigure)1 IEntity (org.whole.lang.model.IEntity)1 ModelTransactionCommand (org.whole.lang.ui.commands.ModelTransactionCommand)1