本文整理汇总了Java中com.android.ddmlib.FileListingService.FileEntry类的典型用法代码示例。如果您正苦于以下问题:Java FileEntry类的具体用法?Java FileEntry怎么用?Java FileEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileEntry类属于com.android.ddmlib.FileListingService包,在下文中一共展示了FileEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: pull
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
/**
* Pulls file(s) or folder(s).
* @param entries the remote item(s) to pull
* @param localPath The local destination. If the entries count is > 1 or
* if the unique entry is a folder, this should be a folder.
* @param monitor The progress monitor. Cannot be null.
* @throws SyncException
* @throws IOException
* @throws TimeoutException
*
* @see FileListingService.FileEntry
* @see #getNullProgressMonitor()
*/
public void pull(FileEntry[] entries, String localPath, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
// first we check the destination is a directory and exists
File f = new File(localPath);
if (!f.exists()) {
throw new SyncException(SyncError.NO_DIR_TARGET);
}
if (!f.isDirectory()) {
throw new SyncException(SyncError.TARGET_IS_FILE);
}
// get a FileListingService object
FileListingService fls = new FileListingService(mDevice);
// compute the number of file to move
int total = getTotalRemoteFileSize(entries, fls);
// start the monitor
monitor.start(total);
doPull(entries, localPath, fls, monitor);
monitor.stop();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:SyncService.java
示例2: push
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
/**
* Push several files.
* @param local An array of loca files to push
* @param remote the remote {@link FileEntry} representing a directory.
* @param monitor The progress monitor. Cannot be null.
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
public void push(String[] local, FileEntry remote, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
if (!remote.isDirectory()) {
throw new SyncException(SyncError.REMOTE_IS_FILE);
}
// make a list of File from the list of String
ArrayList<File> files = new ArrayList<File>();
for (String path : local) {
files.add(new File(path));
}
// get the total count of the bytes to transfer
File[] fileArray = files.toArray(new File[files.size()]);
int total = getTotalLocalFileSize(fileArray);
monitor.start(total);
doPush(fileArray, remote.getFullPath(), monitor);
monitor.stop();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:SyncService.java
示例3: getTotalRemoteFileSize
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
/**
* compute the recursive file size of all the files in the list. Folder
* have a weight of 1.
* @param entries
* @param fls
* @return
*/
private int getTotalRemoteFileSize(FileEntry[] entries, FileListingService fls) {
int count = 0;
for (FileEntry e : entries) {
int type = e.getType();
if (type == FileListingService.TYPE_DIRECTORY) {
// get the children
FileEntry[] children = fls.getChildren(e, false, null);
count += getTotalRemoteFileSize(children, fls) + 1;
} else if (type == FileListingService.TYPE_FILE) {
count += e.getSizeValue();
}
}
return count;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SyncService.java
示例4: setChildren
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public void setChildren(final FileEntry entry, FileEntry[] children) {
final Tree t = mViewer.getTree();
if (t != null && t.isDisposed() == false) {
Display display = t.getDisplay();
if (display.isDisposed() == false) {
display.asyncExec(new Runnable() {
@Override
public void run() {
if (t.isDisposed() == false) {
// refresh the entry.
mViewer.refresh(entry);
// force it open, since on linux and windows
// when getChildren() returns null, the node is
// not considered expanded.
mViewer.setExpandedState(entry, true);
}
}
});
}
}
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:24,代码来源:DeviceContentProvider.java
示例5: refreshEntry
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public void refreshEntry(final FileEntry entry) {
final Tree t = mViewer.getTree();
if (t != null && t.isDisposed() == false) {
Display display = t.getDisplay();
if (display.isDisposed() == false) {
display.asyncExec(new Runnable() {
@Override
public void run() {
if (t.isDisposed() == false) {
// refresh the entry.
mViewer.refresh(entry);
}
}
});
}
}
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:19,代码来源:DeviceContentProvider.java
示例6: getChildren
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof FileEntry) {
FileEntry parentEntry = (FileEntry)parentElement;
Object[] oldEntries = parentEntry.getCachedChildren();
Object[] newEntries = mFileListingService.getChildren(parentEntry,
true, sListingReceiver);
if (newEntries != null) {
return newEntries;
} else {
// if null was returned, this means the cache was not valid,
// and a thread was launched for ls. sListingReceiver will be
// notified with the new entries.
return oldEntries;
}
}
return new Object[0];
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:21,代码来源:DeviceContentProvider.java
示例7: getColumnImage
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == 0) {
if (element instanceof FileEntry) {
FileEntry entry = (FileEntry)element;
switch (entry.getType()) {
case FileListingService.TYPE_FILE:
case FileListingService.TYPE_LINK:
// get the name and extension
if (entry.isApplicationPackage()) {
return mPackageImage;
}
return mFileImage;
case FileListingService.TYPE_DIRECTORY:
case FileListingService.TYPE_DIRECTORY_LINK:
return mFolderImage;
}
}
// default case return a different image.
return mOtherImage;
}
return null;
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:25,代码来源:FileLabelProvider.java
示例8: getColumnText
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public String getColumnText(Object element, int columnIndex) {
if (element instanceof FileEntry) {
FileEntry entry = (FileEntry)element;
switch (columnIndex) {
case 0:
return entry.getName();
case 1:
return entry.getSize();
case 2:
return entry.getDate();
case 3:
return entry.getTime();
case 4:
return entry.getPermissions();
case 5:
return entry.getInfo();
}
}
return null;
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:23,代码来源:FileLabelProvider.java
示例9: pull
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
/**
* Pulls file(s) or folder(s).
* @param entries the remote item(s) to pull
* @param localPath The local destination. If the entries count is > 1 or
* if the unique entry is a folder, this should be a folder.
* @param monitor The progress monitor. Cannot be null.
* @throws SyncException
* @throws IOException
* @throws TimeoutException
*
* @see FileListingService.FileEntry
* @see #getNullProgressMonitor()
*/
public void pull(FileEntry[] entries, String localPath, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
// first we check the destination is a directory and exists
File f = new File(localPath);
if (f.exists() == false) {
throw new SyncException(SyncError.NO_DIR_TARGET);
}
if (f.isDirectory() == false) {
throw new SyncException(SyncError.TARGET_IS_FILE);
}
// get a FileListingService object
FileListingService fls = new FileListingService(mDevice);
// compute the number of file to move
int total = getTotalRemoteFileSize(entries, fls);
// start the monitor
monitor.start(total);
doPull(entries, localPath, fls, monitor);
monitor.stop();
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:39,代码来源:SyncService.java
示例10: push
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
/**
* Push several files.
* @param local An array of loca files to push
* @param remote the remote {@link FileEntry} representing a directory.
* @param monitor The progress monitor. Cannot be null.
* @throws SyncException if file could not be pushed
* @throws IOException in case of I/O error on the connection.
* @throws TimeoutException in case of a timeout reading responses from the device.
*/
public void push(String[] local, FileEntry remote, ISyncProgressMonitor monitor)
throws SyncException, IOException, TimeoutException {
if (remote.isDirectory() == false) {
throw new SyncException(SyncError.REMOTE_IS_FILE);
}
// make a list of File from the list of String
ArrayList<File> files = new ArrayList<File>();
for (String path : local) {
files.add(new File(path));
}
// get the total count of the bytes to transfer
File[] fileArray = files.toArray(new File[files.size()]);
int total = getTotalLocalFileSize(fileArray);
monitor.start(total);
doPush(fileArray, remote.getFullPath(), monitor);
monitor.stop();
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:32,代码来源:SyncService.java
示例11: FileBean
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
public FileBean(FileEntry fileEntry){
name = fileEntry.getName();
info = fileEntry.getInfo();
permissions = fileEntry.getPermissions();
size = fileEntry.getSize();
date = fileEntry.getDate();
time = fileEntry.getTime();
owner = fileEntry.getOwner();
group = fileEntry.getGroup();
type = fileEntry.getType();
}
开发者ID:GroupControlDroid,项目名称:GroupControlDroidClient,代码行数:12,代码来源:FileBean.java
示例12: getParent
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public Object getParent(Object element) {
if (element instanceof FileEntry) {
FileEntry entry = (FileEntry)element;
return entry.getParent();
}
return null;
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:10,代码来源:DeviceContentProvider.java
示例13: hasChildren
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public boolean hasChildren(Object element) {
if (element instanceof FileEntry) {
FileEntry entry = (FileEntry)element;
return entry.getType() == FileListingService.TYPE_DIRECTORY;
}
return false;
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:10,代码来源:DeviceContentProvider.java
示例14: getElements
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public Object[] getElements(Object inputElement) {
if (inputElement instanceof FileEntry) {
FileEntry entry = (FileEntry)inputElement;
if (entry.isRoot()) {
return getChildren(mRootEntry);
}
}
return null;
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:12,代码来源:DeviceContentProvider.java
示例15: inputChanged
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (viewer instanceof TreeViewer) {
mViewer = (TreeViewer)viewer;
}
if (newInput instanceof FileEntry) {
mRootEntry = (FileEntry)newInput;
}
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:10,代码来源:DeviceContentProvider.java
示例16: refresh
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
/**
* Refresh an entry from a non ui thread.
* @param entry the entry to refresh.
*/
private void refresh(final FileEntry entry) {
Display d = mTreeViewer.getTree().getDisplay();
d.asyncExec(new Runnable() {
@Override
public void run() {
mTreeViewer.refresh(entry);
}
});
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:14,代码来源:DeviceExplorer.java
示例17: getListCellRendererComponent
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
FileEntry entry = (FileEntry) value;
setOpaque(isSelected);
if(isSelected) {
setForeground(Color.BLACK);
} else {
setForeground(Color.WHITE);
}
if ( entry != null ) {
if ( index == 0 ) {
setText(null);
setIcon(Utils.getResImage("res/to-up.png"));
} else {
setText(entry.getName());
setIcon(Utils.getResImage("res/folder-mid.png"));
}
} else {
setText(" / ");
setIcon(Utils.getResImage("res/red.png"));
}
return this;
}
开发者ID:HoneyFish,项目名称:SmartTools,代码行数:29,代码来源:FilerListRender.java
示例18: addRight
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
@Override
protected void addRight() {
super.addRight();
JLabel rightTitle = new JLabel("我的收藏");
rightTitle.setForeground(Color.WHITE);
rightTitle.setBounds(4, 0, Config.PANEL_RIGHT_WIDTH, 32);
rightTitle.setOpaque(false);
mRightPanel.add(rightTitle);
rightTitle = new JLabel("外置存储卡");
rightTitle.setForeground(Color.WHITE);
rightTitle.setBounds(4, 30, Config.PANEL_RIGHT_WIDTH, 32);
rightTitle.setOpaque(false);
mRightPanel.add(rightTitle);
rightTitle = new JLabel("内置存储卡");
rightTitle.setForeground(Color.WHITE);
rightTitle.setBounds(4, 60, Config.PANEL_RIGHT_WIDTH, 32);
rightTitle.setOpaque(false);
mRightPanel.add(rightTitle);
mBtnGetOut = getButton("取出文件");
mBtnGetOut.setBounds(4, 100, 100, 24);
mRightPanel.add(mBtnGetOut);
mBtnGetOut.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (mCurSel < 0) {
return;
}
String child = (String) mCurDirFiles.getValueAt(mCurSel, 1);
FileEntry curSel = mCurEntry.findChild(child);
FileSyncHelper syncHelper = new FileSyncHelper(mCurDevice,
curSel);
syncHelper.syncOut();
}
});
}
开发者ID:HoneyFish,项目名称:SmartTools,代码行数:41,代码来源:PageFiler.java
示例19: updateFiler
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
private void updateFiler() {
FileEntry[] entries = mFileSvr.getChildren(mCurEntry, true, null);
mListModel.clear();
((DefaultTableModel) mCurDirFilesModel).getDataVector().clear();
mListModel.addElement(mCurEntry.getParent());
for (FileEntry fileEntry : entries) {
Object[] details = new Object[7];
if (fileEntry.isDirectory()) {
mListModel.addElement(fileEntry);
details[0] = mIconFolder;
} else {
details[0] = mIconFile;
}
details[1] = fileEntry.getName();
details[2] = fileEntry.getSize();
details[3] = fileEntry.getDate();
details[4] = fileEntry.getTime();
details[5] = fileEntry.getPermissions();
details[6] = fileEntry.getInfo();
mCurDirFilesModel.addRow(details);
// System.out.println(details[1]);
}
}
开发者ID:HoneyFish,项目名称:SmartTools,代码行数:30,代码来源:PageFiler.java
示例20: pushIntoSelection
import com.android.ddmlib.FileListingService.FileEntry; //导入依赖的package包/类
/**
* Push new file(s) and folder(s) into the current selection. Current
* selection must be single item. If the current selection is not a
* directory, the parent directory is used.
* This method displays a dialog to let the user choose file to push to
* the device.
*/
public void pushIntoSelection() {
// get the name of the object we're going to pull
TreeItem[] items = mTree.getSelection();
if (items.length == 0) {
return;
}
FileDialog dlg = new FileDialog(mParent.getShell(), SWT.OPEN);
String fileName;
dlg.setText("Put File on Device");
// There should be only one.
FileEntry entry = (FileEntry)items[0].getData();
dlg.setFileName(entry.getName());
String defaultPath = mDefaultSave;
if (defaultPath == null) {
defaultPath = System.getProperty("user.home"); //$NON-NLS-1$
}
dlg.setFilterPath(defaultPath);
fileName = dlg.open();
if (fileName != null) {
mDefaultSave = dlg.getFilterPath();
// we need to figure out the remote path based on the current selection type.
String remotePath;
FileEntry toRefresh = entry;
if (entry.isDirectory()) {
remotePath = entry.getFullPath();
} else {
toRefresh = entry.getParent();
remotePath = toRefresh.getFullPath();
}
pushFile(fileName, remotePath);
mTreeViewer.refresh(toRefresh);
}
}
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:49,代码来源:DeviceExplorer.java
注:本文中的com.android.ddmlib.FileListingService.FileEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论