Search in sources :

Example 16 with NLS

use of org.eclipse.osgi.util.NLS in project rt.equinox.framework by eclipse.

the class ServiceFactoryUse method ungetService.

/**
 * Unget a service's service object.
 *
 * <p>
 * Decrements the use count if the service was being used.
 *
 * <p>The following steps are followed to unget the service object:
 * <ol>
 * <li>If the use count is zero, return.
 * <li>The use count is decremented by one.
 * <li>If the use count is non zero, return.
 * <li>The {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)} method
 * is called to release the service object for the context bundle.
 * </ol>
 * @return true if the service was ungotten; otherwise false.
 */
/* @GuardedBy("this") */
@Override
boolean ungetService() {
    assert Thread.holdsLock(this);
    if (!inUse()) {
        return false;
    }
    decrementUse();
    if (inUse()) {
        return true;
    }
    final S service = cachedService;
    cachedService = null;
    if (debug.DEBUG_SERVICES) {
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        Debug.println("ungetService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")");
    }
    factoryUngetService(service);
    return true;
}
Also used : NLS(org.eclipse.osgi.util.NLS)

Example 17 with NLS

use of org.eclipse.osgi.util.NLS in project rt.equinox.framework by eclipse.

the class ServiceFactoryUse method release.

/**
 * Release all uses of the service and reset the use count to zero.
 *
 * <ol>
 * <li>The bundle's use count for this service is set to zero.
 * <li>The {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)} method
 * is called to release the service object for the bundle.
 * </ol>
 */
/* @GuardedBy("this") */
@Override
void release() {
    super.release();
    final S service = cachedService;
    if (service == null) {
        return;
    }
    cachedService = null;
    if (debug.DEBUG_SERVICES) {
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        Debug.println("releaseService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")");
    }
    factoryUngetService(service);
}
Also used : NLS(org.eclipse.osgi.util.NLS)

Aggregations

NLS (org.eclipse.osgi.util.NLS)17 CoreException (org.eclipse.core.runtime.CoreException)10 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)8 IPath (org.eclipse.core.runtime.IPath)7 SWT (org.eclipse.swt.SWT)7 SelectionListener (org.eclipse.swt.events.SelectionListener)7 GridData (org.eclipse.swt.layout.GridData)7 GridLayout (org.eclipse.swt.layout.GridLayout)7 Button (org.eclipse.swt.widgets.Button)7 Composite (org.eclipse.swt.widgets.Composite)7 Label (org.eclipse.swt.widgets.Label)7 Text (org.eclipse.swt.widgets.Text)7 IResource (org.eclipse.core.resources.IResource)6 ResourcesPlugin (org.eclipse.core.resources.ResourcesPlugin)6 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)6 IStatus (org.eclipse.core.runtime.IStatus)5 Path (org.eclipse.core.runtime.Path)5 Status (org.eclipse.core.runtime.Status)5 File (java.io.File)4 IProject (org.eclipse.core.resources.IProject)4