1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Obeo.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Obeo - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.emf
.compare
.rcp
.ui
.structuremergeviewer
.actions
;
13 import org
.eclipse
.emf
.compare
.rcp
.ui
.structuremergeviewer
.filters
.IDifferenceFilter
;
14 import org
.eclipse
.emf
.compare
.rcp
.ui
.structuremergeviewer
.filters
.StructureMergeViewerFilter
;
15 import org
.eclipse
.jface
.action
.Action
;
16 import org
.eclipse
.jface
.action
.IAction
;
19 * These will be the actual actions displayed in the filter menu. Their sole purpose is to provide a Predicate
20 * to the structure viewer's filter.
22 * Do note that each distinct {@link FilterAction} in the {@link FilterActionMenu filter menu} is considered
23 * as an "exclude" filter, and that they are OR'ed together (thus, any element must <b>not</b> meet the
24 * selected filters' criteria in order to be displayed).
27 * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
30 public class FilterAction
extends Action
{
32 /** The filter associated with this action. */
33 private IDifferenceFilter filter
;
35 /** The Filter that will be modified by the action. */
36 private StructureMergeViewerFilter structureMergeViewerFilter
;
39 * The "default" constructor for this action.
42 * Will be used as the action's tooltip.
43 * @param structureMergeViewerFilter
44 * The viewer filter that this action will need to update.
46 * The filter associated with this action.
48 public FilterAction(String text
, StructureMergeViewerFilter structureMergeViewerFilter
,
49 IDifferenceFilter filter
) {
50 super(text
, IAction
.AS_CHECK_BOX
);
51 this.structureMergeViewerFilter
= structureMergeViewerFilter
;
58 * @see org.eclipse.jface.action.Action#run()
63 structureMergeViewerFilter
.addFilter(filter
);
65 structureMergeViewerFilter
.removeFilter(filter
);