Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: de93a9a9e54bc8eddca1d0ef40253f90983c2dfc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*****************************************************************************
 * Copyright (c) 2009 Atos Origin.
 *
 *    
 * 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:
 *  Alexia Allanic (Atos Origin) alexia.allanic@atosorigin.com - EditorPropertyTester Implementation
 *
 *****************************************************************************/

package org.eclipse.papyrus.layout;

import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.ui.IWorkbenchPart;

/**
 * The Class EditorPropertyTester.
 */
public class EditorPropertyTester extends PropertyTester {

	/**
	 * Instantiates a new editor property tester.
	 */
	public EditorPropertyTester() {
	}

	/**
	 * Test if the current editor is a registered editor.
	 * 
	 * @param receiver
	 *        the receiver
	 * @param property
	 *        the property
	 * @param args
	 *        the args
	 * @param expectedValue
	 *        the expected value
	 * 
	 * @return true, if test
	 */
	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
		if(receiver instanceof IWorkbenchPart && "isCorrectEditor".equals(property)) {
			IWorkbenchPart part = (IWorkbenchPart)receiver;
			return LayoutToolExtensionPointManager.getInstance().getSubEditor(part) != null;
		}
		return false;
	}

}

Back to the top