java.util.prefs.AbstractPreferences#org.osgi.framework.Bundle源码实例Demo

下面列出了java.util.prefs.AbstractPreferences#org.osgi.framework.Bundle 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: knopflerfish.org   文件: KFLegacyMetaTypeParser.java
/**
 * Load a MetaTypeProvider from an XML file.
 */
public static MTP loadMTPFromURL(Bundle bundle, URL url) throws IOException {
  InputStream in = null;

  try {
    in = url.openStream();
    final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
    final IXMLReader reader = new StdXMLReader(in);
    parser.setReader(reader);
    final XMLElement el = (XMLElement) parser.parse();
    return loadMTP(bundle, url, el);
  } catch (final Throwable t) {
    throw (IOException) new IOException("Failed to load " + url + " " + t)
        .initCause(t);
  } finally {
    try {
      in.close();
    } catch (final Exception ignored) {
    }
  }

}
 
源代码2 项目: knopflerfish.org   文件: XMLParserActivator.java
/**
 * Creates a new XML Parser Factory object.
 * 
 * <p>
 * A unique XML Parser Factory object is returned for each call to this
 * method.
 * 
 * <p>
 * The returned XML Parser Factory object will be configured for validating
 * and namespace aware support as specified in the service properties of the
 * specified ServiceRegistration object.
 * 
 * This method can be overridden to configure additional features in the
 * returned XML Parser Factory object.
 * 
 * @param bundle The bundle using the service.
 * @param registration The <code>ServiceRegistration</code> object for the
 *        service.
 * @return A new, configured XML Parser Factory object or null if a
 *         configuration error was encountered
 */
public Object getService(Bundle bundle, ServiceRegistration registration) {
	ServiceReference sref = registration.getReference();
	String parserFactoryClassName = (String) sref
			.getProperty(FACTORYNAMEKEY);
	// need to set factory properties
	Object factory = getFactory(parserFactoryClassName);
	if (factory instanceof SAXParserFactory) {
		((SAXParserFactory) factory).setValidating(((Boolean) sref
				.getProperty(PARSER_VALIDATING)).booleanValue());
		((SAXParserFactory) factory).setNamespaceAware(((Boolean) sref
				.getProperty(PARSER_NAMESPACEAWARE)).booleanValue());
	}
	else {
		if (factory instanceof DocumentBuilderFactory) {
			((DocumentBuilderFactory) factory)
					.setValidating(((Boolean) sref
							.getProperty(PARSER_VALIDATING)).booleanValue());
			((DocumentBuilderFactory) factory)
					.setNamespaceAware(((Boolean) sref
							.getProperty(PARSER_NAMESPACEAWARE))
							.booleanValue());
		}
	}
	return factory;
}
 
源代码3 项目: knopflerfish.org   文件: BundleHttpContext.java
/**
 * DOCUMENT ME!
 *
 * @param name DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 */
public URL getResource(String name) {
    name = name.substring(1);

    String temp = name.substring(0, name.lastIndexOf("/"));
    String packageName = temp.replace('/', '.');

    for (int i = 0; i < exportedPackages.size(); i++) {
        Bundle b = ((Bundle) exportedPackages.get(i));
        ExportedPackage[] exp = packageAdmin.getExportedPackages(b);

        if (exp != null) {
            for (int j = 0; j < exp.length; j++) {
                if (exp[j].getName().equals(packageName)) {
                    return b.getResource(name);
                }
            }
        }
    }

    return null;
}
 
源代码4 项目: knopflerfish.org   文件: PackageManager.java
/**
 * Get the specified header name from a bundle and parse the value as package
 * names (ignoring all parameters and directives).
 *
 * @return a collection of strings
 */
protected Collection<String> getPackageNames(final Bundle b,
                                             final String headerName)
{
  final Set<String> res = new TreeSet<String>();
  final String v = b.getHeaders().get(headerName);

  if (v != null && v.length() > 0) {
    // Uses the manifest entry parser from the KF-framework
    try {
      for (final HeaderEntry he : org.knopflerfish.framework.Util
          .parseManifestHeader(headerName, v, false, false, false)) {
        res.addAll(he.getKeys());
      }
    } catch (final IllegalArgumentException iae) {
    }
  }
  return res;
}
 
源代码5 项目: knopflerfish.org   文件: PackageManager.java
/**
 * Get the RequiredBundle object for this bundle.
 *
 * @param rbl
 *          List of required bundles as returend by package admin.
 * @param bundle
 *          The bundle to get requiring bundles for.
 * @return The RequiredBundle object for the given bundle or <tt>null</tt> if
 *         the bundle is not required.
 */
public RequiredBundle getRequiredBundle(final RequiredBundle[] rbl,
                                        final Bundle b)
{
  final RequiredBundle rb = requiredBundleMap.get(b);
  if (rb != null) {
    return rb;
  }
  for (int i = 0; rbl != null && i < rbl.length; i++) {
    final Bundle rbb = rbl[i].getBundle();
    if (rbb != null && rbb.getBundleId() == b.getBundleId()) {
      requiredBundleMap.put(b, rbl[i]);
      return rbl[i];
    }
  }
  requiredBundleMap.put(b, null);
  return null;
}
 
源代码6 项目: carbon-kernel   文件: StartupOrderResolver.java
/**
 * Process supported manifest headers (Startup-Component and Provide-Capability).
 * <p>
 * Process Startup-Component headers and create StartupComponent instances.
 * <p>
 * Process Provide-Capability headers to calculate the expected number of required capabilities.
 * <p>
 * Process Provide-Capability headers to get a list of CapabilityProviders and RequiredCapabilityListeners.
 *
 * @param bundleList list of bundles to be scanned for Provide-Capability headers.
 */
private void processManifestHeaders(List<Bundle> bundleList) {
    Map<String, List<ManifestElement>> groupedManifestElements =
            bundleList.stream()
                    // Filter out all the bundles with the Carbon-Component manifest header.
                    .filter(StartupOrderResolverUtils::isCarbonComponentHeaderPresent)
                    // Process filtered manifest headers and get a list of ManifestElements.
                    .map(StartupOrderResolverUtils::getManifestElements)
                    // Merge all the manifest elements lists into a single list.
                    .flatMap(Collection::stream)
                    // Partition all the ManifestElements with the manifest header name.
                    .collect(Collectors.groupingBy(ManifestElement::getValue));

    if (groupedManifestElements.get(STARTUP_LISTENER_COMPONENT) != null) {
        processServiceComponents(groupedManifestElements);
    }

    if (groupedManifestElements.get(OSGI_SERVICE_COMPONENT) != null) {
        processCapabilityProviders(groupedManifestElements.get(OSGI_SERVICE_COMPONENT));
        processOSGiServices(groupedManifestElements.get(OSGI_SERVICE_COMPONENT));
    }

    // You can add logic to handle other types of provide capabilities here.
    // e.g. custom manifest headers, config files etc.
}
 
源代码7 项目: KaiZen-OpenAPI-Editor   文件: Activator.java
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;

    if (Display.getCurrent() != null && PlatformUI.isWorkbenchRunning()) {
        Bundle bundle = Platform.getBundle(PLUGIN_ID);
  
        // for quick outline, add icons from YEdit
        bundle = Platform.getBundle(org.dadacoalition.yedit.Activator.PLUGIN_ID);
        addImage(bundle, Icons.outline_document.name(), "icons/outline_document.gif");
        addImage(bundle, Icons.outline_mapping.name(), "icons/outline_mapping.gif");
        addImage(bundle, Icons.outline_scalar.name(), "icons/outline_scalar.gif");
        addImage(bundle, Icons.outline_mapping_scalar.name(), "icons/outline_mappingscalar.gif");
        addImage(bundle, Icons.outline_sequence.name(), "icons/outline_sequence.png");
    }
}
 
源代码8 项目: bonita-studio   文件: ZoomOutToolEntry.java
private static ImageDescriptor findIconImageDescriptor(String iconPath) {
    String pluginId = "org.eclipse.gmf.runtime.diagram.ui.providers";
    Bundle bundle = Platform.getBundle(pluginId);
    try
    {
        if (iconPath != null) {
            URL fullPathString = FileLocator.find(bundle, new Path(iconPath), null);
            fullPathString = fullPathString != null ? fullPathString : new URL(iconPath);
            if (fullPathString != null) {
                return ImageDescriptor.createFromURL(fullPathString);
            }
        }
    }
    catch (MalformedURLException e)
    {
        Trace.catching(DiagramUIPlugin.getInstance(),
            DiagramUIDebugOptions.EXCEPTIONS_CATCHING,
            DefaultPaletteProvider.class, e.getLocalizedMessage(), e); 
        Log.error(DiagramUIPlugin.getInstance(),
            DiagramUIStatusCodes.RESOURCE_FAILURE, e.getMessage(), e);
    }
    
    return null;
}
 
源代码9 项目: smarthome   文件: BindingInfoXmlProvider.java
public BindingInfoXmlProvider(Bundle bundle, XmlBindingInfoProvider bindingInfoProvider,
        AbstractXmlConfigDescriptionProvider configDescriptionProvider) throws IllegalArgumentException {
    if (bundle == null) {
        throw new IllegalArgumentException("The Bundle must not be null!");
    }

    if (bindingInfoProvider == null) {
        throw new IllegalArgumentException("The XmlBindingInfoProvider must not be null!");
    }

    if (configDescriptionProvider == null) {
        throw new IllegalArgumentException("The XmlConfigDescriptionProvider must not be null!");
    }

    this.bundle = bundle;

    this.bindingInfoProvider = bindingInfoProvider;
    this.configDescriptionProvider = configDescriptionProvider;
}
 
源代码10 项目: concierge   文件: BundleStartLevelResource.java
@Override
public Representation put(final Representation value,
		final Variant variant) {
	try {
		final Bundle bundle = getBundleFromKeys(RestService.BUNDLE_ID_KEY);
		if (bundle == null) {
			return ERROR(Status.CLIENT_ERROR_NOT_FOUND);
		}
		final BundleStartLevelPojo sl = fromRepresentation(value, value.getMediaType());
		final BundleStartLevel bsl = bundle.adapt(BundleStartLevel.class);
		bsl.setStartLevel(sl.getStartLevel());

		return getRepresentation(new BundleStartLevelPojo(bsl), variant);
	} catch (final Exception e) {
		return ERROR(e, variant);
	}
}
 
源代码11 项目: xds-ide   文件: XdsResourcesUpdater.java
/**
 * @param installedUpdatesRegistry 
 * @param dirWithUpdatesPath directory where updates are
 * @param updateDirSubdirWithResource relative path where update is
 * @param newResourceName update resource name
 * @throws IOException
 * @throws FileNotFoundException
 * @return true if the resource was updated
 */
private boolean updateResource(InstalledUpdatesRegistry installedUpdatesRegistry, Bundle resourcesBundle, String dirWithUpdatesPath, Update update) {
	String newResourceRelativePath = update.newResourceLocation;
	String existingResourceRelativePath = update.existingResourceLocation;
	String xmlSchemaRelativePath = update.xmlSchemaLocation;
	Version version = update.version;
	File resourceFolderFile = null;
	try {
		resourceFolderFile = FileLocator.getBundleFile(resourcesBundle);
	} catch (IOException e) {
		LogHelper.logError(e);
		return false;
	}
	
	return updateResource(installedUpdatesRegistry, dirWithUpdatesPath,
			newResourceRelativePath, resourceFolderFile,
			existingResourceRelativePath, xmlSchemaRelativePath, version, true);
}
 
源代码12 项目: vespa   文件: Deconstructor.java
@Override
public void deconstruct(Collection<Object> components, Collection<Bundle> bundles) {
    Collection<AbstractComponent> destructibleComponents = new ArrayList<>();
    for (var component : components) {
        if (component instanceof AbstractComponent) {
            AbstractComponent abstractComponent = (AbstractComponent) component;
            if (abstractComponent.isDeconstructable()) {
                destructibleComponents.add(abstractComponent);
            }
        } else if (component instanceof Provider) {
            // TODO Providers should most likely be deconstructed similarly to AbstractComponent
            log.log(FINE, () -> "Starting deconstruction of provider " + component);
            ((Provider<?>) component).deconstruct();
            log.log(FINE, () -> "Finished deconstruction of provider " + component);
        } else if (component instanceof SharedResource) {
            log.log(FINE, () -> "Releasing container reference to resource " + component);
            // No need to delay release, as jdisc does ref-counting
            ((SharedResource) component).release();
        }
    }
    if (! destructibleComponents.isEmpty() || ! bundles.isEmpty())
        executor.schedule(new DestructComponentTask(destructibleComponents, bundles),
                          delay.getSeconds(), TimeUnit.SECONDS);
}
 
源代码13 项目: openhab-core   文件: SyntheticBundleInstaller.java
private static List<String> collectFilesFrom(Bundle bundle, String bundlePath, String bundleName,
        Set<String> extensionsToInclude) throws Exception {
    List<String> result = new ArrayList<>();
    URL url = getBaseURL(bundle, bundleName);
    if (url != null) {
        String path = url.getPath();
        URI baseURI = url.toURI();

        List<URL> list = collectEntries(bundle, path, extensionsToInclude);
        for (URL entryURL : list) {
            String fileEntry = convertToFileEntry(baseURI, entryURL);
            result.add(fileEntry);
        }
    }
    return result;
}
 
源代码14 项目: developer-studio   文件: ResourceManager.java
/**
 * Returns an {@link URL} based on a {@link Bundle} and resource entry path.
 */
private static URL getPluginImageURL(String symbolicName, String path) {
	// try runtime plugins
	{
		Bundle bundle = Platform.getBundle(symbolicName);
		if (bundle != null) {
			return bundle.getEntry(path);
		}
	}
	// try design time provider
	if (m_designTimePluginResourceProvider != null) {
		return m_designTimePluginResourceProvider.getEntry(symbolicName, path);
	}
	// no such resource
	return null;
}
 
源代码15 项目: knopflerfish.org   文件: Spin.java
public static Color getColor(int state) {
  switch(state) {
  case Bundle.INSTALLED:
    return installedColor;
  case Bundle.ACTIVE:
    return activeColor;
  case Bundle.RESOLVED:
    return resolvedColor;
  case Bundle.UNINSTALLED:
    return uninstalledColor;
  case Bundle.STARTING:
    return startingColor;
  case Bundle.STOPPING:
    return stoppingColor;
  }

  return Color.black;
}
 
源代码16 项目: knopflerfish.org   文件: PackageAdminImpl.java
public Bundle[] getBundles(String symbolicName, String versionRange) {
  final VersionRange vr = versionRange != null ? new VersionRange(versionRange.trim()) :
      null;
  final List<BundleGeneration> bgs = fwCtx.bundles.getBundles(symbolicName, vr);
  final int size = bgs.size();
  if (size > 0) {
    final Bundle[] res = new Bundle[size];
    final Iterator<BundleGeneration> i = bgs.iterator();
    for (int pos = 0; pos < size;) {
      res[pos++] = i.next().bundle;
    }
    return res;
  } else {
    return null;
  }
}
 
源代码17 项目: knopflerfish.org   文件: LargeIconsDisplayer.java
public void addBundle0(final Bundle[] bundles) {
  if (bundles != null) {
    for (final Bundle bundle : bundles) {
      if(null == getBundleComponent(bundle)) {
        final JLabel c = createJLabelForBundle(bundle);

        c.setToolTipText(Util.bundleInfo(bundle));
        c.setVerticalTextPosition(SwingConstants.BOTTOM);
        c.setHorizontalTextPosition(SwingConstants.CENTER);

        c.setPreferredSize(new Dimension(96, 64));
        c.setBorder(null);
        c.setFont(getFont());

        bundleMap.put(new Long(bundle.getBundleId()), c);

        updateBundleComp(bundle);
      }
    }
  }
  rebuildPanel();
}
 
public RelationalActivator() {
    instance = this;
    //Make sure the JNDI plugin is active
    AccessController.doPrivileged( new PrivilegedAction<Void>() {
        public Void run() {
            try {
                Bundle bundle = Platform.getBundle( "com.ibm.pvc.jndi.provider.java"); // $NON-NLS-1$
                if(bundle!=null) { // Empty during the unit tests
                    bundle.start();
                }
            } catch (BundleException ex) {
                if(RelationalLogger.RELATIONAL.isErrorEnabled()) {
                    RelationalLogger.RELATIONAL.errorp(this, "RelationalActivator", ex, "Exception occured activating the JNDI plugin"); // $NON-NLS-1$ $NLE-RelationalActivator.ExceptionoccuredactivatingtheJNDI-2$
                }
            }
            return null;
        }
    });
}
 
源代码19 项目: bonita-studio   文件: SectionDescriptor.java
/**
 * Handle the section error when an issue is found loading from the
 * configuration element.
 *
 * @param exception
 *            an optional CoreException
 */
private void handleSectionError(CoreException exception) {
	String pluginId = getConfigurationElement().getDeclaringExtension()
			.getContributor().getName();
	String message = TabbedPropertyMessages.SectionDescriptor_Section_error;
	if (exception == null) {
		message = MessageFormat.format(TabbedPropertyMessages.SectionDescriptor_Section_error, pluginId);
	} else {
		message = MessageFormat.format(TabbedPropertyMessages.SectionDescriptor_class_not_found_error, pluginId);
	}
	IStatus status = new Status(IStatus.ERROR, pluginId,
			TabbedPropertyViewStatusCodes.SECTION_ERROR, message, exception);
	Bundle bundle = FrameworkUtil.getBundle(SectionDescriptor.class);
	Platform.getLog(bundle).log(status);
}
 
/**
 * Get the gwt zip path.
 */
private static String getGwtTestSdkPath() {
  Bundle bundle = GwtTestingPlugin.getDefault().getBundle();

  // Maven compile uses a jar, and is in target
  String basePath = Paths.get("").toAbsolutePath().toString();
  if (basePath.endsWith("target")) {
    basePath = basePath.replace("target/", "");
  }

  String version = TestEnvironmentUtil.getMavenPropertyVersionFor("gwt.version");
  String pathToZip = basePath + "/../../resources/target/resources/gwt-" + version + ".zip";
  String gwtHomePath = TestEnvironmentUtil.installTestSdk(bundle, pathToZip).toOSString();
  return gwtHomePath;
}
 
源代码21 项目: brooklyn-server   文件: Osgis.java
/**
 * Installs a bundle from the given URL, doing a check if already installed, and
 * using the {@link ResourceUtils} loader for this project (brooklyn core)
 */
public static Bundle install(Framework framework, String url) throws BundleException {
    boolean isLocal = isLocalUrl(url);
    String localUrl = url;
    if (!isLocal) {
        localUrl = cacheFile(url);
    }

    try {
        Bundle bundle = getInstalledBundle(framework, localUrl);
        if (bundle != null) {
            return bundle;
        }

        // use our URL resolution so we get classpath items
        LOG.debug("Installing bundle into {} from url: {}", framework, url);
        InputStream stream = getUrlStream(localUrl);
        Bundle installedBundle = framework.getBundleContext().installBundle(url, stream);
        
        return installedBundle;
    } finally {
        if (!isLocal) {
            try {
                new File(new URI(localUrl)).delete();
            } catch (URISyntaxException e) {
                throw Exceptions.propagate(e);
            }
        }
    }
}
 
源代码22 项目: depan   文件: PluginClassLoader.java
/**
 * Try to load classes from the known list of bundles, in order.
 * If all of those fail, delegate to the super class.
 */
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
  for (Bundle bundle: pluginBundles) {
    // try to load the class one plugin after the other. stop on the first
    // plugin providing the corresponding class.
    try {
      return bundle.loadClass(name);
    } catch (ClassNotFoundException e) {
    }
  }
  return super.loadClass(name);
}
 
源代码23 项目: AtlasForAndroid   文件: Package.java
public Bundle[] getImportingBundles() {
    if (this.importingBundles == null) {
        return new Bundle[]{this.classloader.bundle};
    }
    Bundle[] bundleArr = new Bundle[(this.importingBundles.size() + 1)];
    this.importingBundles.toArray(bundleArr);
    bundleArr[this.importingBundles.size()] = this.classloader.bundle;
    return bundleArr;
}
 
源代码24 项目: vespa   文件: ClassLoaderOsgiFramework.java
@Override
public List<Bundle> installBundle(String bundleLocation) {
    if (bundleLocation != null && ! bundleLocation.isEmpty()) {
        try {
            URL url = new URL(bundleLocation);
            bundleLocations.add(url);
            bundleList.add(new JarBundleImpl(url));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    return bundles();
}
 
ConfigurationImpl(Bundle callingBundle, String bundleLocation,
                  String factoryPid, String servicePid,
                  ConfigurationDictionary properties)
{
  this.callingBundle = callingBundle;
  this.factoryPid = factoryPid;
  this.servicePid = servicePid;

  if (properties == null) {
    this.properties = new ConfigurationDictionary();
  } else {
    this.properties = properties;
  }
  putLocation(bundleLocation);
}
 
源代码26 项目: EasyShell   文件: Activator.java
protected void addImageToRegistry(ImageRegistry registry, Bundle bundle, String imagePath, String image_id) {
    IPath path = new Path(imagePath);
    URL url = FileLocator.find(bundle, path, null);
    ImageDescriptor desc = ImageDescriptor.createFromURL(url);
    registry.put(image_id, desc);
    imageNames.add(image_id);
}
 
源代码27 项目: brooklyn-server   文件: OsgiTestBase.java
protected Bundle install(String url) {
    try {
        return Osgis.install(framework, url);
    } catch (Exception e) {
        throw new IllegalStateException("test resources not available; may be an IDE issue, so try a mvn rebuild of this project", e);
    }
}
 
源代码28 项目: tracecompass   文件: XmlUtils.java
private static synchronized @NonNull List<@NonNull URL> getUrlsFromConfiguration(String extensionName, String elementName, String attribName) {
    /* Get the XSD files advertised through the extension point */
    IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionName);
    List<@NonNull URL> list = new ArrayList<>();
    for (IConfigurationElement element : elements) {
        if (element.getName().equals(elementName)) {
            final String filename = element.getAttribute(attribName);
            final String name = element.getContributor().getName();
            // Run this in a safe runner in case there is an exception
            // (IOException, FileNotFoundException, NPE, etc).
            // This makes sure other extensions are not prevented from
            // working if one is faulty.
            SafeRunner.run(new ISafeRunnable() {

                @Override
                public void run() throws IOException {
                    if (name != null) {
                        Bundle bundle = Platform.getBundle(name);
                        if (bundle != null) {
                            URL xmlUrl = bundle.getResource(filename);
                            if (xmlUrl == null) {
                                throw new FileNotFoundException(filename);
                            }
                            URL locatedURL = FileLocator.toFileURL(xmlUrl);
                            list.add(NonNullUtils.checkNotNull(locatedURL));
                        }
                    }
                }

                @Override
                public void handleException(Throwable exception) {
                    // Handled sufficiently in SafeRunner
                }
            });
        }
    }
    return list;
}
 
源代码29 项目: gwt-eclipse-plugin   文件: GdtPreferences.java
/**
 * Attempts to register the SDK from a bundle.
 */
private static void registerBundleSdk(Bundle bundle) throws CoreException {
  try {
    IPath propPath = new Path(SDK_REGISTRANT_PROPERTY_FILE);
    URL propUrl = FileLocator.find(bundle, propPath, (Map<String, String>) null);
    if (propUrl != null) {
      InputStream instream = propUrl.openStream();
      Properties props = new Properties();
      props.load(instream);
      String sdkType = props.getProperty(SDK_BUNDLE_MARKER_PROPERTY);
      String sdkPrefix = props.getProperty(SDK_PATH_PREFIX_PROPERTY);
      if (sdkType != null && sdkPrefix != null) {
        IPath sdkPrefixPath = new Path(sdkPrefix);
        URL sdkPathUrl = FileLocator.find(bundle, sdkPrefixPath, (Map<String, String>) null);
        if (sdkPathUrl == null) {
          // Automatic SDK registration failed. This is expected in dev mode.
          CorePluginLog.logWarning("Failed to register SDK: " + sdkPrefix);
          return;
        }
        // resolve needed to switch from bundleentry to file url
        sdkPathUrl = FileLocator.resolve(sdkPathUrl);
        if (sdkPathUrl != null) {
          if ("file".equals(sdkPathUrl.getProtocol())) {
            GWTSdkRegistrant.registerSdk(sdkPathUrl, sdkType);
          }
        }
      }
    }
  } catch (IOException e) {
    throw new CoreException(new Status(IStatus.WARNING, GdtPlugin.PLUGIN_ID, e.getLocalizedMessage(), e));
  }
}
 
源代码30 项目: ice   文件: PlayAction.java
/**
 * <p>
 * This function stops the timer and switches the button from a pause button
 * to a play button.
 * </p>
 */
public void stop() {
	// Stop the timer
	timer.stop();
	// Change the "hover" text
	this.setText("Play");
	// Change the button appearance
	Bundle bundle = FrameworkUtil.getBundle(getClass());
	Path imagePath = new Path(
			"icons" + System.getProperty("file.separator") + "play.gif");
	URL imageURL = FileLocator.find(bundle, imagePath, null);
	ImageDescriptor imageDescriptor = ImageDescriptor
			.createFromURL(imageURL);
	this.setImageDescriptor(imageDescriptor);
}