use of com.liferay.ide.core.ILiferayProjectProvider in project liferay-ide by liferay.
the class JSFModuleProjectProviderPossibleValuesService method initPossibleValuesService.
protected void initPossibleValuesService() {
_possibleValues = new ArrayList<>();
ILiferayProjectProvider[] jsfProviders = LiferayCore.getProviders("jsf-module");
for (ILiferayProjectProvider provider : jsfProviders) {
if (provider instanceof NewLiferayProjectProvider<?>) {
_possibleValues.add(provider.getShortName());
}
}
Collections.sort(_possibleValues);
}
use of com.liferay.ide.core.ILiferayProjectProvider in project liferay-ide by liferay.
the class FragmentProjectNameListener method updateLocation.
public static void updateLocation(NewModuleFragmentOp op) {
String currentProjectName = op.getProjectName().content(true);
if ((currentProjectName == null) || CoreUtil.isNullOrEmpty(currentProjectName.trim())) {
return;
}
boolean useDefaultLocation = op.getUseDefaultLocation().content(true);
if (useDefaultLocation) {
Path newLocationBase = null;
boolean hasLiferayWorkspace = false;
boolean hasGradleWorkspace = false;
boolean hasMavenWorkspace = false;
try {
hasLiferayWorkspace = LiferayWorkspaceUtil.hasWorkspace();
hasGradleWorkspace = LiferayWorkspaceUtil.hasGradleWorkspace();
hasMavenWorkspace = LiferayWorkspaceUtil.hasMavenWorkspace();
} catch (Exception e) {
ProjectCore.logError("Failed to check LiferayWorkspace project.");
}
if (!hasLiferayWorkspace) {
newLocationBase = PathBridge.create(CoreUtil.getWorkspaceRoot().getLocation());
} else {
boolean gradleModule = false;
boolean mavenModule = false;
ILiferayProjectProvider iProvider = op.getProjectProvider().content();
if (iProvider != null) {
String shortName = iProvider.getShortName();
if (!CoreUtil.empty(shortName) && shortName.startsWith("gradle")) {
gradleModule = true;
} else {
mavenModule = true;
}
}
if ((gradleModule && hasGradleWorkspace) || (mavenModule && hasMavenWorkspace)) {
IProject liferayWorkspaceProject = LiferayWorkspaceUtil.getWorkspaceProject();
if (FileUtil.exists(liferayWorkspaceProject)) {
String folder = LiferayWorkspaceUtil.getModulesDir(liferayWorkspaceProject);
if (folder != null) {
IPath appendPath = liferayWorkspaceProject.getLocation().append(folder);
newLocationBase = PathBridge.create(appendPath);
}
}
} else {
newLocationBase = PathBridge.create(CoreUtil.getWorkspaceRoot().getLocation());
}
}
if (newLocationBase != null) {
op.setLocation(newLocationBase);
}
}
}
use of com.liferay.ide.core.ILiferayProjectProvider in project liferay-ide by liferay.
the class FragmentProjectProviderDefaultValueService method compute.
@Override
protected String compute() {
String retval = "gradle-module-fragment";
final IScopeContext[] prefContexts = { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
final String defaultProjectBuildType = Platform.getPreferencesService().getString(ProjectCore.PLUGIN_ID, ProjectCore.PREF_DEFAULT_MODULE_FRAGMENT_PROJECT_BUILD_TYPE_OPTION, null, prefContexts);
if (defaultProjectBuildType != null) {
final ILiferayProjectProvider provider = LiferayCore.getProvider(defaultProjectBuildType);
if (provider != null) {
retval = defaultProjectBuildType;
}
}
return retval;
}
use of com.liferay.ide.core.ILiferayProjectProvider in project liferay-ide by liferay.
the class ModuleProjectProviderPossibleValuesService method initPossibleValuesService.
protected void initPossibleValuesService() {
_possibleValues = new ArrayList<>();
for (ILiferayProjectProvider provider : LiferayCore.getProviders("module")) {
if (provider instanceof NewLiferayProjectProvider<?>) {
_possibleValues.add(provider.getShortName());
}
}
Collections.sort(_possibleValues);
}
Aggregations