本文整理了Java中org.eclipse.core.runtime.Platform.getLocation()
方法的一些代码示例,展示了Platform.getLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getLocation()
方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getLocation
[英]Returns the location of the platform working directory.
Callers of this method should consider using getInstanceLocation
instead. In various, typically non IDE-related configurations of Eclipse, the platform working directory may not be on the local file system. As such, the more general form of this location is as a URL.
Alternatively, instead of calling getInstanceLocation
clients are able to acquire the Location service (with the type Location#INSTANCE_FILTER) and then change the resulting URL to a path. See the javadoc for getInstanceLocation
for more details.
[中]返回平台工作目录的位置。
此方法的调用方应考虑使用[[ $ 0 $] ]。在Eclipse的各种通常与IDE无关的配置中,平台工作目录可能不在本地文件系统上。因此,这个位置更一般的形式是URL。
或者,客户端可以获取位置服务(使用类型Location#INSTANCE_FILTER)而不是调用getInstanceLocation
,然后将结果URL更改为路径。有关更多详细信息,请参阅getInstanceLocation
的javadoc。
代码示例来源:origin: inspectIT/inspectIT
/**
* {@inheritDoc}
*/
@Override
protected Path getDefaultStorageDirPath() {
return Paths.get(Platform.getLocation().toString(), getStorageDefaultFolder()).toAbsolutePath();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* Return whether or not the specifed location is a prefix
* of the root.
*/
private boolean isPrefixOfRoot(IPath locationPath) {
return Platform.getLocation().isPrefixOf(locationPath);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
private IPath getOldPath() {
return Platform.getLocation().append(new Path(".metadata/.plugins/org.eclipse.core.runtime/.settings")); //$NON-NLS-1$
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* Return the location for the project. If we are using defaults then return
* the workspace root so that core creates it with default values.
*
* @return String
*/
public String getProjectLocation() {
if (isDefault()) {
return Platform.getLocation().toOSString();
}
return locationPathField.getText();
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
protected String getDefaultPath(String name) {
final IPath path= Platform.getLocation().append(name);
return path.toOSString();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public IPath getLocation() {
if (isUseDefaultSelected()) {
return Platform.getLocation();
}
return Path.fromOSString(fLocation.getText().trim());
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
protected String getDefaultPath(String name) {
final IPath path= Platform.getLocation().append(name);
return path.toOSString();
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
protected String getDefaultPath(String name) {
final IPath path= Platform.getLocation().append(name);
return path.toOSString();
}
代码示例来源:origin: io.sarl/io.sarl.eclipse
protected String getDefaultPath(String name) {
final IPath path = Platform.getLocation().append(name);
return path.toOSString();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui
/**
* Returns the path of the location chosen by the user. According to the user input, the path either points to the
* workspace or to a valid user specified location on the filesystem.
*
* @return The path of the location chosen by the user. Is never <code>null</code>.
*/
public IPath getLocationPath() {
if(isInWorkspace()) {
return Platform.getLocation();
}
return Path.fromOSString(locationCombo.getText().trim());
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.core.resources
protected WorkspaceRoot(IPath path, Workspace container) {
super(path, container);
Assert.isTrue(path.equals(Path.ROOT));
workspaceLocation = FileUtil.canonicalPath(Platform.getLocation());
Assert.isNotNull(workspaceLocation);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.core.resources
protected WorkspaceRoot(IPath path, Workspace container) {
super(path, container);
Assert.isTrue(path.equals(Path.ROOT));
workspaceLocation = FileUtil.canonicalPath(Platform.getLocation());
Assert.isNotNull(workspaceLocation);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public IPath getLocation() {
if (isUseDefaultSelected()) {
return Platform.getLocation();
}
return Path.fromOSString(fLocation.getText().trim());
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public IPath getLocation() {
if (isInWorkspace()) {
return Platform.getLocation();
}
return Path.fromOSString(fLocation.getText().trim());
}
代码示例来源:origin: io.sarl/io.sarl.eclipse
public IPath getLocation() {
if (isUseDefaultSelected()) {
return Platform.getLocation();
}
return Path.fromOSString(this.location.getText().trim());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources
protected WorkspaceRoot(IPath path, Workspace container) {
super(path, container);
Assert.isTrue(path.equals(Path.ROOT));
workspaceLocation = FileUtil.canonicalPath(Platform.getLocation());
Assert.isNotNull(workspaceLocation);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public boolean isInWorkspace() {
final String location= fLocationGroup.getLocation().toOSString();
IPath projectPath= Path.fromOSString(location);
return Platform.getLocation().isPrefixOf(projectPath);
}
代码示例来源:origin: org.eclipse/org.eclipse.emf.codegen.ecore.ui
@Override
protected boolean validatePage()
{
if (super.validatePage())
{
IPath locationPath = getLocationPath();
genModelProjectLocation = Platform.getLocation().equals(locationPath) ? null : locationPath;
IPath projectPath = getProjectHandle().getFullPath();
genModelContainerPath = projectPath.append("src");
return true;
}
else
{
return false;
}
}
};
代码示例来源:origin: org.eclipse/org.eclipse.pde.core
public static void createProject(IProject project, IPath location,
IProgressMonitor monitor) throws CoreException {
if (!Platform.getLocation().equals(location)) {
IProjectDescription desc = project.getWorkspace()
.newProjectDescription(project.getName());
desc.setLocation(location);
project.create(desc, monitor);
} else
project.create(monitor);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core
public static void createProject(IProject project, IPath location, IProgressMonitor monitor) throws CoreException {
if (!Platform.getLocation().equals(location)) {
IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName());
desc.setLocation(location);
project.create(desc, monitor);
} else
project.create(monitor);
}
内容来源于网络,如有侵权,请联系作者删除!