Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
359 changes: 100 additions & 259 deletions openchrom/plugins/net.openchrom.installer.ui/plugin.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
import net.openchrom.installer.model.DiscoveryCategory;
import net.openchrom.installer.model.DiscoveryPlugin;
import net.openchrom.installer.model.IDiscoverySource;
import net.openchrom.installer.model.Icon;
import net.openchrom.installer.model.Overview;
import net.openchrom.installer.model.PluginDescriptor;
import net.openchrom.installer.model.PluginDescriptorKind;
Expand Down Expand Up @@ -450,7 +449,7 @@ public void focusGained(FocusEvent e) {
configureLook(iconLabel, background);
GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(iconLabel);
if(plugin.getIcon() != null) {
iconImage = computeIconImage(plugin.getSource(), plugin.getIcon(), 32, false);
iconImage = computeIconImage(plugin.getSource(), plugin.getIcon(), false);
if(iconImage != null) {
iconLabel.setImage(iconImage);
}
Expand Down Expand Up @@ -638,7 +637,7 @@ private void createDiscoveryContents(Composite container) {
GridLayoutFactory.fillDefaults().numColumns(3).margins(5, 5).equalWidth(false).applyTo(categoryHeaderContainer);
Label iconLabel = new Label(categoryHeaderContainer, SWT.NULL);
if(category.getIcon() != null) {
Image image = computeIconImage(category.getSource(), category.getIcon(), 48, true);
Image image = computeIconImage(category.getSource(), category.getIcon(), true);
if(image != null) {
iconLabel.setImage(image);
}
Expand Down Expand Up @@ -837,28 +836,10 @@ private boolean filterMatches(String text) {
return text != null && filterPattern.matcher(text).find();
}

private Image computeIconImage(IDiscoverySource discoverySource, Icon icon, int dimension, boolean fallback) {
private Image computeIconImage(IDiscoverySource discoverySource, String icon, boolean fallback) {

String imagePath;
switch(dimension) {
case 64:
imagePath = icon.getImage64();
if(imagePath != null || !fallback) {
break;
}
case 48:
imagePath = icon.getImage48();
if(imagePath != null || !fallback) {
break;
}
case 32:
imagePath = icon.getImage32();
break;
default:
throw new IllegalArgumentException();
}
if(imagePath != null && !imagePath.isEmpty()) {
URL resource = discoverySource.getResource(imagePath);
if(icon != null && !icon.isEmpty()) {
URL resource = discoverySource.getResource(icon);
if(resource != null) {
ImageDescriptor descriptor = ImageDescriptor.createFromURL(resource);
Image image = descriptor.createImage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
<complexType>
<sequence>
<element ref="featureFilter" minOccurs="0" maxOccurs="unbounded"/>
<element ref="icon" minOccurs="0" maxOccurs="1"/>
<element ref="overview" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="kind" type="string" use="required">
Expand All @@ -77,6 +76,16 @@
</appinfo>
</annotation>
</attribute>
<attribute name="icon" type="string">
<annotation>
<documentation>
An icon of the plugin
</documentation>
<appinfo>
<meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
<attribute name="provider" type="string" use="required">
<annotation>
<documentation>
Expand Down Expand Up @@ -159,7 +168,6 @@
</annotation>
<complexType>
<sequence>
<element ref="icon" minOccurs="0" maxOccurs="1"/>
<element ref="overview" minOccurs="0" maxOccurs="1"/>
<element ref="group" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
Expand Down Expand Up @@ -193,66 +201,21 @@
</appinfo>
</annotation>
</attribute>
<attribute name="relevance" type="string">
<attribute name="icon" type="string">
<annotation>
<documentation>
A relevance, which is a number from 0 to 100. Categories with higher relevance are displayed with preference in the UI.
</documentation>
</annotation>
</attribute>
</complexType>
</element>

<element name="icon">
<complexType>
<attribute name="image16" type="string">
<annotation>
<documentation>

An icon of the category
</documentation>
<appinfo>
<meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
<attribute name="image32" type="string">
<annotation>
<documentation>

</documentation>
<appinfo>
<meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
<attribute name="image48" type="string">
<annotation>
<documentation>

</documentation>
<appinfo>
<meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
<attribute name="image64" type="string">
<annotation>
<documentation>

</documentation>
<appinfo>
<meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
<attribute name="image128" type="string">
<attribute name="relevance" type="string">
<annotation>
<documentation>

A relevance, which is a number from 0 to 100. Categories with higher relevance are displayed with preference in the UI.
</documentation>
<appinfo>
<meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
</complexType>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class PluginCategory {
protected String name;
protected String description;
protected String relevance;
protected Icon icon;
protected String icon;
protected Overview overview;
protected List<Group> group = new ArrayList<>();

Expand Down Expand Up @@ -84,12 +84,12 @@ public void setRelevance(String relevance) {
this.relevance = relevance;
}

public Icon getIcon() {
public String getIcon() {

return icon;
}

public void setIcon(Icon icon) {
public void setIcon(String icon) {

this.icon = icon;
}
Expand Down Expand Up @@ -122,8 +122,8 @@ public void validate() throws IllegalArgumentException {
if(name == null || name.isEmpty()) {
throw new IllegalArgumentException("name is missing");
}
if(icon != null) {
icon.validate();
if(icon != null && icon.trim().isEmpty()) {
throw new IllegalArgumentException("icon is set but empty");
}
if(relevance != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2025 Tasktop Technologies, Polarion Software and others.
* Copyright (c) 2009, 2026 Tasktop Technologies, Polarion Software and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -34,7 +34,7 @@ public class PluginDescriptor {
protected String platformFilter;
protected String groupId;
protected List<FeatureFilter> featureFilter = new ArrayList<>();
protected Icon icon;
protected String icon;
protected Overview overview;

public List<PluginDescriptorKind> getKind() {
Expand Down Expand Up @@ -177,12 +177,12 @@ public void setFeatureFilter(List<FeatureFilter> featureFilter) {
this.featureFilter = featureFilter;
}

public Icon getIcon() {
public String getIcon() {

return icon;
}

public void setIcon(Icon icon) {
public void setIcon(String icon) {

this.icon = icon;
}
Expand Down Expand Up @@ -223,8 +223,8 @@ public void validate() throws IllegalArgumentException {
for(FeatureFilter featureFilterItem : featureFilter) {
featureFilterItem.validate();
}
if(icon != null) {
icon.validate();
if(icon != null && icon.isEmpty()) {
throw new IllegalArgumentException("icon is provided but is empty");
}
if(overview != null) {
overview.validate();
Expand Down
Loading