org.eclipse.core.runtime.Platform.getInstallLocation()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中org.eclipse.core.runtime.Platform.getInstallLocation()方法的一些代码示例,展示了Platform.getInstallLocation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getInstallLocation()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getInstallLocation

Platform.getInstallLocation介绍

[英]Returns the location of the base installation for the running platform null is returned if the platform is running without a configuration location.

This method is equivalent to acquiring the org.eclipse.osgi.service.datalocation.Location service with the property "type" equal to Location#INSTALL_FILTER.
[中]返回运行平台的基本安装位置null,如果平台运行时没有配置位置,则返回null
此方法相当于获取org.eclipse.osgi.service.datalocation.Location服务,其属性“type”等于Location#INSTALL_FILTER。

代码示例

代码示例来源:origin: sdbg/sdbg

public static File getEclipseInstallationDirectory() {
 return new File(Platform.getInstallLocation().getURL().getFile());
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

public OSGiConsole(final OSGiConsoleFactory factory) {
  super(NLS.bind(PDEUIMessages.OSGiConsole_name, Platform.getInstallLocation().getURL().getPath()), TYPE, null, true);
  session = new ConsoleSession() {
    @Override
    public OutputStream getOutput() {
      return newOutputStream();
    }
    @Override
    public InputStream getInput() {
      return getInputStream();
    }
    @Override
    protected void doClose() {
      factory.closeConsole(OSGiConsole.this);
    }
  };
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources

@Override
  public String getValue(String variable, IResource resource) {
    URL installURL = Platform.getInstallLocation().getURL();
    try {
      return URIUtil.toURI(installURL).toASCIIString();
    } catch (URISyntaxException e) {
      return null;
    }
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee

private IPath getJarredPluginPath(Bundle bundle) {
  Path runtimeLibFullPath = null;
  String jarPluginLocation = bundle.getLocation().substring(7);
  Path jarPluginPath = new Path(jarPluginLocation);
  // handle case where jars are installed outside of eclipse installation
  if (jarPluginPath.isAbsolute())
    runtimeLibFullPath = jarPluginPath;
  // handle normal case where all plugins under eclipse install
  else {
    String installPath = Platform.getInstallLocation().getURL().getPath();
    runtimeLibFullPath = new Path(installPath+"/"+jarPluginLocation); //$NON-NLS-1$
  }
  return runtimeLibFullPath;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core

/**
 * Returns the location of the default target platform, namely the location
 * of the host (running) instance of Eclipse.
 *
 * @return the location of the default target platform
 */
public static String getDefaultLocation() {
  Location location = Platform.getInstallLocation();
  if (location != null) {
    URL url = Platform.getInstallLocation().getURL();
    IPath path = new Path(url.getFile()).removeTrailingSeparator();
    return path.toOSString();
  }
  return ""; //$NON-NLS-1$
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.core.resources

@Override
  public String getValue(String variable, IResource resource) {
    URL installURL = Platform.getInstallLocation().getURL();
    try {
      return URIUtil.toURI(installURL).toASCIIString();
    } catch (URISyntaxException e) {
      return null;
    }
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.core.resources

@Override
  public String getValue(String variable, IResource resource) {
    URL installURL = Platform.getInstallLocation().getURL();
    try {
      return URIUtil.toURI(installURL).toASCIIString();
    } catch (URISyntaxException e) {
      return null;
    }
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.pde.core

/**
 * Returns the location of the default target platform, namely the location 
 * of the host (running) instance of Eclipse.
 *  
 * @return the location of the default target platform
 */
public static String getDefaultLocation() {
  URL installURL = Platform.getInstallLocation().getURL();
  IPath path = new Path(installURL.getFile()).removeTrailingSeparator();
  return path.toOSString();
  
}

代码示例来源:origin: wala/WALA

/**
 * This is fragile.  Use with care.
 * @return a String representing the path to the wala.core plugin installation
 */
public static String getWalaCorePluginHome() {
 if (CorePlugin.getDefault() == null) {
   return null;
 }
 String install = Platform.getInstallLocation().getURL().getPath();
 Bundle b = Platform.getBundle("com.ibm.wala.core");
 String l = b.getLocation();
 if (l.startsWith("update@")) {
  l = l.replace("update@", "");
 }
 if (l.startsWith("reference:file:")) {
  return l.replace("reference:file:","");
 } else {
  return install + File.separator + l;
 }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core

File installDirectory = new File(Platform.getInstallLocation().getURL().getFile());

代码示例来源:origin: org.eclipse.platform/org.eclipse.core.variables

@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
  Location installLocation = Platform.getInstallLocation();
  if (installLocation != null) {
    URL url = installLocation.getURL();
    if (url != null) {
      // Try to convert the URL to an OS string, to be consistent with
      // how other variables, like ${workspace_loc} resolve. See
      // ResourceResolver.translateToValue(). [bugzilla 263535]
      String file = url.getFile();
      IPath path = Path.fromOSString(file);
      String osstr = path.toOSString();
      if (osstr.length() != 0) {
        return osstr;
      }
      if (file.length() != 0) {
        return file;
      }
    }
  }
  return null;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.core.variables

@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
  Location installLocation = Platform.getInstallLocation();
  if (installLocation != null) {
    URL url = installLocation.getURL();
    if (url != null) {
      // Try to convert the URL to an OS string, to be consistent with
      // how other variables, like ${workspace_loc} resolve. See
      // ResourceResolver.translateToValue(). [bugzilla 263535]
      String file = url.getFile();
      IPath path = Path.fromOSString(file);
      String osstr = path.toOSString();
      if (osstr.length() != 0) {
        return osstr;
      }
      if (file.length() != 0) {
        return file;
      }
    }
  }
  return null;
}

代码示例来源:origin: piece/makegood

bundleLocation = Platform.getInstallLocation().getURL().getPath() +
         bundleLocation;

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.debug.core

@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
  if ("ARCH".equals(argument)) { //$NON-NLS-1$
    return Platform.getOSArch();
  } else if ("ECLIPSE_HOME".equals(argument)) { //$NON-NLS-1$
    URL installURL = Platform.getInstallLocation().getURL();
    IPath ppath = new Path(installURL.getFile()).removeTrailingSeparator();
    return getCorrectPath(ppath.toOSString());
  } else if ("NL".equals(argument)) { //$NON-NLS-1$
    return Platform.getNL();
  } else if ("OS".equals(argument)) { //$NON-NLS-1$
    return Platform.getOS();
  } else if ("WS".equals(argument)) { //$NON-NLS-1$
    return Platform.getWS();
  }
  return null;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools.ui

Location location = Platform.getInstallLocation();
if (location != null) {
  URL url = location.getURL();

代码示例来源:origin: org.eclipse.pde.api.tools/ui

Location location = Platform.getInstallLocation();
if(location != null) {
  URL url = location.getURL();

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core

Location location = Platform.getInstallLocation();
if (location != null) {
  URL url = location.getURL();

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.pde.core

Location location = Platform.getInstallLocation();
if (location != null) {
  URL url = location.getURL();

相关文章