Skip to content

Commit

Permalink
CSS: Allow Color And Font Definitions To Be Marked As Not Editable
Browse files Browse the repository at this point in the history
Color and Fonts can be defined as not editable if done via the
extensions point. Provide the same possibility if they are defined via
CSS.
  • Loading branch information
BeckerWdf committed Oct 29, 2024
1 parent ec2d9bd commit 845377a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions bundles/org.eclipse.e4.ui.css.swt/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@
<property-name name="category"/>
<property-name name="label"/>
<property-name name="description"/>
<property-name name="editable"/>
</handler>
<handler
adapter="org.eclipse.e4.ui.css.swt.dom.definition.FontDefinitionElement"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class CSSPropertyThemeElementDefinitionHandler implements ICSSPropertyHan

private static final String MESSAGE_QUERY_PARAM = "message";

private static final String EDITABLE_PROP = "editable";

private Map<Long, ResourceBundle> bundleToResourceBundles = new WeakHashMap<>();

@Override
Expand All @@ -65,6 +67,10 @@ public boolean applyCSSProperty(Object element, String property,
case DESCRIPTION_PROP:
definition.setDescription(getLabel(value));
break;
case EDITABLE_PROP:
Boolean editable = (Boolean) engine.convert(value, Boolean.class, null);
definition.setEditable(editable);
break;
default:
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ public interface IThemeElementDefinitionOverridable<T> {
void setName(String name);

void setDescription(String description);

void setEditable(Boolean editable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,10 @@ public void setValue(RGB data) {
appendState(State.OVERRIDDEN);
}
}

@Override
public void setEditable(Boolean editable) {
isEditable = editable;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,9 @@ public void setValue(FontData[] data) {
appendState(State.OVERRIDDEN);
}
}

@Override
public void setEditable(Boolean editable) {
isEditable = editable;
}
}

0 comments on commit 845377a

Please sign in to comment.