Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2007 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM - Initial API and implementation
 
 package org.eclipse.emf.databinding.edit;
 
 

PROVISIONAL: This API is subject to arbitrary change, including renaming or removal.

 
 {
  
The editing domain
 
   protected EditingDomain domain;

  
Observe a feature of the instance using the default realm

Parameters:
domain the editing domain
eObject the object
eStructuralFeature the feature
 
   public EditingDomainEObjectObservableList(EditingDomain domainEObject eObjectEStructuralFeature eStructuralFeature)
   {
     this(Realm.getDefault(), domaineObjecteStructuralFeature);
   }

  
Observe a feature of the instance using the realm

Parameters:
domain the editing domain
realm
eObject the object
eStructuralFeature the feature
 
   public EditingDomainEObjectObservableList(Realm realmEditingDomain domainEObject eObjectEStructuralFeature eStructuralFeature)
   {
     super(realmeObjecteStructuralFeature);
     this. = domain;
   }
 
   @Override
   public synchronized void dispose()
   {
      = null;
     super.dispose();
   }

  
Execute a command

Parameters:
command the command to execute
Returns:
true if execute else false
 
   protected boolean execute(Command command)
   {
     if (command.canExecute())
     {
       .getCommandStack().execute(command);
       return true;
     }
     else
     {
       return false;
     }
   }
 
   @Override
   public boolean add(Object object)
   {
     checkRealm();
     return execute(AddCommand.create(object));
   }
  public void add(int indexObject object)
  {
    checkRealm();
    execute(AddCommand.create(objectindex));
  }
  @SuppressWarnings("rawtypes")
  public boolean addAll(Collection collection)
  {
    checkRealm();
    return execute(AddCommand.create(collection));
  }
  @SuppressWarnings("rawtypes")
  public boolean addAll(int indexCollection collection)
  {
    checkRealm();
    return execute(AddCommand.create(collectionindex));
  }
  public Object set(int indexObject element)
  {
    checkRealm();
    Object oldElement = .get(index);
    execute(SetCommand.create(elementindex));
    return oldElement;
  }
  public Object remove(int index)
  {
    checkRealm();
    Object element = .get(index);
    execute(RemoveCommand.create(element));
    return element;
  }
  public boolean remove(Object element)
  {
    checkRealm();
    return execute(RemoveCommand.create(element));
  }
  @SuppressWarnings("rawtypes")
  public boolean removeAll(Collection collection)
  {
    checkRealm();
    return execute(RemoveCommand.create(collection));
  }
  @SuppressWarnings("rawtypes")
  public boolean retainAll(Collection collection)
  {
    checkRealm();
    Collection<ObjectobjectsToRemove = new ArrayList<Object>(wrappedList());
    objectsToRemove.removeAll(collection);
    return execute(RemoveCommand.create(objectsToRemove));
  }
  public void clear()
  {
    checkRealm();
  }
  public Object move(int newPositionint oldPosition)
  {
    Object result = .get(oldPosition);
    move(newPositionresult);
    return result;
  }
  public void move(int newPositionObject object)
  {
    checkRealm();
    execute(MoveCommand.create(objectnewPosition));
  }
New to GrepCode? Check out our FAQ X