blob: d0b0f30ba0e03c455aed5b71cb40b0f494ed92a6 [file] [log] [blame]
/**
* Copyright (c)2020 CEA LIST, Committer Name, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
*
*/
package org.eclipse.papyrus.pdp4eng.req.ui.view;
import java.util.ArrayList;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
/** this class is used to display as a menu if the stereotype shall filtered **/
public class RequirementAction extends Action {
private Class<?> stereotype;
ArrayList<Class<?>> steretotypeFilter;
public RequirementAction(Class<?> stereotype, ArrayList<Class<?>> steretotypeFilter) {
super(stereotype.getSimpleName(), IAction.AS_CHECK_BOX);
this.setChecked(true);
this.stereotype = stereotype;
this.steretotypeFilter = steretotypeFilter;
}
@Override
public void run() {
if (this.isChecked()) {
if (!steretotypeFilter.contains(stereotype)) {
steretotypeFilter.add(stereotype);
}
} else {
steretotypeFilter.remove(stereotype);
}
System.out.println(steretotypeFilter);
}
}