|
Lines 13-20
Link Here
|
| 13 |
|
13 |
|
| 14 |
package org.eclipse.emf.ecp.ui.common; |
14 |
package org.eclipse.emf.ecp.ui.common; |
| 15 |
|
15 |
|
| 16 |
import org.eclipse.net4j.util.ObjectUtil; |
|
|
| 17 |
|
| 18 |
import org.eclipse.emf.ecp.core.ECPProvider; |
16 |
import org.eclipse.emf.ecp.core.ECPProvider; |
| 19 |
import org.eclipse.emf.ecp.core.ECPProviderRegistry; |
17 |
import org.eclipse.emf.ecp.core.ECPProviderRegistry; |
| 20 |
import org.eclipse.emf.ecp.core.util.ECPProperties; |
18 |
import org.eclipse.emf.ecp.core.util.ECPProperties; |
|
Lines 73-80
Link Here
|
| 73 |
|
71 |
|
| 74 |
private StackLayout providerStackLayout; |
72 |
private StackLayout providerStackLayout; |
| 75 |
|
73 |
|
| 76 |
private Text repositoryLabelText; |
|
|
| 77 |
|
| 78 |
private Text repositoryDescriptionText; |
74 |
private Text repositoryDescriptionText; |
| 79 |
|
75 |
|
| 80 |
private Text repositoryNameText; |
76 |
private Text repositoryNameText; |
|
Lines 85-92
Link Here
|
| 85 |
|
81 |
|
| 86 |
private String repositoryName; |
82 |
private String repositoryName; |
| 87 |
|
83 |
|
| 88 |
private String repositoryLabel; |
|
|
| 89 |
|
| 90 |
private String repositoryDescription; |
84 |
private String repositoryDescription; |
| 91 |
|
85 |
|
| 92 |
public Composite createUI(Composite parent) { |
86 |
public Composite createUI(Composite parent) { |
|
Lines 96-102
Link Here
|
| 96 |
|
90 |
|
| 97 |
if (provider == null) { |
91 |
if (provider == null) { |
| 98 |
Label label = new Label(composite, SWT.NONE); |
92 |
Label label = new Label(composite, SWT.NONE); |
| 99 |
label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); |
93 |
label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1)); |
| 100 |
label.setText(Messages.AddRepositoryComposite_RepositoryProvider); |
94 |
label.setText(Messages.AddRepositoryComposite_RepositoryProvider); |
| 101 |
|
95 |
|
| 102 |
ComboViewer providersViewer = new ComboViewer(composite, SWT.NONE); |
96 |
ComboViewer providersViewer = new ComboViewer(composite, SWT.NONE); |
|
Lines 130-143
Link Here
|
| 130 |
} |
124 |
} |
| 131 |
|
125 |
|
| 132 |
GridData gd_providerStack = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); |
126 |
GridData gd_providerStack = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); |
| 133 |
gd_providerStack.heightHint = 136; |
|
|
| 134 |
providerStackLayout = new StackLayout(); |
127 |
providerStackLayout = new StackLayout(); |
| 135 |
providerStack = new Composite(composite, SWT.NONE); |
128 |
providerStack = new Composite(composite, SWT.NONE); |
| 136 |
providerStack.setLayout(providerStackLayout); |
129 |
providerStack.setLayout(providerStackLayout); |
| 137 |
providerStack.setLayoutData(gd_providerStack); |
130 |
providerStack.setLayoutData(gd_providerStack); |
| 138 |
{ |
131 |
{ |
| 139 |
Label repositoryNameLabel = new Label(composite, SWT.NONE); |
132 |
Label repositoryNameLabel = new Label(composite, SWT.NONE); |
| 140 |
repositoryNameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); |
133 |
repositoryNameLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1)); |
| 141 |
repositoryNameLabel.setText(Messages.AddRepositoryComposite_RepositoryName); |
134 |
repositoryNameLabel.setText(Messages.AddRepositoryComposite_RepositoryName); |
| 142 |
|
135 |
|
| 143 |
repositoryNameText = new Text(composite, SWT.BORDER); |
136 |
repositoryNameText = new Text(composite, SWT.BORDER); |
|
Lines 145-155
Link Here
|
| 145 |
repositoryNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
138 |
repositoryNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
| 146 |
repositoryNameText.addModifyListener(new ModifyListener() { |
139 |
repositoryNameText.addModifyListener(new ModifyListener() { |
| 147 |
public void modifyText(ModifyEvent e) { |
140 |
public void modifyText(ModifyEvent e) { |
| 148 |
boolean labelUnchanged = ObjectUtil.equals(repositoryName, repositoryLabel); |
|
|
| 149 |
repositoryName = repositoryNameText.getText(); |
141 |
repositoryName = repositoryNameText.getText(); |
| 150 |
if (labelUnchanged) { |
|
|
| 151 |
repositoryLabelText.setText(repositoryName); |
| 152 |
} |
| 153 |
if (listener != null) { |
142 |
if (listener != null) { |
| 154 |
listener.repositoryNameChanged(repositoryName); |
143 |
listener.repositoryNameChanged(repositoryName); |
| 155 |
} |
144 |
} |
|
Lines 157-181
Link Here
|
| 157 |
}); |
146 |
}); |
| 158 |
} |
147 |
} |
| 159 |
{ |
148 |
{ |
| 160 |
Label repositoryLabelLabel = new Label(composite, SWT.NONE); |
|
|
| 161 |
repositoryLabelLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); |
| 162 |
repositoryLabelLabel.setText(Messages.AddRepositoryComposite_RepositoryLabel); |
| 163 |
|
| 164 |
repositoryLabelText = new Text(composite, SWT.BORDER); |
| 165 |
// repositoryLabelText.setText(repositoryLabel); |
| 166 |
repositoryLabelText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
| 167 |
repositoryLabelText.addModifyListener(new ModifyListener() { |
| 168 |
public void modifyText(ModifyEvent e) { |
| 169 |
repositoryLabel = repositoryLabelText.getText(); |
| 170 |
if (listener != null) { |
| 171 |
listener.repositoryLabelChanged(repositoryLabel); |
| 172 |
} |
| 173 |
} |
| 174 |
}); |
| 175 |
} |
| 176 |
{ |
| 177 |
Label repositoryDescriptionLabel = new Label(composite, SWT.NONE); |
149 |
Label repositoryDescriptionLabel = new Label(composite, SWT.NONE); |
| 178 |
repositoryDescriptionLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); |
150 |
repositoryDescriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1)); |
| 179 |
repositoryDescriptionLabel.setText(Messages.AddRepositoryComposite_RepositoryDescription); |
151 |
repositoryDescriptionLabel.setText(Messages.AddRepositoryComposite_RepositoryDescription); |
| 180 |
|
152 |
|
| 181 |
repositoryDescriptionText = new Text(composite, SWT.BORDER); |
153 |
repositoryDescriptionText = new Text(composite, SWT.BORDER); |
|
Lines 214-221
Link Here
|
| 214 |
ECPProperties properties = ECPUtil.createProperties(); |
186 |
ECPProperties properties = ECPUtil.createProperties(); |
| 215 |
|
187 |
|
| 216 |
UIProvider uiProvider = UIProviderRegistry.INSTANCE.getUIProvider(name); |
188 |
UIProvider uiProvider = UIProviderRegistry.INSTANCE.getUIProvider(name); |
|
|
189 |
// since we don't have a dedicated Label-Text but use the Name-Text, we use repositoryNameText twice |
| 217 |
control = uiProvider.createAddRepositoryUI(providerStack, properties, repositoryNameText, |
190 |
control = uiProvider.createAddRepositoryUI(providerStack, properties, repositoryNameText, |
| 218 |
repositoryLabelText, repositoryDescriptionText); |
191 |
repositoryNameText, repositoryDescriptionText); |
| 219 |
providerControls.put(name, control); |
192 |
providerControls.put(name, control); |
| 220 |
providerProperties.put(name, properties); |
193 |
providerProperties.put(name, properties); |
| 221 |
} |
194 |
} |
|
Lines 260-266
Link Here
|
| 260 |
* @return |
233 |
* @return |
| 261 |
*/ |
234 |
*/ |
| 262 |
public String getRepositoryLabel() { |
235 |
public String getRepositoryLabel() { |
| 263 |
return repositoryLabel; |
236 |
// since we don't have a dedicated label-textfield we use the repository name |
|
|
237 |
return repositoryName; |
| 264 |
} |
238 |
} |
| 265 |
|
239 |
|
| 266 |
/** |
240 |
/** |