blob: b3d15656076f97750cfbae39b818e4728727b33d (
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
54
55
56
|
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.tests.ccvs.core.mappings.model;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
public class ModelFile extends ModelObject {
public static final String MODEL_FILE_EXTENSION = "mod";
public static boolean isModFile(IResource resource) {
if (resource instanceof IFile) {
String fileExtension = resource.getFileExtension();
if (fileExtension != null)
return fileExtension.equals(MODEL_FILE_EXTENSION);
}
return false;
}
public static IResource[] getReferencedResources(String projectName,
IStorage storage) {
if (storage == null)
return new IResource[0];
List result = new ArrayList();
return (IResource[]) result.toArray(new IResource[result.size()]);
}
public ModelFile(IFile file) {
super(file);
}
public ModelObject[] getChildren() throws CoreException {
return null;
}
public String getName() {
String name = super.getName();
int index = name.lastIndexOf(".");
return name.substring(0, index);
}
}
|