use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class AddDefaultColumnsAction method run.
@Override
protected Object run(Presentation context) {
Element element = context.part().getLocalModelElement();
if (element instanceof Entity) {
String entityName = ((Entity) element).getName().content();
if (CoreUtil.isNullOrEmpty(entityName)) {
String title = "Add Liferay Default Columns";
String message = "The entity name must be specified.";
MessageDialog.openInformation(UIUtil.getActiveShell(), title, message);
} else {
IFile serviceXML = element.adapt(IFile.class);
new ServiceBuilderDescriptorHelper(serviceXML.getProject()).addDefaultColumns(entityName);
}
}
return null;
}
use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class AddDefaultEntityAction method run.
@Override
protected Object run(Presentation context) {
Element localModelElement = context.part().getLocalModelElement();
IFile serviceXML = localModelElement.adapt(IFile.class);
new ServiceBuilderDescriptorHelper(serviceXML.getProject()).addDefaultEntity();
return null;
}
use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class BuildWSDDActionHandler method run.
@Override
protected Object run(Presentation context) {
Element modelElement = context.part().getModelElement();
IFile file = modelElement.adapt(IFile.class);
if (FileUtil.exists(file) && ServiceUIUtil.shouldCreateServiceBuilderJob(file)) {
new BuildWSDDJob(file.getProject()).schedule();
}
return null;
}
use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class RelationshipResource method _persistRelationship.
private void _persistRelationship() {
Element element = parent().element();
ServiceBuilder serviceBuilder = element.nearest(ServiceBuilder.class);
String fromName = _relationshipObject.getFromName();
String toName = _relationshipObject.getToName();
Entity fromEntity = EntityRelationshipService.findEntity(fromName, serviceBuilder);
Entity toEntity = EntityRelationshipService.findEntity(toName, serviceBuilder);
if ((fromEntity != null) && (toEntity != null)) {
Column primaryKeyColumn = null;
for (Column column : toEntity.getColumns()) {
if (column.isPrimary().content()) {
primaryKeyColumn = column;
break;
}
}
if (primaryKeyColumn != null) {
Column column = fromEntity.getColumns().insert();
column.setName(primaryKeyColumn.getName().content());
column.setType("long");
}
}
}
use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class NodeNameListener method handleTypedEvent.
@Override
protected void handleTypedEvent(PropertyContentEvent event) {
Property property = event.property();
Element element = property.element();
WorkflowDefinition workflow = element.adapt(WorkflowDefinition.class);
Map<String, String> eventInfo = new HashMap<>();
event.fillTracingInfo(eventInfo);
String oldName = eventInfo.get("before");
if (oldName == null) {
oldName = _lastNodeNames.get(property);
}
String newName = eventInfo.get("after");
List<Transition> allTransitions = new ArrayList<>();
if (workflow != null) {
ElementList<Condition> allConditions = workflow.getConditions();
ElementList<Fork> allForks = workflow.getForks();
ElementList<Join> allJoins = workflow.getJoins();
ElementList<State> allStates = workflow.getStates();
ElementList<Task> allTasks = workflow.getTasks();
for (Condition condition : allConditions) {
ElementList<Transition> conditionTransitions = condition.getTransitions();
for (Transition transition : conditionTransitions) {
allTransitions.add(transition);
}
}
for (Fork fork : allForks) {
ElementList<Transition> forkTransitions = fork.getTransitions();
for (Transition transition : forkTransitions) {
allTransitions.add(transition);
}
}
for (Join join : allJoins) {
ElementList<Transition> joinTransitions = join.getTransitions();
for (Transition transition : joinTransitions) {
allTransitions.add(transition);
}
}
for (State state : allStates) {
ElementList<Transition> stateTransitions = state.getTransitions();
for (Transition transition : stateTransitions) {
allTransitions.add(transition);
}
}
for (Task task : allTasks) {
ElementList<Transition> taskTransitions = task.getTransitions();
for (Transition transition : taskTransitions) {
allTransitions.add(transition);
}
}
}
for (Transition transition : allTransitions) {
String targetName = transition.getTarget().toString();
if (targetName.equals(oldName)) {
if (newName != null) {
transition.setTarget(newName);
if (_lastNodeNames.containsKey(property)) {
_lastNodeNames.remove(property);
}
} else {
_lastNodeNames.put(property, oldName);
}
}
}
}
Aggregations