Skip to content

Commit

Permalink
Core Editor: Add handler for ProgramResourceEntryPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Mar 19, 2024
1 parent 3c7e454 commit 0bcbccf
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.shade.decima.ui.data.handlers;

import com.shade.decima.model.rtti.RTTIType;
import com.shade.decima.model.rtti.objects.RTTIObject;
import com.shade.decima.ui.data.registry.ValueHandlerRegistration;
import com.shade.decima.ui.data.registry.ValueHandlerRegistration.Selector;
import com.shade.decima.ui.data.registry.ValueHandlerRegistration.Type;
import com.shade.platform.ui.controls.CommonTextAttributes;
import com.shade.platform.ui.controls.TextAttributes;
import com.shade.util.NotNull;
import com.shade.util.Nullable;

@ValueHandlerRegistration(id = "programResourceEntryPoint", name = "Program Resource Entry Point", value = {
@Selector(type = @Type(name = "ProgramResourceEntryPoint"))
})
public class ProgramResourceEntryPointHandler extends ObjectValueHandler {
@Nullable
@Override
public Decorator getDecorator(@NotNull RTTIType<?> type) {
return (value, component) -> {
final RTTIObject object = (RTTIObject) value;
component.append(object.str("EntryPoint"), TextAttributes.REGULAR_ATTRIBUTES);
component.append("(", TextAttributes.REGULAR_ATTRIBUTES);

final RTTIObject[] parameters = object.objs("InputParameters");
for (int i = 0; i < parameters.length; i++) {
if (i > 0) {
component.append(", ", TextAttributes.REGULAR_ATTRIBUTES);
}

// ProgramParameterHandler#getDecorator
component.append(parameters[i].str("TypeName"), CommonTextAttributes.IDENTIFIER_ATTRIBUTES);
component.append(" ", TextAttributes.REGULAR_ATTRIBUTES);
component.append(parameters[i].str("Name"), TextAttributes.REGULAR_ATTRIBUTES);
}

component.append(")", TextAttributes.REGULAR_ATTRIBUTES);
};
}
}

0 comments on commit 0bcbccf

Please sign in to comment.