Search in sources :

Example 1 with BaseModuleOp

use of com.liferay.ide.project.core.modules.BaseModuleOp in project liferay-ide by liferay.

the class ModuleFragmentProjectGroupIdValidationService method compute.

@Override
protected Status compute() {
    NewModuleFragmentOp op = _op();
    NewLiferayProjectProvider<BaseModuleOp> provider = op.getProjectProvider().content(true);
    if ("maven-module-fragment".equals(provider.getShortName())) {
        Value<String> groupIdValue = _op().getGroupId();
        String groupId = groupIdValue.content(true);
        IStatus javaStatus = JavaConventions.validatePackageName(groupId, CompilerOptions.VERSION_1_7, CompilerOptions.VERSION_1_7);
        if (!javaStatus.isOK()) {
            return StatusBridge.create(javaStatus);
        }
    }
    return Status.createOkStatus();
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) BaseModuleOp(com.liferay.ide.project.core.modules.BaseModuleOp)

Example 2 with BaseModuleOp

use of com.liferay.ide.project.core.modules.BaseModuleOp in project liferay-ide by liferay.

the class BaseProjectWizard method init.

@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
    if (selection != null) {
        Object element = selection.getFirstElement();
        if (element instanceof IResource) {
            IResource resource = (IResource) element;
            final IPath location = resource.getProject().getLocation();
            if (location != null) {
                ((BaseModuleOp) element()).setInitialSelectionPath(PathBridge.create(location));
            }
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) BaseModuleOp(com.liferay.ide.project.core.modules.BaseModuleOp) IResource(org.eclipse.core.resources.IResource)

Example 3 with BaseModuleOp

use of com.liferay.ide.project.core.modules.BaseModuleOp in project liferay-ide by liferay.

the class NewLiferayJSFModuleProjectOpMethods method execute.

public static final Status execute(NewLiferayJSFModuleProjectOp op, ProgressMonitor pm) {
    IProgressMonitor monitor = ProgressMonitorBridge.create(pm);
    monitor.beginTask("Creating Liferay JSF project (this process may take several minutes)", 100);
    Status retval = null;
    try {
        NewLiferayProjectProvider<BaseModuleOp> projectProvider = op.getProjectProvider().content();
        IStatus status = projectProvider.createNewProject(op, monitor);
        retval = StatusBridge.create(status);
        if (retval.ok()) {
            _updateBuildPrefs(op);
        }
    } catch (Exception e) {
        String msg = "Error creating Liferay module project.";
        ProjectCore.logError(msg, e);
        return Status.createErrorStatus(msg + " " + e.getMessage(), e);
    }
    return retval;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.sapphire.modeling.Status) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) BaseModuleOp(com.liferay.ide.project.core.modules.BaseModuleOp)

Example 4 with BaseModuleOp

use of com.liferay.ide.project.core.modules.BaseModuleOp in project liferay-ide by liferay.

the class NewModuleFragmentOpMethods method getMavenParentPomGroupId.

public static String getMavenParentPomGroupId(NewModuleFragmentOp op, String projectName, IPath path) {
    String retval = null;
    File parentProjectDir = path.toFile();
    NewLiferayProjectProvider<BaseModuleOp> provider = op.getProjectProvider().content();
    IStatus locationStatus = provider.validateProjectLocation(projectName, path);
    if (locationStatus.isOK() && FileUtil.hasChildren(parentProjectDir)) {
        List<String> groupIds = provider.getData("parentGroupId", String.class, parentProjectDir);
        if (ListUtil.isNotEmpty(groupIds)) {
            retval = groupIds.get(0);
        }
    }
    return retval;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) BaseModuleOp(com.liferay.ide.project.core.modules.BaseModuleOp) File(java.io.File)

Example 5 with BaseModuleOp

use of com.liferay.ide.project.core.modules.BaseModuleOp in project liferay-ide by liferay.

the class NewModuleFragmentOpMethods method getMavenParentPomVersion.

public static String getMavenParentPomVersion(NewModuleFragmentOp op, String projectName, IPath path) {
    String retval = null;
    File parentProjectDir = path.toFile();
    NewLiferayProjectProvider<BaseModuleOp> provider = op.getProjectProvider().content();
    IStatus locationStatus = provider.validateProjectLocation(projectName, path);
    if (locationStatus.isOK() && FileUtil.hasChildren(parentProjectDir)) {
        List<String> versions = provider.getData("parentVersion", String.class, parentProjectDir);
        if (ListUtil.isNotEmpty(versions)) {
            retval = versions.get(0);
        }
    }
    return retval;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) BaseModuleOp(com.liferay.ide.project.core.modules.BaseModuleOp) File(java.io.File)

Aggregations

BaseModuleOp (com.liferay.ide.project.core.modules.BaseModuleOp)6 IStatus (org.eclipse.core.runtime.IStatus)5 File (java.io.File)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 Status (org.eclipse.sapphire.modeling.Status)2 IOException (java.io.IOException)1 IResource (org.eclipse.core.resources.IResource)1 CoreException (org.eclipse.core.runtime.CoreException)1 IPath (org.eclipse.core.runtime.IPath)1