blob: 3d1f37658bb1f4bd31878a2685e4dc4e26e74745 (
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
57
58
59
60
61
62
63
|
/*******************************************************************************
* Copyright (c) 2010, 2019 IBM Corporation and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jst.jsf.common.internal.componentcore;
import org.eclipse.core.resources.IProject;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
/**
* Wraps parts of the component core in a way that always PDE-free injection
* during test.
*
* @author cbateman
*
*/
public abstract class AbstractVirtualComponentQuery
{
/**
* TODO: reconcile with duplicate. This was taken from JSFAppConfigUtils.
*
* Gets an IVirtualFolder instance which represents the root context's web
* content folder.
*
* @param project
* IProject instance for which to get the folder.
* @return IVirtualFolder instance which represents the root context's web
* content folder.
*/
public abstract IVirtualFolder getWebContentFolder(IProject project);
/**
* The default implementation that makes static calls to ComponentCore.
* @author cbateman
*
*/
public static class DefaultVirtualComponentQuery extends
AbstractVirtualComponentQuery
{
@Override
public IVirtualFolder getWebContentFolder(IProject project)
{
IVirtualFolder folder = null;
IVirtualComponent component = ComponentCore
.createComponent(project);
if (component != null)
{
folder = component.getRootFolder();
}
return folder;
}
}
}
|