Search in sources :

Example 16 with ProjectRecord

use of com.liferay.ide.project.core.ProjectRecord in project liferay-ide by liferay.

the class ImportSDKProjectsCheckboxCustomPart method getInitItemsList.

@Override
protected List<ProjectCheckboxElement> getInitItemsList() {
    List<ProjectCheckboxElement> checkboxElementList = new ArrayList<>();
    Value<Path> sdkLocationPath = _op().getSdkLocation();
    Path sdkLocation = sdkLocationPath.content();
    if ((sdkLocation == null) || !sdkLocation.toFile().exists()) {
        return checkboxElementList;
    }
    final ProjectRecord[] projectRecords = _updateProjectsList(PathBridge.create(sdkLocation).toPortableString());
    if (projectRecords == null) {
        return checkboxElementList;
    }
    String context = null;
    for (ProjectRecord projectRecord : projectRecords) {
        final String projectLocation = projectRecord.getProjectLocation().toPortableString();
        context = projectRecord.getProjectName() + " (" + projectLocation + ")";
        ProjectCheckboxElement checkboxElement = new ProjectCheckboxElement(projectRecord.getProjectName(), context, projectRecord.getProjectLocation().toPortableString());
        if (!projectRecord.hasConflicts()) {
            checkboxElementList.add(checkboxElement);
        }
    }
    _sortProjectCheckboxElement(checkboxElementList);
    return checkboxElementList;
}
Also used : Path(org.eclipse.sapphire.modeling.Path) ArrayList(java.util.ArrayList) ProjectRecord(com.liferay.ide.project.core.ProjectRecord)

Example 17 with ProjectRecord

use of com.liferay.ide.project.core.ProjectRecord in project liferay-ide by liferay.

the class ImportSDKProjectsCheckboxCustomPart method _getProjectRecords.

@SuppressWarnings({ "rawtypes", "unchecked" })
private Object[] _getProjectRecords() {
    List projectRecords = new ArrayList();
    for (int i = 0; i < selectedProjects.length; i++) {
        ProjectRecord projectRecord = (ProjectRecord) selectedProjects[i];
        if (_isProjectInWorkspace(projectRecord.getProjectName())) {
            projectRecord.setHasConflicts(true);
        }
        projectRecords.add(selectedProjects[i]);
    }
    return projectRecords.toArray(new ProjectRecord[projectRecords.size()]);
}
Also used : ArrayList(java.util.ArrayList) ProjectRecord(com.liferay.ide.project.core.ProjectRecord) ArrayList(java.util.ArrayList) List(java.util.List) ElementList(org.eclipse.sapphire.ElementList)

Aggregations

ProjectRecord (com.liferay.ide.project.core.ProjectRecord)17 File (java.io.File)10 ArrayList (java.util.ArrayList)6 IProject (org.eclipse.core.resources.IProject)6 IPath (org.eclipse.core.runtime.IPath)6 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 BinaryProjectRecord (com.liferay.ide.project.core.BinaryProjectRecord)4 SDK (com.liferay.ide.sdk.core.SDK)3 JarFile (java.util.jar.JarFile)3 IFile (org.eclipse.core.resources.IFile)3 CoreException (org.eclipse.core.runtime.CoreException)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 URL (java.net.URL)2 List (java.util.List)2 Path (org.eclipse.core.runtime.Path)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 IRuntime (org.eclipse.wst.server.core.IRuntime)2 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)1 Collection (java.util.Collection)1