public AliveDashboardMediator(Shell shell, DashboardPart dashboardPart) { this.dashboardPart = dashboardPart; state = new AliveDashboardState(); locations = new HashMap<String, ActionContainer>(); contributions = new HashMap<DashboardActionDescriptor, IFigure>(); this.shell = shell; IConfigurationElement[] config = Platform.getExtensionRegistry() .getConfigurationElementsFor("net.sf.ictalive.aliveclipse.dashboard.actions"); for (IConfigurationElement ce : config) try { Object o = ce.createExecutableExtension("class"); if (o instanceof PluggedInDashboardAction<?>) { PluggedInDashboardAction<AliveDashboardState> pluggedInAction = (PluggedInDashboardAction<AliveDashboardState>) o; if (pluggedInAction.dashboardActionId() == null) Plugin.getDefault() .getLog() .log( Plugin.createError( "IDashboardAction plugin has null dashboardActionId.", null)); else pluggedInActions.put(pluggedInAction.dashboardActionId(), pluggedInAction); } } catch (CoreException e1) { e1.printStackTrace(); } }
// GMF action plugins, not used by Alive public void removeDashboardAction(DashboardActionDescriptor descriptor) { IFigure actionFigure = contributions.remove(descriptor); if (actionFigure == null) { return; // not contributed; just ignore } ActionContainer location = locations.get(descriptor.getLocation()); if (location == null) { Plugin.getDefault() .getLog() .log( Plugin.createError( "Unknown ALIVE Dashboard location: " + descriptor.getLocation(), null)); //$NON-NLS-1$ return; } location.removeAction(actionFigure, descriptor.isStandard()); }
// GMF action plugins, not used by Alive public void addDashboardAction(DashboardActionDescriptor descriptor) { ActionContainer location = locations.get(descriptor.getLocation()); if (location == null) { Plugin.getDefault() .getLog() .log( Plugin.createError( "Unknown ALIVE Dashboard location: " + descriptor.getLocation(), null)); //$NON-NLS-1$ return; } InternalDashboardAction<AliveDashboardState> action = descriptor.createDashboardAction(); if (action == null) { return; } IFigure actionFigure = createLinkFigure(descriptor.getLabel(), action); location.addAction(actionFigure, descriptor.isStandard()); contributions.put(descriptor, actionFigure); }