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

The following examples show how to use org.eclipse.core.internal.filesystem.local.LocalFile. 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
Source File: LocalFileAdapterFactory.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: AddOrEditCatalogDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 选择文件 ;
 */
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
Source File: AddOrEditCatalogDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 选择文件 ;
 */
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
Source File: WorkspaceFile.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
private LocalFile ensureLocalFileStore() throws CoreException {
	return ensureLocalFileStore(null);
}