use of org.eclipse.wst.common.project.facet.core.IFacetedProjectBase in project liferay-ide by liferay.
the class LiferayRuntimePropertyTester method test.
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
boolean retval = false;
try {
EnablementExpressionContext ctx = (EnablementExpressionContext) receiver;
IFacetedProjectBase projectBase = ctx.getFacetedProject();
IRuntime serverRuntime = FacetUtil.getRuntime(projectBase.getPrimaryRuntime());
String runtimeId = serverRuntime.getRuntimeType().getId();
if (runtimeId.startsWith("com.liferay.")) {
retval = true;
}
} catch (Throwable t) {
// don't log error just means test returns false;
}
return retval;
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProjectBase in project liferay-ide by liferay.
the class SDKClasspathContainerInstallOperation method execute.
@Override
public void execute(LibraryProviderOperationConfig config, IProgressMonitor monitor) throws CoreException {
IFacetedProjectBase facetedProject = config.getFacetedProject();
IProject project = facetedProject.getProject();
IJavaProject javaProject = JavaCore.create(project);
IPath containerPath = getClasspathContainerPath();
// IDE-413 check to make sure that the containerPath doesn't already existing.
IClasspathEntry[] entries = javaProject.getRawClasspath();
for (IClasspathEntry entry : entries) {
if (entry.getPath().equals(containerPath)) {
return;
}
}
IAccessRule[] accessRules = {};
IClasspathAttribute[] attributes = { JavaCore.newClasspathAttribute(IClasspathDependencyConstants.CLASSPATH_COMPONENT_NON_DEPENDENCY, StringPool.EMPTY) };
IClasspathEntry newEntry = JavaCore.newContainerEntry(containerPath, accessRules, attributes, false);
IClasspathEntry[] newEntries = new IClasspathEntry[entries.length + 1];
System.arraycopy(entries, 0, newEntries, 0, entries.length);
newEntries[entries.length] = newEntry;
javaProject.setRawClasspath(newEntries, monitor);
}
Aggregations