1
1
package com .capgemini .cobigen .eclipse .healthcheck ;
2
2
3
3
import java .nio .file .Path ;
4
+ import java .util .List ;
4
5
import java .util .Map ;
5
6
import java .util .Set ;
6
7
import java .util .UUID ;
@@ -43,16 +44,21 @@ public class AdvancedHealthCheckDialog extends Dialog {
43
44
private Set <String > hasConfiguration ;
44
45
45
46
/** Accessibility of templates configuration for changes */
46
- private Map <String , Boolean > isAccessible ;
47
+ private Set <String > isAccessible ;
47
48
48
49
/** Templates configurations, which can be upgraded */
49
50
private Map <String , Path > upgradeableConfigurations ;
50
51
51
52
/** Templates configurations, which are already up to date */
52
53
private Set <String > upToDateConfigurations ;
53
54
55
+ /** Expected templates configurations liked by the context configuration */
56
+ private List <String > expectedTemplatesConfigurations ;
57
+
54
58
/**
55
59
* Creates a new {@link AdvancedHealthCheckDialog} with the given parameters.
60
+ * @param expectedTemplatesConfigurations
61
+ * expected templates configurations liked by the context configuration
56
62
* @param hasConfiguration
57
63
* Availability of templates configuration in the found folders
58
64
* @param isAccessible
@@ -63,13 +69,15 @@ public class AdvancedHealthCheckDialog extends Dialog {
63
69
* Templates configurations, which are already up to date
64
70
* @author mbrunnli (Jun 24, 2015)
65
71
*/
66
- AdvancedHealthCheckDialog (Set <String > hasConfiguration , Map <String , Boolean > isAccessible ,
67
- Map <String , Path > upgradeableConfigurations , Set <String > upToDateConfigurations ) {
72
+ AdvancedHealthCheckDialog (List <String > expectedTemplatesConfigurations , Set <String > hasConfiguration ,
73
+ Set <String > isAccessible , Map <String , Path > upgradeableConfigurations ,
74
+ Set <String > upToDateConfigurations ) {
68
75
super (Display .getDefault ().getActiveShell ());
69
76
this .hasConfiguration = hasConfiguration ;
70
77
this .isAccessible = isAccessible ;
71
78
this .upgradeableConfigurations = upgradeableConfigurations ;
72
79
this .upToDateConfigurations = upToDateConfigurations ;
80
+ this .expectedTemplatesConfigurations = expectedTemplatesConfigurations ;
73
81
}
74
82
75
83
/**
@@ -94,13 +102,15 @@ protected Control createDialogArea(Composite parent) {
94
102
gridData = new GridData (GridData .FILL , GridData .FILL , true , true );
95
103
gridData .widthHint = 400 ;
96
104
gridData .horizontalSpan = 2 ;
97
- introduction
98
- . setText ( "The following template configurations have been found in the current configuration folder: " );
105
+ introduction . setText ( "The following template folders are referenced by the context configuration. "
106
+ + "These are the results of scanning each templates configuration. " );
99
107
introduction .setLayoutData (gridData );
100
108
101
109
GridData leftGridData = new GridData (GridData .BEGINNING , GridData .CENTER , true , false );
110
+ leftGridData .widthHint = 320 ;
102
111
GridData rightGridData = new GridData (GridData .CENTER , GridData .CENTER , false , false );
103
- for (final String key : hasConfiguration ) {
112
+ rightGridData .widthHint = 80 ;
113
+ for (final String key : expectedTemplatesConfigurations ) {
104
114
Label label = new Label (contentParent , SWT .NONE );
105
115
label .setText (key );
106
116
label .setLayoutData (leftGridData );
@@ -110,26 +120,29 @@ protected Control createDialogArea(Composite parent) {
110
120
infoLabel .setText ("Up-to-date" );
111
121
infoLabel .setForeground (Display .getCurrent ().getSystemColor (SWT .COLOR_DARK_GREEN ));
112
122
infoLabel .setLayoutData (rightGridData );
113
- } else if (isAccessible .get (key )) {
114
- if (upgradeableConfigurations .get (key ) != null ) {
115
- Button upgrade = new Button (contentParent , SWT .PUSH );
116
- upgrade .setText ("Upgrade" );
117
- upgrade .setLayoutData (rightGridData );
118
- upgrade .addSelectionListener (new SelectionAdapter () {
119
- @ Override
120
- public void widgetSelected (SelectionEvent e ) {
121
- upgradeTemplatesConfiguration (upgradeableConfigurations .get (key ));
122
- }
123
- });
124
- } else {
125
- Label infoLabel = new Label (contentParent , SWT .NONE );
126
- infoLabel .setText ("Invalid!" );
127
- infoLabel .setForeground (Display .getCurrent ().getSystemColor (SWT .COLOR_DARK_RED ));
128
- infoLabel .setLayoutData (rightGridData );
129
- }
123
+ } else if (upgradeableConfigurations .containsKey (key )) {
124
+ Button upgrade = new Button (contentParent , SWT .PUSH );
125
+ upgrade .setText ("Upgrade" );
126
+ upgrade .setLayoutData (rightGridData );
127
+ upgrade .addSelectionListener (new SelectionAdapter () {
128
+ @ Override
129
+ public void widgetSelected (SelectionEvent e ) {
130
+ upgradeTemplatesConfiguration (upgradeableConfigurations .get (key ));
131
+ }
132
+ });
133
+ } else if (!hasConfiguration .contains (key )) {
134
+ Label infoLabel = new Label (contentParent , SWT .NONE );
135
+ infoLabel .setText ("Not found!" );
136
+ infoLabel .setForeground (Display .getCurrent ().getSystemColor (SWT .COLOR_DARK_RED ));
137
+ infoLabel .setLayoutData (rightGridData );
138
+ } else if (!isAccessible .contains (key )) {
139
+ Label infoLabel = new Label (contentParent , SWT .NONE );
140
+ infoLabel .setText ("Not writable!" );
141
+ infoLabel .setLayoutData (rightGridData );
130
142
} else {
131
143
Label infoLabel = new Label (contentParent , SWT .NONE );
132
- infoLabel .setText ("Not accessible!" );
144
+ infoLabel .setText ("Invalid!" );
145
+ infoLabel .setForeground (Display .getCurrent ().getSystemColor (SWT .COLOR_DARK_RED ));
133
146
infoLabel .setLayoutData (rightGridData );
134
147
}
135
148
}
0 commit comments