Révision 2025
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroContentProvider.java (revision 2025) | ||
|---|---|---|
| 1 |
// Copyright © 2010-2013 ENS de Lyon.
|
|
| 1 |
// Copyright © 2010-2019 ENS de Lyon.
|
|
| 2 | 2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
| 3 | 3 |
// Lyon 2, University of Franche-Comté, University of Nice |
| 4 | 4 |
// Sophia Antipolis, University of Paris 3. |
| ... | ... | |
| 29 | 29 |
|
| 30 | 30 |
import java.io.File; |
| 31 | 31 |
import java.io.FileFilter; |
| 32 |
|
|
| 33 | 32 |
import org.txm.utils.io.IOUtils; |
| 34 | 33 |
|
| 35 |
|
|
| 36 |
// TODO: Auto-generated Javadoc |
|
| 37 | 34 |
/** |
| 38 | 35 |
* The Class FileTreeContentProvider. |
| 39 | 36 |
*/ |
| 40 | 37 |
public class MacroContentProvider extends FileTreeContentProvider {
|
| 41 | 38 |
|
| 39 |
public static final String SUFFIX = "Macro.groovy"; //$NON-NLS-1$ |
|
| 40 |
public static final String BETA = "@STATUS=BETA"; //$NON-NLS-1$ |
|
| 41 |
public static final String ALPHA = "@STATUS=ALPHA"; //$NON-NLS-1$ |
|
| 42 |
|
|
| 42 | 43 |
MacroExplorer macroExplorer = null; |
| 43 | 44 |
|
| 44 | 45 |
public MacroContentProvider(MacroExplorer macroExplorer) {
|
| 45 | 46 |
super(); |
| 46 | 47 |
this.macroExplorer = macroExplorer; |
| 47 | 48 |
} |
| 48 |
|
|
| 49 |
|
|
| 49 | 50 |
/* (non-Javadoc) |
| 50 | 51 |
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) |
| 51 | 52 |
*/ |
| ... | ... | |
| 59 | 60 |
if (file.isDirectory()) return true; |
| 60 | 61 |
|
| 61 | 62 |
if (macroExplorer.isShowAll()) return true; |
| 62 |
if (!file.getName().endsWith("Macro.groovy")) return false; //$NON-NLS-1$
|
|
| 63 |
if (!file.getName().endsWith(SUFFIX)) return false;
|
|
| 63 | 64 |
|
| 64 | 65 |
String line = IOUtils.firstLine(file); |
| 65 | 66 |
if (line != null) {
|
| 66 | 67 |
line = line.trim(); |
| 67 |
return !(line.contains("@STATUS=BETA") || line.contains("@STATUS=ALPHA"));
|
|
| 68 |
return !(line.contains(BETA) || line.contains(ALPHA));
|
|
| 68 | 69 |
} |
| 69 | 70 |
return true; |
| 70 | 71 |
} |
| ... | ... | |
| 76 | 77 |
|
| 77 | 78 |
return kids == null ? new Object[0] : kids; |
| 78 | 79 |
} |
| 79 |
|
|
| 80 | 80 |
} |
Formats disponibles : Unified diff