|
Lines 30-35
Link Here
|
| 30 |
import org.eclipse.core.runtime.Status; |
30 |
import org.eclipse.core.runtime.Status; |
| 31 |
import org.eclipse.core.runtime.content.IContentType; |
31 |
import org.eclipse.core.runtime.content.IContentType; |
| 32 |
import org.eclipse.jface.preference.IPreferenceStore; |
32 |
import org.eclipse.jface.preference.IPreferenceStore; |
|
|
33 |
import org.eclipse.wst.sse.ui.contentassist.AutoActivationDelegate; |
| 33 |
import org.eclipse.wst.sse.ui.internal.Logger; |
34 |
import org.eclipse.wst.sse.ui.internal.Logger; |
| 34 |
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin; |
35 |
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin; |
| 35 |
|
36 |
|
|
Lines 55-60
Link Here
|
| 55 |
|
56 |
|
| 56 |
/** The extension schema name for element ID attributes */ |
57 |
/** The extension schema name for element ID attributes */ |
| 57 |
private static final String ATTR_ID= "id"; //$NON-NLS-1$ |
58 |
private static final String ATTR_ID= "id"; //$NON-NLS-1$ |
|
|
59 |
|
| 60 |
/** The extension schema name for the partition's auto-activation class */ |
| 61 |
private static final String ATTR_AUTO_ACTIVATION_CLASS = "autoActivationClass"; //$NON-NLS-1$ |
| 58 |
|
62 |
|
| 59 |
/** preference key to keep track of the last known number of content assist computers */ |
63 |
/** preference key to keep track of the last known number of content assist computers */ |
| 60 |
private static final String NUM_COMPUTERS_PREF_KEY = "content_assist_number_of_computers"; //$NON-NLS-1$ |
64 |
private static final String NUM_COMPUTERS_PREF_KEY = "content_assist_number_of_computers"; //$NON-NLS-1$ |
|
Lines 235-240
Link Here
|
| 235 |
context.putDescriptor(partitionTypeID, descriptor); |
239 |
context.putDescriptor(partitionTypeID, descriptor); |
| 236 |
} |
240 |
} |
| 237 |
|
241 |
|
|
|
242 |
private Map fAutoActivators = new HashMap(); |
| 243 |
|
| 244 |
static class Activator { |
| 245 |
IConfigurationElement fElement; |
| 246 |
|
| 247 |
public Activator(IConfigurationElement element) { |
| 248 |
fElement = element; |
| 249 |
} |
| 250 |
|
| 251 |
AutoActivationDelegate createAutoActivation() { |
| 252 |
AutoActivationDelegate activation = null; |
| 253 |
if (fElement != null) { |
| 254 |
try { |
| 255 |
activation = (AutoActivationDelegate) fElement.createExecutableExtension(ATTR_AUTO_ACTIVATION_CLASS); |
| 256 |
} catch (CoreException e) { |
| 257 |
} |
| 258 |
} |
| 259 |
return activation; |
| 260 |
} |
| 261 |
|
| 262 |
} |
| 263 |
|
| 264 |
void putAutoActivator(String contentTypeID, String partitionTypeID, IConfigurationElement element) { |
| 265 |
String autoActivationClass = element.getAttribute(ATTR_AUTO_ACTIVATION_CLASS); |
| 266 |
if (autoActivationClass == null) |
| 267 |
return; |
| 268 |
|
| 269 |
Map partitionMap = (Map) fAutoActivators.get(contentTypeID); |
| 270 |
if (partitionMap == null) { |
| 271 |
partitionMap = new HashMap(); |
| 272 |
fAutoActivators.put(contentTypeID, partitionMap); |
| 273 |
} |
| 274 |
partitionMap.put(partitionTypeID, new Activator(element)); |
| 275 |
} |
| 276 |
|
| 277 |
public AutoActivationDelegate getActivator(String contentTypeID, String partitionTypeID) { |
| 278 |
Map partitionMap = (Map) fAutoActivators.get(contentTypeID); |
| 279 |
if (partitionMap != null) { |
| 280 |
Activator activator = (Activator) partitionMap.get(partitionTypeID); |
| 281 |
if (activator != null) { |
| 282 |
return activator.createAutoActivation(); |
| 283 |
} |
| 284 |
} |
| 285 |
return null; |
| 286 |
} |
| 287 |
|
| 238 |
/** |
288 |
/** |
| 239 |
* @param contentTypeID get only descriptors associated with this content type |
289 |
* @param contentTypeID get only descriptors associated with this content type |
| 240 |
* @param partitionTypeID get only descriptors associated with this partition type as well |
290 |
* @param partitionTypeID get only descriptors associated with this partition type as well |