当前位置: 首页>>代码示例>>Java>>正文


Java URIUtil.append方法代码示例

本文整理汇总了Java中org.eclipse.core.runtime.URIUtil.append方法的典型用法代码示例。如果您正苦于以下问题:Java URIUtil.append方法的具体用法?Java URIUtil.append怎么用?Java URIUtil.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.runtime.URIUtil的用法示例。


在下文中一共展示了URIUtil.append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getURI

import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
/**
 * Returns a URI for a specification.
 * 
 * @param spec Specification
 * @param base Base location
 * @return URI or <code>null</code>
 */
protected URI getURI(String spec, URI base) {
	// Bad specification
	if (spec.startsWith("@"))
		return null;
	
	URI uri = null;
	try {
		uri = URIUtil.fromString(spec);
		String uriScheme = uri.getScheme();
		// Handle jar scheme special to support relative paths
		if ((uriScheme != null) && uriScheme.equals("jar")) { //$NON-NLS-1$
			String path = uri.getSchemeSpecificPart().substring("file:".length()); //$NON-NLS-1$
			URI relPath = URIUtil.append(base, path);
			uri = new URI("jar:" + relPath.toString());  //$NON-NLS-1$
		}
		else {
			uri = URIUtil.makeAbsolute(uri, base);
		}
	} catch (URISyntaxException e) {
		LogHelper.log(new Status(IStatus.ERROR, Installer.ID, "Invalid URL in install description: " + spec, e)); //$NON-NLS-1$
	}
	
	return uri;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:32,代码来源:InstallDescription.java

示例2: resolveFile

import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
/**
 * Resolves an install file.
 * 
 * @param site File URI or <code>null</code>.
 * @param filename File name
 * @return File URI
 * @throws URISyntaxException on invalid syntax
 */
private URI resolveFile(String site, String filename) throws URISyntaxException {
	// If no URL was given from the outside, look for file 
	// relative to where the installer is running.  This allows the installer to be self-contained
	if (site == null)
		site = filename;
	
	URI propsURI = URIUtil.fromString(site);
	if (!propsURI.isAbsolute()) {
		String installerInstallArea = System.getProperty(IInstallConstants.OSGI_INSTALL_AREA);
		if (installerInstallArea == null)
			throw new IllegalStateException(InstallMessages.Error_NoInstallArea);
		
		// Get the locale
		String locale = Platform.getNL();
		// Check for locale installer description
		propsURI = URIUtil.append(URIUtil.fromString(installerInstallArea), locale);
		propsURI = URIUtil.append(propsURI, site);
		File installerDescription = URIUtil.toFile(propsURI);
		// If not found, use default install description
		if (!installerDescription.exists()) {
			propsURI = URIUtil.append(URIUtil.fromString(installerInstallArea), site);
			installerDescription = URIUtil.toFile(propsURI);
			if (!installerDescription.exists()) {
				propsURI = null;
			}
		}
	}
	
	return propsURI;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:39,代码来源:Installer.java

示例3: getInstallFile

import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
/**
 * Returns the path to an install file.
 * 
 * @param site File
 * @return Install file
 * @throws URISyntaxException on bad format
 */
public File getInstallFile(String site) throws URISyntaxException {
	String installArea = System.getProperty(IInstallConstants.OSGI_INSTALL_AREA);
	URI fileUri = URIUtil.append(URIUtil.fromString(installArea), site);
	File file = URIUtil.toFile(fileUri);

	return file;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:15,代码来源:Installer.java

示例4: validateURL

import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
private void validateURL(URL location) throws MalformedURLException, URISyntaxException {
	URI path= URIUtil.toURI(location);
	URI index = URIUtil.append(path, "index.html"); //$NON-NLS-1$
	URI packagelist = URIUtil.append(path, "package-list"); //$NON-NLS-1$
	URL indexURL = URIUtil.toURL(index);
	URL packagelistURL = URIUtil.toURL(packagelist);
	
	boolean suc= checkURLConnection(indexURL) && checkURLConnection(packagelistURL);
	if (suc) {
		showConfirmValidationDialog(indexURL);
	} else {
		MessageDialog.openWarning(fShell, fTitle, fInvalidMessage);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:JavadocConfigurationBlock.java

示例5: getFolder

import org.eclipse.core.runtime.URIUtil; //导入方法依赖的package包/类
private <T extends QObjectNameable> IFolder getFolder(QSourceEntry parent, Class<T> type, boolean create) {

		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		IProject project = root.getProject(URIUtil.lastSegment(parent.getRoot().getLocation()));

		// TODO da eliminare
		if (parent.isRoot() && type == null)
			return project.getFolder("src");

		java.net.URI location = URIUtil.removeFileExtension(parent.getLocation());

		if (type != null) {
			location = URIUtil.append(location, bundlePath);
			location = URIUtil.append(location, getFolderName(type));
		}

		location = URIUtil.makeRelative(location, parent.getRoot().getLocation());

		IFolder folder = project.getFolder(location.toString());
		if (!folder.exists() && create) {
			try {
				folder.create(true, true, null);
			} catch (CoreException e) {
				return null;
			}
		}
		if (!folder.exists())
			return null;

		return folder;
	}
 
开发者ID:asupdev,项目名称:asup,代码行数:32,代码来源:JDTSourceManagerImpl.java


注:本文中的org.eclipse.core.runtime.URIUtil.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。