Package org.eclipse.osgi.service.datalocation

Examples of org.eclipse.osgi.service.datalocation.Location


      throw new RuntimeException(e);
    }
    if (refs.isEmpty())
      return null;
    ServiceReference<Location> ref = refs.iterator().next();
    Location location = context.getService(ref);
    try {
      if (location == null)
        return null;
      URL root = location.getURL();
      if (root == null)
        return null;
      // strip off file: prefix from URL
      return new Path(root.toExternalForm().substring(5));
    } finally {
View Full Code Here


      // should not happen
    }
    ServiceTracker configLocationTracker = new ServiceTracker(context, filter, null);
    configLocationTracker.open();
    try {
      Location configLocation = (Location) configLocationTracker.getService();
      if (configLocation == null)
        return null;

      URL baseURL = configLocation.getURL();
      if (configLocation.getParentLocation() != null && configLocation.getURL() != null) {
        if (baseURL == null)
          return new URL[] {configLocation.getParentLocation().getURL()};
        else
          return new URL[] {baseURL, configLocation.getParentLocation().getURL()};
      }
      if (baseURL != null)
        return new URL[] {baseURL};

      return null;
View Full Code Here

  public static URI getInstallLocationURI(BundleContext context) {
    try {
      ServiceReference[] references = context.getServiceReferences(Location.class.getName(), Location.INSTALL_FILTER);
      if (references != null && references.length > 0) {
        ServiceReference reference = references[0];
        Location installLocation = (Location) context.getService(reference);
        if (installLocation != null) {
          try {
            if (installLocation.isSet()) {
              URL location = installLocation.getURL();
              return URIUtil.toURI(location);
            }
          } catch (URISyntaxException e) {
            //TODO: log an error
          } finally {
View Full Code Here

    return EOModelerPerspectiveFactory.EOMODELER_PERSPECTIVE_ID;
  }

  @Override
  public void preStartup() {
    Location loc = Platform.getInstanceLocation();
    try {
      // loc.setURL(new File("/tmp/.entityModeler").toURL(), false);
    }
    catch (Exception e) {
      e.printStackTrace();
View Full Code Here

* @since 3.2
*/
public class EclipseHomeVariableResolver implements IDynamicVariableResolver {

    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]
View Full Code Here

  }

  private boolean lockInstance() {
    final URL url = getLockLocationURL();
    if(url != null) {
      final Location loc = Platform.getInstanceLocation();
      try {
        if(!loc.isSet()) {
          loc.set(url, false);
        }
        if(loc.isLocked()) {
          return false;
        }
        loc.lock();
        return true;
      } catch (IllegalStateException e) {
        MessageDialog.openWarning(null, "Warning", "Exception trying to lock Vega instance: "+ e.getMessage());
      } catch (IOException e) {
        MessageDialog.openWarning(null, "Warning", "I/O Exception trying to lock Vega instance: "+ e.getMessage());
View Full Code Here

          return;
      } catch (InvalidSyntaxException e) {
        // ignore this.  It should never happen as we have tested the above format.
        return;
      }
      Location configurationLocation = (Location) Activator.getContext().getService(refs[0]);
      if (configurationLocation == null)
        return;
      File file = new File(configurationLocation.getURL().getPath() + "/org.eclipse.core.runtime"); //$NON-NLS-1$
      Activator.getContext().ungetService(refs[0]);
      file = new File(file, F_KEYRING);
      keyringFile = file.getAbsolutePath();
    }
    try {
View Full Code Here

    // b) in the shared configuration area (typically, shared install is used)
    File[] registryLocations;
    boolean[] readOnlyLocations;

    RegistryStrategy strategy = null;
    Location configuration = OSGIUtils.getDefault().getConfigurationLocation();
    if (configuration == null) {
      RegistryProperties.setProperty(IRegistryConstants.PROP_NO_REGISTRY_CACHE, "true"); //$NON-NLS-1$
      RegistryProperties.setProperty(IRegistryConstants.PROP_NO_LAZY_CACHE_LOADING, "true"); //$NON-NLS-1$
      strategy = new RegistryStrategyOSGI(null, null, masterRegistryKey);
    } else {
      File primaryDir = new File(configuration.getURL().getPath() + '/' + STORAGE_DIR);
      boolean primaryReadOnly = configuration.isReadOnly();

      Location parentLocation = configuration.getParentLocation();
      if (parentLocation != null) {
        File secondaryDir = new File(parentLocation.getURL().getFile() + '/' + IRegistryConstants.RUNTIME_NAME);
        registryLocations = new File[] {primaryDir, secondaryDir};
        readOnlyLocations = new boolean[] {primaryReadOnly, true}; // secondary Eclipse location is always read only
      } else {
        registryLocations = new File[] {primaryDir};
        readOnlyLocations = new boolean[] {primaryReadOnly};
View Full Code Here

  private boolean canUpdate() {
    final AtomicBoolean canUpdate = new AtomicBoolean(true);

    SafeRunnable.run(new LoggingSafeRunnable() {
      public void run() throws Exception {
        Location installLocation = Platform.getInstallLocation();
        if (installLocation != null && installLocation.getURL() != null) {
          File installDirectory = toFile(installLocation.getURL());
          if (!installDirectory.isFile()) {
            File pluginsDir = new File(installDirectory, PLUGINS);
            File featuresDir = new File(installDirectory, FEATURES);
            if (pluginsDir.isDirectory() && featuresDir.isDirectory()) {
              try {
View Full Code Here

  }

  private File getXULRunnerRuntimeDir() {

    /* Retrieve Install Location */
    Location installLocation = Platform.getInstallLocation();
    if (installLocation == null || installLocation.getURL() == null)
      return null;

    /* Retrieve Program Dir as File Object */
    File programDir = toFile(installLocation.getURL());
    if (programDir == null || !programDir.isDirectory() || !programDir.exists())
      return null;

    /* Retrieve the XULRunner Directory */
    File xulrunnerDir = new File(programDir, XULRUNNER_DIR);
View Full Code Here

TOP

Related Classes of org.eclipse.osgi.service.datalocation.Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.