-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core Editor: Add handler for
ProgramResourceEntryPoint
- Loading branch information
1 parent
3c7e454
commit 0bcbccf
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...-ui/src/main/java/com/shade/decima/ui/data/handlers/ProgramResourceEntryPointHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; | ||
} | ||
} |