blob: 7e78fcb26d47e1871dfc0f982a1135a5f0ab4a35 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009 Zoltan Ujhelyi and Istvan Rath and Daniel Varro.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Istvan Rath - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.visualisation.modelspace.actions.groups;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.viatra2.visualisation.ViatraColoredLabelProvider;
import org.eclipse.viatra2.visualisation.common.extensions.Category;
import org.eclipse.viatra2.visualisation.common.extensions.NamedElement;
import org.eclipse.viatra2.visualisation.common.extensions.internal.ExtensionAccess;
import org.eclipse.viatra2.visualisation.modelspace.actions.SelectLabelProviderAction;
/**
* @author Istvan Rath
*/
public class LabelProviderGroup extends ActionGroup {
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.
* action.IMenuManager)
*/
@Override
public void fillContextMenu(IMenuManager manager) {
IMenuManager menu = new MenuManager("Label providers");
manager.add(menu);
// ExtensionAccess.reInit();
for (Category c : ExtensionAccess.getAllCategories()) {
IMenuManager cateroryMenu = new MenuManager(c.name);
for (NamedElement<ViatraColoredLabelProvider> lp_named : c.labelproviders.values()) {
SelectLabelProviderAction action = new SelectLabelProviderAction(lp_named.name, lp_named.element);
cateroryMenu.add(action);
}
menu.add(cateroryMenu);
}
}
}