blob: 556212f99f43af7224d24d3ead1101bdf2f2bbc8 [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 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 Corporation - initial implementation
//------------------------------------------------------------------------------
package org.eclipse.epf.library.edit.command;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.command.DragAndDropCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.epf.library.edit.util.TngUtil;
/**
* @author Phong Nguyen Le
* @sine 1.2
*/
public class ResourceAwareDragAndDropCommand extends DragAndDropCommand
implements IResourceAwareCommand
{
private Set<Resource> modifiedResources;
/**
* @param domain
* @param owner
* @param location
* @param operations
* @param operation
* @param collection
*/
public ResourceAwareDragAndDropCommand(EditingDomain domain, Object owner,
float location, int operations, int operation, Collection<?> collection) {
super(domain, owner, location, operations, operation, collection);
}
/**
* @param domain
* @param owner
* @param location
* @param operations
* @param operation
* @param collection
* @param optimize
*/
public ResourceAwareDragAndDropCommand(EditingDomain domain, Object owner,
float location, int operations, int operation,
Collection<?> collection, boolean optimize) {
super(domain, owner, location, operations, operation, collection,
optimize);
}
/*
* (non-Javadoc)
*
* @see com.ibm.library.edit.command.IResourceAwareCommand#getModifiedResources()
*/
@SuppressWarnings("unchecked")
public Collection<Resource> getModifiedResources() {
if(modifiedResources == null) {
if(dropCommand != null) {
modifiedResources = TngUtil.getModifiedResources(dropCommand);
}
if(modifiedResources == null || modifiedResources.isEmpty()) {
modifiedResources = Collections.EMPTY_SET;
}
}
return modifiedResources;
}
}