use of com.liferay.ide.project.core.model.NewLiferayProfile in project liferay-ide by liferay.
the class NewLiferayProfileActionHandler method run.
@Override
protected Object run(Presentation context) {
if (context instanceof SwtPresentation) {
final SwtPresentation swt = (SwtPresentation) context;
final NewLiferayPluginProjectOp op = _op(context);
final NewLiferayProfile newLiferayProfile = op.getNewLiferayProfiles().insert();
final SapphireDialog dialog = new SapphireDialog(swt.shell(), newLiferayProfile, DefinitionLoader.sdef(NewLiferayPluginProjectWizard.class).dialog("NewLiferayProfile"));
dialog.setBlockOnOpen(true);
final int result = dialog.open();
if (result == SapphireDialog.OK) {
addToActiveProfiles(op, newLiferayProfile);
} else {
op.getNewLiferayProfiles().remove(newLiferayProfile);
}
}
return null;
}
use of com.liferay.ide.project.core.model.NewLiferayProfile in project liferay-ide by liferay.
the class LiferayVersionDefaultValueService method initDefaultValueService.
@Override
protected void initDefaultValueService() {
super.initDefaultValueService();
PropertyDef def = context().find(PropertyDef.class);
Property property = context(Element.class).property(def);
PossibleValuesService possibleValuesService = property.service(PossibleValuesService.class);
possibleValuesService.attach(new Listener() {
@Override
public void handle(Event event) {
_possibleValues = possibleValuesService.values();
refresh();
}
});
NewLiferayProfile profile = context(NewLiferayProfile.class);
profile.property(NewLiferayProfile.PROP_RUNTIME_NAME).attach(new FilteredListener<PropertyContentEvent>() {
@Override
protected void handleTypedEvent(PropertyContentEvent event) {
_possibleValues = possibleValuesService.values();
_runtimeVersion = null;
refresh();
}
});
_possibleValues = possibleValuesService.values();
}
use of com.liferay.ide.project.core.model.NewLiferayProfile in project liferay-ide by liferay.
the class NewLiferayProfileIdDefaultValueService method compute.
@Override
protected String compute() {
NewLiferayProfile profile = _newLiferayProfile();
String defaultRuntimeName = profile.getRuntimeName().content();
/*
* First try to use this as a runtimeName, but need to check it against existing possible values.
* If no existing profiles with this name exist, use it, if not, append a (1)
*/
String data = defaultRuntimeName;
if (data.equals("<None>")) {
return StringPool.EMPTY;
}
data = data.replaceAll(StringPool.SPACE, StringPool.DASH);
NewLiferayPluginProjectOp op = profile.nearest(NewLiferayPluginProjectOp.class);
Set<String> possibleValues = NewLiferayPluginProjectOpMethods.getPossibleProfileIds(op, false);
while (possibleValues.contains(data)) {
try {
data = _nextSuffix(data);
} catch (Exception e) {
}
}
return data;
}
use of com.liferay.ide.project.core.model.NewLiferayProfile in project liferay-ide by liferay.
the class NewLiferayProfileIdValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
NewLiferayProfile newLiferayProfile = _profile();
String profileId = newLiferayProfile.getId().content(true);
if ((profileId == null) || profileId.isEmpty()) {
retval = Status.createErrorStatus("Profile id can not be empty.");
} else if (profileId.contains(StringPool.SPACE)) {
retval = Status.createErrorStatus("No spaces are allowed in profile id.");
}
if (ListUtil.isEmpty(_existingValues)) {
return retval;
}
for (String val : _existingValues) {
if ((val != null) && val.equals(profileId)) {
return Status.createErrorStatus("Profile already exists.");
}
}
return retval;
}
use of com.liferay.ide.project.core.model.NewLiferayProfile in project liferay-ide by liferay.
the class NewLiferayProfileRuntimeValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
NewLiferayPluginProjectOp op = context(NewLiferayPluginProjectOp.class);
NewLiferayProjectProvider<NewLiferayPluginProjectOp> provider = op.getProjectProvider().content(true);
if ("maven".equals(provider.getShortName())) {
NewLiferayProfile newLiferayProfile = context(NewLiferayProfile.class);
String runtimeName = newLiferayProfile.getRuntimeName().content(true);
IRuntime runtime = ServerUtil.getRuntime(runtimeName);
if (runtime == null) {
retval = Status.createErrorStatus("Liferay runtime must be configured.");
}
}
return retval;
}
Aggregations