Search in sources :

Example 11 with IBundleProject

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);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IBundleProject(com.liferay.ide.core.IBundleProject) NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 12 with IBundleProject

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;
    }
}
Also used : IBundleProject(com.liferay.ide.core.IBundleProject) IPath(org.eclipse.core.runtime.IPath) PluginsSDKBundleProject(com.liferay.ide.project.core.PluginsSDKBundleProject) Version(org.osgi.framework.Version) IProjectFacetVersion(org.eclipse.wst.common.project.facet.core.IProjectFacetVersion) ILiferayProject(com.liferay.ide.core.ILiferayProject) SDK(com.liferay.ide.sdk.core.SDK)

Example 13 with IBundleProject

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;
}
Also used : IBundleProject(com.liferay.ide.core.IBundleProject) IPath(org.eclipse.core.runtime.IPath) CoreException(org.eclipse.core.runtime.CoreException)

Example 14 with IBundleProject

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]);
}
Also used : IModuleResource(org.eclipse.wst.server.core.model.IModuleResource) IBundleProject(com.liferay.ide.core.IBundleProject) IPath(org.eclipse.core.runtime.IPath) ArrayList(java.util.ArrayList)

Example 15 with IBundleProject

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());
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) LiferayGradleProject(com.liferay.ide.gradle.core.LiferayGradleProject) IBundleProject(com.liferay.ide.core.IBundleProject) WorkspaceJob(org.eclipse.core.resources.WorkspaceJob) Test(org.junit.Test)

Aggregations

IBundleProject (com.liferay.ide.core.IBundleProject)18 IProject (org.eclipse.core.resources.IProject)11 IPath (org.eclipse.core.runtime.IPath)8 Test (org.junit.Test)7 IModule (org.eclipse.wst.server.core.IModule)6 NewLiferayModuleProjectOp (com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp)5 CoreException (org.eclipse.core.runtime.CoreException)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 ArrayList (java.util.ArrayList)3 IOException (java.io.IOException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 IServer (org.eclipse.wst.server.core.IServer)2 IModuleResource (org.eclipse.wst.server.core.model.IModuleResource)2 ILiferayProject (com.liferay.ide.core.ILiferayProject)1 LiferayGradleProject (com.liferay.ide.gradle.core.LiferayGradleProject)1 IProjectBuilder (com.liferay.ide.project.core.IProjectBuilder)1 PluginsSDKBundleProject (com.liferay.ide.project.core.PluginsSDKBundleProject)1 SDK (com.liferay.ide.sdk.core.SDK)1 GogoBundleDeployer (com.liferay.ide.server.core.gogo.GogoBundleDeployer)1