Search in sources :

Example 1 with IActivityManager

use of org.eclipse.ui.activities.IActivityManager in project dbeaver by dbeaver.

the class DataSourceProviderRegistry method getEnabledDataSourceProviders.

public List<DataSourceProviderDescriptor> getEnabledDataSourceProviders() {
    IActivityManager activityManager = PlatformUI.getWorkbench().getActivitySupport().getActivityManager();
    List<DataSourceProviderDescriptor> enabled = new ArrayList<>(dataSourceProviders);
    enabled.removeIf(p -> !activityManager.getIdentifier(p.getFullIdentifier()).isEnabled());
    return enabled;
}
Also used : IActivityManager(org.eclipse.ui.activities.IActivityManager)

Example 2 with IActivityManager

use of org.eclipse.ui.activities.IActivityManager in project titan.EclipsePlug-ins by eclipse.

the class Activator method switchActivity.

/**
 * Activates or deactivates the given activity
 * @param activityId The activity
 * @param enable <code>true</code> if the given activity should be enabled, <code>false</code> otherwise
 * @return <code>true</code> if an activity change is performed, <code>false</code> otherwise
 */
@SuppressWarnings("unchecked")
public static final boolean switchActivity(final String activityId, final boolean enable) {
    final IWorkbenchActivitySupport as = PlatformUI.getWorkbench().getActivitySupport();
    final IActivityManager am = as.getActivityManager();
    @SuppressWarnings({ "rawtypes" }) final Set enabledActivities = new HashSet(am.getEnabledActivityIds());
    final boolean activityChange = enable ? enabledActivities.add(activityId) : enabledActivities.remove(activityId);
    if (!activityChange) {
        return false;
    }
    as.setEnabledActivityIds(enabledActivities);
    return true;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) IWorkbenchActivitySupport(org.eclipse.ui.activities.IWorkbenchActivitySupport) IActivityManager(org.eclipse.ui.activities.IActivityManager) HashSet(java.util.HashSet)

Aggregations

IActivityManager (org.eclipse.ui.activities.IActivityManager)2 HashSet (java.util.HashSet)1 Set (java.util.Set)1 IWorkbenchActivitySupport (org.eclipse.ui.activities.IWorkbenchActivitySupport)1