blob: 24ff05e55ebb938575e011da54cb60d2e03ef35f (
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
|
/*******************************************************************************
* Copyright (c) 2017 Obeo.
* 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:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.sirius.tests.unit.api.convert;
import org.eclipse.core.resources.IFile;
import org.eclipse.sirius.ui.tools.api.views.modelexplorerview.resourcelistener.DefaultModelingProjectResourceListener;
/**
* This class overrides DefaultModelingProjectResourceListener and also ignores
* genmodel files (if it is enabled).<BR>
* It is only really enabled when the static method {@link #enable()} is called.
* This avoids to have side effect on others tests.
*
* @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
*/
public class TestModelingProjectResourceListener extends DefaultModelingProjectResourceListener {
private static boolean enabled;
/**
* Default constructor
*/
public TestModelingProjectResourceListener() {
super();
}
public static void enable() {
enabled = true;
}
public static void disable() {
enabled = false;
}
@Override
protected boolean isPotentialSemanticResource(IFile file) {
boolean result = super.isPotentialSemanticResource(file);
if (enabled) {
result = result && !"genmodel".equals(file.getFileExtension());
}
return result;
}
}
|