public static boolean isMylynInstalled() { CompletionProposalComputerRegistry reg = CompletionProposalComputerRegistry.getDefault(); for (CompletionProposalCategory cat : reg.getProposalCategories()) { if (cat.getId().equals(MYLYN_ALL_CATEGORY)) { return true; } } return false; }
/** * Returns the default computer registry. * <p> * TODO keep this or add some other singleton, e.g. JavaPlugin? * </p> * * @return the singleton instance */ public static synchronized CompletionProposalComputerRegistry getDefault() { if (fgSingleton == null) { fgSingleton= new CompletionProposalComputerRegistry(); } return fgSingleton; }
/** * Returns the list of proposal categories contributed to the * <code>javaCompletionProposalComputer</code> extension point. * <p> * <p> * The returned list is read-only and is sorted in the order that the extensions were read in. * There are no duplicate elements in the returned list. The returned list may change if * plug-ins are loaded or unloaded while the application is running. * </p> * * @return list of proposal categories contributed to the * <code>javaCompletionProposalComputer</code> extension point (element type: * {@link CompletionProposalCategory}) */ public List<CompletionProposalCategory> getProposalCategories() { ensureExtensionPointRead(); return fPublicCategories; }
/** * Ensures that the extensions are read and stored in * <code>fDescriptorsByPartition</code>. */ private void ensureExtensionPointRead() { boolean reload; synchronized (this) { reload= !fLoaded; fLoaded= true; } if (reload) { reload(); updateUninstalledComputerCount(); } }
/** * Sets the completion proposal categories which are excluded from the * default proposal list and reloads the registry. * * @param categories the array with the IDs of the excluded categories * @see #CODEASSIST_EXCLUDED_CATEGORIES * @since 3.4 */ public static void setExcludedCompletionProposalCategories(String[] categories) { Assert.isLegal(categories != null); StringBuilder buf= new StringBuilder(50 * categories.length); for (int i= 0; i < categories.length; i++) { buf.append(categories[i]); buf.append('\0'); } getPreferenceStore().setValue(CODEASSIST_EXCLUDED_CATEGORIES, buf.toString()); CompletionProposalComputerRegistry.getDefault().reload(); }
public PreferenceModel(CompletionProposalComputerRegistry registry) { List<CompletionProposalCategory> categories= registry.getProposalCategories(); fElements= new ArrayList<>(); for (Iterator<CompletionProposalCategory> it= categories.iterator(); it.hasNext();) { CompletionProposalCategory category= it.next(); if (category.hasComputers()) { fElements.add(new ModelElement(category, this)); } } Collections.sort(fElements, fCategoryComparator); elements= Collections.unmodifiableList(fElements); }
/** * Returns <code>true</code> if the category contains any computers, <code>false</code> * otherwise. * * @return <code>true</code> if the category contains any computers, <code>false</code> * otherwise */ public boolean hasComputers() { List<CompletionProposalComputerDescriptor> descriptors= fRegistry.getProposalComputerDescriptors(); for (CompletionProposalComputerDescriptor desc : descriptors) { if (desc.getCategory() == this) return true; } return false; }
private void stopMeter(final PerformanceStats stats, String operation) { if (MEASURE_PERFORMANCE) { stats.endRun(); if (stats.isFailure()) { IStatus status= createPerformanceStatus(operation); fRegistry.informUser(this, status); return; } } if (fIsReportingDelay) { long current= System.currentTimeMillis(); if (current - fStart > MAX_DELAY) { IStatus status= createPerformanceStatus(operation); fRegistry.informUser(this, status); } } }
CompletionProposalCategory category= descriptor.getCategory(); IContributor culprit= descriptor.getContributor(); Set<String> affectedPlugins= getAffectedContributors(category, culprit); avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint, new Object[] {culpritName, category.getDisplayName()}); else avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning, new Object[] {culpritName, category.getDisplayName(), toString(affectedPlugins)});
List<CompletionProposalComputerDescriptor> all= new ArrayList<>(); List<CompletionProposalCategory> categories= getCategories(elements); for (Iterator<IConfigurationElement> iter= elements.iterator(); iter.hasNext();) { IConfigurationElement element= iter.next(); String message= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_invalid_message, args); IStatus status= new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, message, x); informUser(status); } catch (CoreException x) { informUser(x.getStatus());
CodeAssistAdvancedConfigurationBlock(IStatusChangeListener statusListener, IWorkbenchPreferenceContainer container) { super(statusListener, null, getAllKeys(), container); fModel= new PreferenceModel(CompletionProposalComputerRegistry.getDefault()); }
String message= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_invalid_message, args); IStatus status= new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, message, x); informUser(status); } catch (CoreException x) { informUser(x.getStatus()); preventDuplicateCategories(store, disabled, allProposals, typeProposals, allButTypeProposals); return categories;
/** * Ensures that the extensions are read and stored in * <code>fDescriptorsByPartition</code>. */ private void ensureExtensionPointRead() { boolean reload; synchronized (this) { reload= !fLoaded; fLoaded= true; } if (reload) reload(); }
public PreferenceModel(CompletionProposalComputerRegistry registry) { List categories= registry.getProposalCategories(); fElements= new ArrayList(); for (Iterator it= categories.iterator(); it.hasNext();) { CompletionProposalCategory category= (CompletionProposalCategory) it.next(); if (category.hasComputers()) { fElements.add(new ModelElement(category, this)); } } Collections.sort(fElements, fCategoryComparator); elements= Collections.unmodifiableList(fElements); }
/** * Sets the completion proposal categories which are excluded from the * default proposal list and reloads the registry. * * @param categories the array with the IDs of the excluded categories * @see #CODEASSIST_EXCLUDED_CATEGORIES * @since 3.4 */ public static void setExcludedCompletionProposalCategories(String[] categories) { Assert.isLegal(categories != null); StringBuffer buf= new StringBuffer(50 * categories.length); for (int i= 0; i < categories.length; i++) { buf.append(categories[i]); buf.append('\0'); } getPreferenceStore().setValue(CODEASSIST_EXCLUDED_CATEGORIES, buf.toString()); CompletionProposalComputerRegistry.getDefault().reload(); }
/** * Returns <code>true</code> if the category contains any computers, <code>false</code> * otherwise. * * @return <code>true</code> if the category contains any computers, <code>false</code> * otherwise */ public boolean hasComputers() { List<CompletionProposalComputerDescriptor> descriptors= fRegistry.getProposalComputerDescriptors(); for (CompletionProposalComputerDescriptor desc : descriptors) { if (desc.getCategory() == this) return true; } return false; }
private void stopMeter(final PerformanceStats stats, String operation) { if (MEASURE_PERFORMANCE) { stats.endRun(); if (stats.isFailure()) { IStatus status= createPerformanceStatus(operation); fRegistry.informUser(this, status); return; } } if (fIsReportingDelay) { long current= System.currentTimeMillis(); if (current - fStart > MAX_DELAY) { IStatus status= createPerformanceStatus(operation); fRegistry.informUser(this, status); } } }
CompletionProposalCategory category= descriptor.getCategory(); IContributor culprit= descriptor.getContributor(); Set affectedPlugins= getAffectedContributors(category, culprit); avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint, new Object[] {culpritName, category.getDisplayName()}); else avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning, new Object[] {culpritName, category.getDisplayName(), toString(affectedPlugins)});
List<CompletionProposalComputerDescriptor> all= new ArrayList<>(); List<CompletionProposalCategory> categories= getCategories(elements); for (Iterator<IConfigurationElement> iter= elements.iterator(); iter.hasNext();) { IConfigurationElement element= iter.next(); String message= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_invalid_message, args); IStatus status= new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, message, x); informUser(status); } catch (CoreException x) { informUser(x.getStatus());
CodeAssistAdvancedConfigurationBlock(IStatusChangeListener statusListener, IWorkbenchPreferenceContainer container) { super(statusListener, null, getAllKeys(), container); fModel= new PreferenceModel(CompletionProposalComputerRegistry.getDefault()); }