本文整理汇总了Java中org.eclipse.core.resources.IPathVariableManager类的典型用法代码示例。如果您正苦于以下问题:Java IPathVariableManager类的具体用法?Java IPathVariableManager怎么用?Java IPathVariableManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IPathVariableManager类属于org.eclipse.core.resources包,在下文中一共展示了IPathVariableManager类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: covertPathToUrl
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
private static void covertPathToUrl(IProject project, Set<URL> paths, IPath path) {
if (path != null && project != null && path.removeFirstSegments(1) != null && project.findMember(path.removeFirstSegments(1)) != null) {
URI uri = project.findMember(path.removeFirstSegments(1)).getRawLocationURI();
if (uri != null) {
String scheme = uri.getScheme();
if (FILE_SCHEME.equalsIgnoreCase(scheme))
addUri(paths, uri);
else if ("sourcecontrol".equals(scheme)) {
// special case of Rational Team Concert
IPath sourceControlPath = project.findMember(path.removeFirstSegments(1)).getLocation();
File sourceControlFile = sourceControlPath.toFile();
if (sourceControlFile.exists())
addUri(paths, sourceControlFile.toURI());
} else {
IPathVariableManager variableManager = ResourcesPlugin.getWorkspace().getPathVariableManager();
addUri(paths, variableManager.resolveURI(uri));
}
}
}
}
示例2: undeployCheckConfiguration
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
/**
* Undeploys the check configuration.
*
* @throws CoreException
* core exception.
*/
public static void undeployCheckConfiguration() throws CoreException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IPathVariableManager pathMan = workspace.getPathVariableManager();
if (pathMan.getURIValue(CheckCfgConstants.CHECK_CFG_VAR_NAME) == null) {
return;
}
pathMan.setURIValue(CheckCfgConstants.CHECK_CFG_VAR_NAME, null);
}
示例3: createRelativePath
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
/**
* Transform an absolute path URI to a relative path one (i.e. from "C:\foo\bar\file.txt" to
* "VAR\file.txt" granted that the relativeVariable is "VAR" and points to "C:\foo\bar\").
*
* @param location
* @param resource
* @return an URI that was made relative to a variable
*/
private IPath createRelativePath(IPath location, IResource resource) {
if (relativeVariable == null) return location;
if (relativeVariable.equals(ABSOLUTE_PATH)) return location;
IPathVariableManager pathVariableManager = resource.getPathVariableManager();
try {
return URIUtil.toPath(
pathVariableManager.convertToRelative(URIUtil.toURI(location), true, relativeVariable));
} catch (CoreException e) {
return location;
}
}
示例4: setupWorkspaceVariables
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
/**
* Sets up workspace variables to point at the the {@code GWT_ROOT} and {@code GWT_TOOLS}
* environment variables, which point at a local clone of the GWT git repository. If those
* environment variables are not set, extracts a snapshot of the GWT source tree that
* is bundled with this plug-in and sets the environment variables to point at it.
*/
private static void setupWorkspaceVariables() throws CoreException {
IPathVariableManager variableManager = ResourcesPlugin.getWorkspace().getPathVariableManager();
String gwtRoot = System.getenv("GWT_ROOT");
if (gwtRoot == null) {
System.out.println("The GWT_ROOT environment variable is not set, using test bundle version");
gwtRoot = TestEnvironmentUtil.installTestSdk(
GwtTestingPlugin.getDefault().getBundle(),
Path.fromPortableString("/resources/gwt-root.zip")).append("trunk").toOSString();
TestEnvironmentUtil.updateEnvironmentVariable("GWT_ROOT", gwtRoot);
System.out.println("The GWT_ROOT environment variable is now set");
}
IPath gwtRootPath = Path.fromOSString(gwtRoot);
if (variableManager.getURIValue("GWT_ROOT") == null) {
CorePluginLog.logInfo("Setting GWT_ROOT = " + gwtRootPath.toOSString());
variableManager.setURIValue("GWT_ROOT", gwtRootPath.toFile().toURI());
}
String gwtTools = System.getenv("GWT_TOOLS");
if (gwtTools == null) {
System.out.println("The GWT_TOOLS environment variable is not set, using GWT_ROOT as a base");
gwtTools = gwtRoot + "/tools";
TestEnvironmentUtil.updateEnvironmentVariable("GWT_TOOLS", gwtTools);
}
IPath gwtToolsPath = Path.fromOSString(gwtTools);
if (JavaCore.getClasspathVariable("GWT_TOOLS") == null) {
CorePluginLog.logInfo("Setting GWT_TOOLS = " + gwtToolsPath.toOSString());
JavaCore.setClasspathVariable("GWT_TOOLS", gwtToolsPath, null);
}
}
示例5: validate
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
@Override
public IStatus validate() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IPathVariableManager pathVariableManager = workspace.getPathVariableManager();
URI gwtUri = pathVariableManager.getURIValue("GWT_ROOT");
if (gwtUri == null) {
return new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID,
"Path variable 'GWT_ROOT' is not defined");
}
IPath gwtRoot = URIUtil.toPath(gwtUri);
if (gwtRoot == null) {
return new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID,
"Path variable 'GWT_ROOT' is not defined");
}
if (!gwtRoot.toFile().exists()) {
return new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID,
"Path variable 'GWT_ROOT' points to an invalid location");
}
if (findDevProject() == null) {
return new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID, "Could not find and gwt-dev-* project");
}
if (findUserProject() == null) {
return new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID, "Could not find the gwt-user project");
}
return getGwtDevJarStatus(this);
}
示例6: getSourceFile
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
/**
* @param source
* @return File object, corresponding to given resource. This file could be
* deleted or not yet created.
*/
protected File getSourceFile(IResource source) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
// linked resources will be resolved here!
IPath rawPath = source.getRawLocation();
// here we should resolve path variables,
// probably existing at first place of path
IPathVariableManager pathManager = workspace.getPathVariableManager();
rawPath = pathManager.resolvePath(rawPath);
return rawPath.toFile();
}
示例7: validateLinkLocation
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
/**
* Validates this page's controls.
* @param folderName the folder name
*
* @return IStatus indicating the validation result. IStatus.OK if the
* specified link target is valid given the linkHandle.
*/
private IStatus validateLinkLocation(String folderName) {
IWorkspace workspace= JavaPlugin.getWorkspace();
IPath path= Path.fromOSString(fLinkFields.fLinkLocation.getText());
Path folderLocation= new Path(folderName);
if (folderLocation.isAbsolute())
return new StatusInfo(IStatus.ERROR, NewWizardMessages.AddSourceFolderWizardPage_error_NotARelativePathName);
IProject project= fNewElement.getJavaProject().getProject();
IFolder folder= project.getFolder(folderLocation);
IStatus locationStatus= workspace.validateLinkLocation(folder, path);
if (locationStatus.matches(IStatus.ERROR))
return locationStatus;
IPathVariableManager pathVariableManager= project.getPathVariableManager();
IPath path1= Path.fromOSString(fLinkFields.fLinkLocation.getText());
IPath resolvedPath= pathVariableManager.resolvePath(path1);
// use the resolved link target name
String resolvedLinkTarget= resolvedPath.toOSString();
path= new Path(resolvedLinkTarget);
File linkTargetFile= new Path(resolvedLinkTarget).toFile();
if (linkTargetFile.exists()) {
if (!linkTargetFile.isDirectory())
return new StatusInfo(IStatus.ERROR, NewWizardMessages.NewFolderDialog_linkTargetNotFolder);
} else {
return new StatusInfo(IStatus.ERROR, NewWizardMessages.NewFolderDialog_linkTargetNonExistent);
}
if (locationStatus.isOK()) {
return new StatusInfo();
}
return new StatusInfo(locationStatus.getSeverity(), locationStatus.getMessage());
}
示例8: createRelativePath
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
/**
* Transform an absolute path URI to a relative path one (i.e. from
* "C:\foo\bar\file.txt" to "VAR\file.txt" granted that the relativeVariable
* is "VAR" and points to "C:\foo\bar\").
*
* @param location
* @param resource
* @return an URI that was made relative to a variable
*/
private IPath createRelativePath(IPath location, IResource resource) {
if (relativeVariable == null)
return location;
if (relativeVariable.equals(ABSOLUTE_PATH))
return location;
IPathVariableManager pathVariableManager = resource.getPathVariableManager();
// try {
// return URIUtil.toPath(pathVariableManager.convertToRelative(URIUtil.toURI(location), true, relativeVariable));
// } catch (CoreException e) {
// return location;
// }
return null; // temporary
}
示例9: getPathVariableManager
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
@Override
public IPathVariableManager getPathVariableManager() {
// not required
return null;
}
示例10: getPathVariableManager
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
@Override
public IPathVariableManager getPathVariableManager() {
throw new UnsupportedOperationException();
}
示例11: getPathVariableManager
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
public IPathVariableManager getPathVariableManager() {
// if (getProject() == null)
// return workspace.getPathVariableManager();
// return new ProjectPathVariableManager(this);
throw new UnsupportedOperationException();
}
示例12: getPathVariableManager
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public IPathVariableManager getPathVariableManager() {
return resource().getPathVariableManager();
}
示例13: getPathVariableManager
import org.eclipse.core.resources.IPathVariableManager; //导入依赖的package包/类
@Override
public IPathVariableManager getPathVariableManager() {
return null;
}