diff options
author | William Chen | 2012-04-09 03:39:51 +0000 |
---|---|---|
committer | William Chen | 2012-04-09 03:39:51 +0000 |
commit | 269b0de82efcebe8a3bfe28fb3ee8b34377a3ba1 (patch) | |
tree | ad372a6a4a790a58a2aaefad1e6b273a50106a41 /target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java | |
parent | 8cf67b56f88b061faca8dc5d89cc267d2f2fb015 (diff) | |
download | org.eclipse.tcf-269b0de82efcebe8a3bfe28fb3ee8b34377a3ba1.tar.gz org.eclipse.tcf-269b0de82efcebe8a3bfe28fb3ee8b34377a3ba1.tar.xz org.eclipse.tcf-269b0de82efcebe8a3bfe28fb3ee8b34377a3ba1.zip |
Target Explorer: Refactoring: Split filesystem to core and ui.
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java new file mode 100644 index 000000000..1e2fdc07a --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpClipboard.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.filesystem.core.internal.operations; + +import java.beans.PropertyChangeEvent; +import java.util.List; + +import org.eclipse.tcf.te.core.utils.PropertyChangeProvider; +import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode; + +/** + * The clip board to which copy or cut files/folders. + */ +public class OpClipboard extends PropertyChangeProvider { + // The constants to define the current operation type of the clip board. + private static final int NONE = -1; + private static final int CUT = 0; + private static final int COPY = 1; + // The operation type, CUT, COPY or NONE. + private int operation; + // The currently selected files/folders. + private List<FSTreeNode> files; + + /** + * Create a clip board instance. + */ + public OpClipboard() { + operation = NONE; + } + + public boolean isCutOp() { + return operation == CUT; + } + + public boolean isCopyOp() { + return operation == COPY; + } + + /** + * If the clip board is empty. + * + * @return true if the operation is NONE and no files are selected. + */ + public boolean isEmpty() { + return operation == NONE && (files == null || files.isEmpty()); + } + + /** + * Get the currently selected files/folders to operated. + * + * @return The file/folder list using their location URLs. + */ + public List<FSTreeNode> getFiles() { + return files; + } + + /** + * Cut the specified files/folders to the clip board. + * + * @param files The file/folder nodes. + */ + public void cutFiles(List<FSTreeNode> files) { + operation = CUT; + this.files = files; + PropertyChangeEvent event = new PropertyChangeEvent(this, "cut", null, null); //$NON-NLS-1$ + firePropertyChange(event); + } + + /** + * Copy the specified files/folders to the clip board. + * + * @param files The file/folder nodes. + */ + public void copyFiles(List<FSTreeNode> files) { + operation = COPY; + this.files = files; + PropertyChangeEvent event = new PropertyChangeEvent(this, "copy", null, null); //$NON-NLS-1$ + firePropertyChange(event); + } + + /** + * Clear the clip board. + */ + public void clear() { + operation = NONE; + this.files = null; + PropertyChangeEvent event = new PropertyChangeEvent(this, "clear", null, null); //$NON-NLS-1$ + firePropertyChange(event); + } + + /** + * Dispose the clipboard. + */ + public void dispose() { + } +} |