appDescriptor = new EclipseAppDescriptor(appExtension.getContributor().getName(), appExtension.getUniqueIdentifier(), flags, cardinality, this);
appDescriptor = new EclipseAppDescriptor(Activator.getBundle(appExtension.getContributor()), appExtension.getUniqueIdentifier(), flags, cardinality, this);
	private EclipseAppDescriptor createAppDescriptor(IExtension appExtension) {		synchronized (apps) {			EclipseAppDescriptor appDescriptor = (EclipseAppDescriptor) apps.get(appExtension.getUniqueIdentifier());			if (appDescriptor != null)				return appDescriptor;			// the appDescriptor does not exist for the app ID; create it			IConfigurationElement[] configs = appExtension.getConfigurationElements();			int flags = EclipseAppDescriptor.FLAG_CARD_SINGLETON_GLOGAL | EclipseAppDescriptor.FLAG_VISIBLE | EclipseAppDescriptor.FLAG_TYPE_MAIN_THREAD;			int cardinality = 0;			if (configs.length > 0) {				String sVisible = configs[0].getAttribute(PT_APP_VISIBLE);				if (sVisible != null && !Boolean.valueOf(sVisible).booleanValue())					flags &= ~(EclipseAppDescriptor.FLAG_VISIBLE);				String sThread = configs[0].getAttribute(PT_APP_THREAD);				if (PT_APP_THREAD_ANY.equals(sThread)) {					flags |= EclipseAppDescriptor.FLAG_TYPE_ANY_THREAD;					flags &= ~(EclipseAppDescriptor.FLAG_TYPE_MAIN_THREAD);				}				String sCardinality = configs[0].getAttribute(PT_APP_CARDINALITY);				if (sCardinality != null) {					flags &= ~(EclipseAppDescriptor.FLAG_CARD_SINGLETON_GLOGAL); // clear the global bit					if (PT_APP_CARDINALITY_SINGLETON_SCOPED.equals(sCardinality))						flags |= EclipseAppDescriptor.FLAG_CARD_SINGLETON_SCOPED;					else if (PT_APP_CARDINALITY_UNLIMITED.equals(sCardinality))						flags |= EclipseAppDescriptor.FLAG_CARD_UNLIMITED;					else if (PT_APP_CARDINALITY_SINGLETON_GLOBAL.equals(sCardinality))						flags |= EclipseAppDescriptor.FLAG_CARD_SINGLETON_GLOGAL;					else {						try {							cardinality = Integer.parseInt(sCardinality);							flags |= EclipseAppDescriptor.FLAG_CARD_LIMITED;						} catch (NumberFormatException e) {							// TODO should we log this?							// just fall back to the default							flags |= EclipseAppDescriptor.FLAG_CARD_SINGLETON_GLOGAL;						}					}				}			}			appDescriptor = new EclipseAppDescriptor(appExtension.getContributor().getName(), appExtension.getUniqueIdentifier(), flags, cardinality, this);			// register the appDescriptor as a service			ServiceRegistration sr = (ServiceRegistration) AccessController.doPrivileged(new RegisterService(new String[] {ApplicationDescriptor.class.getName()}, appDescriptor, appDescriptor.getServiceProperties()));			appDescriptor.setServiceRegistration(sr);			// save the app descriptor in the cache			apps.put(appExtension.getUniqueIdentifier(), appDescriptor);			return appDescriptor;		}	}