Java Code Examples for org.eclipse.core.internal.filesystem.local.LocalFile

The following examples show how to use org.eclipse.core.internal.filesystem.local.LocalFile. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public Object getAdapter(Object adaptableObject, Class adapterType) {
	if (File.class.equals(adapterType) && adaptableObject instanceof LocalFile) {
		try {
			return ((LocalFile) adaptableObject).toLocalFile(EFS.NONE, null);
		} catch (CoreException e) {
			IdeLog.logWarning(CoreIOPlugin.getDefault(), e);
		}
	}
	return null;
}
 
Example 2
/**
 * 选择文件 ;
 */
public void browseFiles() {
	FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(getShell(), false, IResource.FILE);
	dialog.setMessage(Messages.getString("dialogs.AddOrEditCatalogDialog.dialogMsg"));
	dialog.setDoubleClickSelects(true);

	try {
		dialog.setInput(EFS.getStore(URIUtil.toURI(root.getLocation().append(ADConstants.cataloguePath))));

	} catch (CoreException e1) {
		e1.printStackTrace();
	}
	dialog.create();
	dialog.getShell().setText(Messages.getString("dialogs.AddOrEditCatalogDialog.dialogTitle"));
	dialog.open();
	if (dialog.getFirstResult() != null) {
		Object object = dialog.getFirstResult();
		if (object instanceof LocalFile) {
			LocalFile localFile = (LocalFile) object;
			String location = localFile.toString();
			String catalogurePath = root.getLocation().append(ADConstants.cataloguePath).toOSString();
			String uriStr = "";
			if (location.indexOf(catalogurePath) != -1) {
				uriStr = location.substring(location.indexOf(catalogurePath) + catalogurePath.length(), location.length());
			}
			uriStr = uriStr.substring(1, uriStr.length());
			urlTxt.setText(uriStr);
		}
	}
}
 
Example 3
/**
 * 选择文件 ;
 */
public void browseFiles() {
	FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(getShell(), false, IResource.FILE);
	dialog.setMessage(Messages.getString("dialogs.AddOrEditCatalogDialog.dialogMsg"));
	dialog.setDoubleClickSelects(true);

	try {
		dialog.setInput(EFS.getStore(URIUtil.toURI(root.getLocation().append(ADConstants.cataloguePath))));

	} catch (CoreException e1) {
		e1.printStackTrace();
	}
	dialog.create();
	dialog.getShell().setText(Messages.getString("dialogs.AddOrEditCatalogDialog.dialogTitle"));
	dialog.open();
	if (dialog.getFirstResult() != null) {
		Object object = dialog.getFirstResult();
		if (object instanceof LocalFile) {
			LocalFile localFile = (LocalFile) object;
			String location = localFile.toString();
			String catalogurePath = root.getLocation().append(ADConstants.cataloguePath).toOSString();
			String uriStr = "";
			if (location.indexOf(catalogurePath) != -1) {
				uriStr = location.substring(location.indexOf(catalogurePath) + catalogurePath.length(), location.length());
			}
			uriStr = uriStr.substring(1, uriStr.length());
			urlTxt.setText(uriStr);
		}
	}
}
 
Example 4
private LocalFile ensureLocalFileStore() throws CoreException {
	return ensureLocalFileStore(null);
}