blob: 855d9bcfce63801689257d5f5c83cfbba853dd5a [file] [log] [blame]
/*********************************************************************
* Copyright (c) 2005, 2019 SAP SE
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* SAP SE - initial API, implementation and documentation
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
package org.eclipse.graphiti.tb;
import java.util.ArrayList;
import org.eclipse.graphiti.features.IFeature;
import org.eclipse.graphiti.features.context.IContext;
/**
* The Class ContextMenuEntry.
*/
public class ContextMenuEntry extends AbstractContextEntry implements IContextMenuEntry {
private static final IContextMenuEntry[] NO_CONTEXT_MENU_ENTRIES = new IContextMenuEntry[0];
private ArrayList<IContextMenuEntry> children = new ArrayList<IContextMenuEntry>();
private boolean submenu = true;
/**
* Creates a new {@link ContextMenuEntry}.
*
* @param feature
* the feature
* @param context
* the context
*/
public ContextMenuEntry(IFeature feature, IContext context) {
super(feature, context);
}
public IContextMenuEntry[] getChildren() {
IContextMenuEntry[] ret = this.children.toArray(NO_CONTEXT_MENU_ENTRIES);
return ret;
}
public void add(IContextMenuEntry entry) {
this.children.add(entry);
}
public boolean isSubmenu() {
return this.submenu;
}
/**
* Sets the submenu.
*
* @param submenu
* the new submenu
*/
public void setSubmenu(boolean submenu) {
this.submenu = submenu;
}
}