use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.
the class MavenModuleProjectTests method testThemeProjectPluginDetection.
@Test
public void testThemeProjectPluginDetection() throws Exception {
NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
op.setProjectName("maven-theme-test");
op.setProjectProvider("maven-module");
op.setProjectTemplateName("theme");
op.execute(ProgressMonitorBridge.create(new NullProgressMonitor()));
IProject project = CoreUtil.getProject("maven-theme-test");
assertNotNull(project);
IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
assertNotNull(bundleProject);
}
use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.
the class ProjectUtil method is7xServerDeployableProject.
public static boolean is7xServerDeployableProject(IProject project) {
ILiferayProject liferayProject = LiferayCore.create(project);
if (liferayProject instanceof IBundleProject) {
if (liferayProject instanceof PluginsSDKBundleProject) {
PluginsSDKBundleProject sdkProject = (PluginsSDKBundleProject) liferayProject;
SDK sdk = sdkProject.getSDK();
if (sdk != null) {
IPath location = sdkProject.getProject().getLocation();
String projectType = getLiferayPluginType(location.toPortableString());
Version version = new Version(sdk.getVersion());
Version sdk70 = ILiferayConstants.V700;
if ((CoreUtil.compareVersions(version, sdk70) >= 0) && !ISDKConstants.EXT_PLUGIN_PROJECT_FOLDER.equals(projectType)) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return true;
}
} else {
return false;
}
}
use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.
the class BuildPage method _getBuildStatus.
private boolean _getBuildStatus(IProgressMonitor monitor, IProject project) throws CoreException {
IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
IPath outputBundlepath = null;
try {
outputBundlepath = bundleProject.getOutputBundle(true, monitor);
} catch (Exception e) {
}
if ((outputBundlepath != null) && !outputBundlepath.isEmpty()) {
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
return true;
}
return false;
}
use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.
the class BundleModulelDelegate method members.
@Override
public IModuleResource[] members() throws CoreException {
List<IModuleResource> retval = new ArrayList<>();
IModuleResource[] members = super.members();
IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, getProject());
for (IModuleResource moduleResource : members) {
IPath path = moduleResource.getModuleRelativePath().append(moduleResource.getName());
if (bundleProject.filterResource(path)) {
continue;
}
retval.add(moduleResource);
}
return retval.toArray(new IModuleResource[0]);
}
use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.
the class GradleProjectTests method hasGradleBundlePluginDetection.
/* @Test
public void gradleProjectProviderCache() throws Exception
{
final int[] consolesAdded = new int[1];
IConsoleListener consoleListener = new IConsoleListener()
{
@Override
public void consolesRemoved( IConsole[] consoles )
{
}
@Override
public void consolesAdded( IConsole[] consoles )
{
consolesAdded[0]++;
}
};
ConsolePlugin.getDefault().getConsoleManager().addConsoleListener( consoleListener );;
LiferayGradleProject gradleProject = fullImportGradleProject( "projects/cacheTest" );
assertNotNull( gradleProject );
IBundleProject bundleProject = LiferayCore.create( IBundleProject.class, gradleProject.getProject() );
assertNotNull( bundleProject );
assertEquals( LiferayGradleProject.class, bundleProject.getClass() );
assertEquals( 1, consolesAdded[0] );
bundleProject = LiferayCore.create( IBundleProject.class, gradleProject.getProject() );
assertNotNull( bundleProject );
assertEquals( LiferayGradleProject.class, bundleProject.getClass() );
assertEquals( 1, consolesAdded[0] );
IFile buildFile = gradleProject.getProject().getFile( "build.gradle" );
String buildFileContents = CoreUtil.readStreamToString( buildFile.getContents( true ), true );
String updatedContents = buildFileContents.replaceAll( "apply plugin: 'org.dm.bundle'", "" );
buildFile.setContents(
new ByteArrayInputStream( updatedContents.getBytes() ), IResource.FORCE, new NullProgressMonitor() );
final Object lock = new Object();
IGradleModelListener gradleModelListener = new IGradleModelListener()
{
@Override
public <T> void modelChanged( GradleProject project, Class<T> type, T model )
{
synchronized( lock )
{
lock.notify();
}
}
};
gradleProject.addModelListener( gradleModelListener );
gradleProject.requestGradleModelRefresh();
synchronized( lock )
{
lock.wait();
}
bundleProject = LiferayCore.create( IBundleProject.class, gradleProject.getProject() );
assertNull( bundleProject );
assertEquals( 2, consolesAdded[0] );
buildFile.setContents(
new ByteArrayInputStream( buildFileContents.getBytes() ), IResource.FORCE, new NullProgressMonitor() );
gradleProject.requestGradleModelRefresh();
synchronized( lock )
{
lock.wait();
}
bundleProject = LiferayCore.create( IBundleProject.class, gradleProject.getProject() );
assertNotNull( bundleProject );
assertEquals( 3, consolesAdded[0] );
}*/
@Test
public void hasGradleBundlePluginDetection() throws Exception {
final LiferayGradleProject gradleProject = Util.fullImportGradleProject("projects/biz.aQute.bundle");
assertNotNull(gradleProject);
final IBundleProject[] bundleProject = new IBundleProject[1];
WorkspaceJob job = new WorkspaceJob("") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
bundleProject[0] = LiferayCore.create(IBundleProject.class, gradleProject.getProject());
return Status.OK_STATUS;
}
};
job.schedule(5000);
job.join();
assertNotNull(bundleProject[0]);
assertEquals(LiferayGradleProject.class, bundleProject[0].getClass());
}
Aggregations