Skip to content

Commit dba2919

Browse files
committed
Simplify installer model
Inline some and remove other unused children. Flattening the model to ease manipulation.
1 parent b27b8b5 commit dba2919

File tree

10 files changed

+185
-554
lines changed

10 files changed

+185
-554
lines changed

openchrom/plugins/net.openchrom.installer.ui/plugin.xml

Lines changed: 108 additions & 293 deletions
Large diffs are not rendered by default.

openchrom/plugins/net.openchrom.installer.ui/src/net/openchrom/installer/ui/swt/OverviewToolTip.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,23 @@
2020
import org.eclipse.swt.widgets.Event;
2121
import org.eclipse.swt.widgets.Label;
2222

23-
import net.openchrom.installer.model.Overview;
24-
25-
/**
26-
* @author David Green
27-
* @author Igor Burilo
28-
*/
2923
public class OverviewToolTip extends ToolTip {
3024

31-
private final Overview overview;
25+
private final String summary;
3226

33-
public OverviewToolTip(Control control, Overview overview) {
27+
public OverviewToolTip(Control control, String summary) {
3428

3529
super(control, ToolTip.RECREATE, true);
36-
if(overview == null) {
30+
if(summary == null) {
3731
throw new IllegalArgumentException();
3832
}
39-
this.overview = overview;
33+
this.summary = summary;
4034
setHideOnMouseDown(false); // required for links to work
4135
}
4236

4337
@Override
4438
protected Composite createToolTipContentArea(Event event, Composite parent) {
4539

46-
String summary = overview.getSummary();
4740
Composite summaryContainer = new Composite(parent, SWT.NULL);
4841
summaryContainer.setBackground(null);
4942
GridLayoutFactory.fillDefaults().applyTo(summaryContainer);

openchrom/plugins/net.openchrom.installer.ui/src/net/openchrom/installer/ui/wizards/PluginDiscoveryWizardMainPage.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
import net.openchrom.installer.model.BundleDiscoveryStrategy;
9090
import net.openchrom.installer.model.DiscoveryCategory;
9191
import net.openchrom.installer.model.DiscoveryPlugin;
92-
import net.openchrom.installer.model.Overview;
9392
import net.openchrom.installer.model.PluginDescriptor;
9493
import net.openchrom.installer.model.PluginDescriptorKind;
9594
import net.openchrom.installer.model.PluginDiscovery;
@@ -457,7 +456,7 @@ public void focusGained(FocusEvent e) {
457456
infoButton = new ToolItem(toolBar, SWT.PUSH);
458457
infoButton.setImage(infoImage);
459458
infoButton.setToolTipText("show overview");
460-
hookTooltip(toolBar, infoButton, pluginContainer, nameLabel, plugin.getOverview());
459+
hookTooltip(toolBar, infoButton, pluginContainer, nameLabel, plugin.getSummary());
461460
GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(toolBar);
462461
} else {
463462
new Label(pluginContainer, SWT.NULL).setText(" "); //$NON-NLS-1$
@@ -616,7 +615,7 @@ private void createDiscoveryContents(Composite container) {
616615
ToolItem infoButton = new ToolItem(toolBar, SWT.PUSH);
617616
infoButton.setImage(infoImage);
618617
infoButton.setToolTipText("Show Overview");
619-
hookTooltip(toolBar, infoButton, categoryHeaderContainer, nameLabel, category.getOverview());
618+
hookTooltip(toolBar, infoButton, categoryHeaderContainer, nameLabel, category.getSummary());
620619
GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(toolBar);
621620
} else {
622621
new Label(categoryHeaderContainer, SWT.NULL).setText(" "); //$NON-NLS-1$
@@ -662,9 +661,9 @@ private void configureLook(Control control, Color background) {
662661
control.setBackground(background);
663662
}
664663

665-
private void hookTooltip(final Control tooltipControl, final ToolItem tipActivator, final Control exitControl, final Control titleControl, Overview overview) {
664+
private void hookTooltip(final Control tooltipControl, final ToolItem tipActivator, final Control exitControl, final Control titleControl, String summary) {
666665

667-
final OverviewToolTip toolTip = new OverviewToolTip(tooltipControl, overview);
666+
final OverviewToolTip toolTip = new OverviewToolTip(tooltipControl, summary);
668667
Listener listener = event -> {
669668

670669
switch(event.type) {
@@ -732,7 +731,7 @@ private void hookRecursively(Control control, Listener listener) {
732731

733732
private boolean hasTooltip(final DiscoveryCategory category) {
734733

735-
return category.getOverview() != null && category.getOverview().getSummary() != null && category.getOverview().getSummary().length() > 0;
734+
return category.getSummary() != null && category.getSummary().length() > 0;
736735
}
737736

738737
/**
@@ -917,6 +916,6 @@ public void paintControl(PaintEvent e) {
917916

918917
private boolean hasTooltip(final DiscoveryPlugin plugin) {
919918

920-
return plugin.getOverview() != null && plugin.getOverview().getSummary() != null && !plugin.getOverview().getSummary().isEmpty();
919+
return plugin.getSummary() != null && !plugin.getSummary().isEmpty();
921920
}
922921
}

openchrom/plugins/net.openchrom.installer/schema/pluginDiscovery.exsd

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
<complexType>
5858
<sequence>
5959
<element ref="featureFilter" minOccurs="0" maxOccurs="unbounded"/>
60-
<element ref="overview" minOccurs="0" maxOccurs="1"/>
6160
</sequence>
6261
<attribute name="kind" type="string" use="required">
6362
<annotation>
@@ -150,6 +149,23 @@
150149
</documentation>
151150
</annotation>
152151
</attribute>
152+
<attribute name="url" type="string">
153+
<annotation>
154+
<documentation>
155+
An URL that points to a web page with more information relevant to the plugin or category.
156+
</documentation>
157+
</annotation>
158+
</attribute>
159+
<attribute name="summary" type="string">
160+
<annotation>
161+
<documentation>
162+
A description providing detailed information about the item. Newlines can be used to format the text into multiple paragraphs if necessary. Text must fit into an area 320x240, otherwise it will be truncated in the UI. More lengthy descriptions can be provided on a web page if required, see @url.
163+
</documentation>
164+
<appinfo>
165+
<meta.attribute translatable="true"/>
166+
</appinfo>
167+
</annotation>
168+
</attribute>
153169
</complexType>
154170
</element>
155171

@@ -160,10 +176,6 @@
160176
</documentation>
161177
</annotation>
162178
<complexType>
163-
<sequence>
164-
<element ref="overview" minOccurs="0" maxOccurs="1"/>
165-
<element ref="group" minOccurs="0" maxOccurs="unbounded"/>
166-
</sequence>
167179
<attribute name="id" type="string" use="required">
168180
<annotation>
169181
<documentation>
@@ -211,16 +223,6 @@
211223
</documentation>
212224
</annotation>
213225
</attribute>
214-
</complexType>
215-
</element>
216-
217-
<element name="overview">
218-
<annotation>
219-
<documentation>
220-
An overview that provides more detailed information, which may include a summary, url and screenshot.
221-
</documentation>
222-
</annotation>
223-
<complexType>
224226
<attribute name="summary" type="string">
225227
<annotation>
226228
<documentation>
@@ -261,23 +263,6 @@
261263
</complexType>
262264
</element>
263265

264-
<element name="group">
265-
<annotation>
266-
<documentation>
267-
groups provide a way to anchor plugins in a grouping with other like entries.
268-
</documentation>
269-
</annotation>
270-
<complexType>
271-
<attribute name="id" type="string" use="required">
272-
<annotation>
273-
<documentation>
274-
An identifier that identifies the group. Must be unique for a particular plugin category.
275-
</documentation>
276-
</annotation>
277-
</attribute>
278-
</complexType>
279-
</element>
280-
281266
<annotation>
282267
<appinfo>
283268
<meta.section type="since"/>
@@ -287,15 +272,12 @@
287272
</documentation>
288273
</annotation>
289274

290-
291-
292-
293275
<annotation>
294276
<appinfo>
295277
<meta.section type="copyright"/>
296278
</appinfo>
297279
<documentation>
298-
Copyright (c) 2023, 2024 Lablicate GmbH.
280+
Copyright (c) 2023, 2026 Lablicate GmbH.
299281
All rights reserved. This program and the accompanying materials
300282
are made available under the terms of the Eclipse Public License v2.0
301283
which accompanies this distribution, and is available at

openchrom/plugins/net.openchrom.installer/src/net/openchrom/installer/model/Group.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

openchrom/plugins/net.openchrom.installer/src/net/openchrom/installer/model/Overview.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

openchrom/plugins/net.openchrom.installer/src/net/openchrom/installer/model/PluginCategory.java

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@
1212
*******************************************************************************/
1313
package net.openchrom.installer.model;
1414

15-
import java.util.ArrayList;
16-
import java.util.List;
17-
1815
/**
1916
* a category of plugins, which is a way of organizing plugins in top-level groups.
20-
*
21-
* @author David Green
22-
* @author Igor Burilo
2317
*/
2418
public class PluginCategory {
2519

@@ -28,8 +22,7 @@ public class PluginCategory {
2822
protected String description;
2923
protected String relevance;
3024
protected String icon;
31-
protected Overview overview;
32-
protected List<Group> group = new ArrayList<>();
25+
protected String summary;
3326

3427
/**
3528
* an id that uniquely identifies the category
@@ -43,7 +36,7 @@ public void setId(String id) {
4336

4437
this.id = id;
4538
}
46-
39+
4740
/**
4841
* the name of the category, as it is displayed in the ui.
4942
*/
@@ -94,24 +87,14 @@ public void setIcon(String icon) {
9487
this.icon = icon;
9588
}
9689

97-
public Overview getOverview() {
98-
99-
return overview;
100-
}
101-
102-
public void setOverview(Overview overview) {
90+
public String getSummary() {
10391

104-
this.overview = overview;
92+
return summary;
10593
}
10694

107-
public List<Group> getGroup() {
95+
public void setSummary(String summary) {
10896

109-
return group;
110-
}
111-
112-
public void setGroup(List<Group> group) {
113-
114-
this.group = group;
97+
this.summary = summary;
11598
}
11699

117100
public void validate() throws IllegalArgumentException {
@@ -125,6 +108,9 @@ public void validate() throws IllegalArgumentException {
125108
if(icon != null && icon.trim().isEmpty()) {
126109
throw new IllegalArgumentException("icon is set but empty");
127110
}
111+
if(summary != null && summary.trim().isEmpty()) {
112+
throw new IllegalArgumentException("summary is set but empty");
113+
}
128114
if(relevance != null) {
129115
try {
130116
int r = Integer.parseInt(relevance, 10);
@@ -135,8 +121,5 @@ public void validate() throws IllegalArgumentException {
135121
throw new IllegalArgumentException("relevance is not between 1 and 100");
136122
}
137123
}
138-
for(Group groupItem : group) {
139-
groupItem.validate();
140-
}
141124
}
142125
}

0 commit comments

Comments
 (0)