Revision c2e9c57b
Added by Patrick Plitzner almost 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java | ||
---|---|---|
32 | 32 |
import org.eclipse.e4.ui.di.UISynchronize; |
33 | 33 |
import org.eclipse.e4.ui.services.EMenuService; |
34 | 34 |
import org.eclipse.jface.layout.GridDataFactory; |
35 |
import org.eclipse.jface.viewers.ComboViewer; |
|
36 | 35 |
import org.eclipse.jface.viewers.IStructuredSelection; |
37 | 36 |
import org.eclipse.jface.viewers.StructuredSelection; |
38 | 37 |
import org.eclipse.nebula.widgets.nattable.NatTable; |
... | ... | |
560 | 559 |
} |
561 | 560 |
} |
562 | 561 |
|
563 |
void selectStateItem(ComboViewer comboStates, String stateName){ |
|
564 |
String[] items = comboStates.getCombo().getItems(); |
|
565 |
for(int i=0;i<items.length;i++){ |
|
566 |
if(items[i].equals(stateName)){ |
|
567 |
comboStates.getCombo().select(i); |
|
568 |
break; |
|
569 |
} |
|
570 |
} |
|
571 |
} |
|
572 |
|
|
573 | 562 |
private void initLabels(int index, Character character) { |
574 | 563 |
indexToCharacterMap.put(index+LEADING_COLUMN_COUNT, character); |
575 | 564 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixToolbar.java | ||
---|---|---|
209 | 209 |
}); |
210 | 210 |
comboStates.setInput(availableStates); |
211 | 211 |
if(comboStates.getCombo().getItemCount()>0){ |
212 |
comboStates.getCombo().select(0);
|
|
212 |
selectStateItem(comboStates, Messages.CharacterMatrix_DEFAULT);
|
|
213 | 213 |
} |
214 | 214 |
|
215 | 215 |
displayPersistenceDialogCommandHandler = new DisplayPersistenceDialogCommandHandler(natTableState, matrix.getNatTable()); |
... | ... | |
218 | 218 |
@Override |
219 | 219 |
public void handleStateChange(StateChangeEvent event) { |
220 | 220 |
comboStates.setInput(PersistenceHelper.getAvailableStates(natTableState)); |
221 |
matrix.selectStateItem(comboStates, event.getViewConfigName());
|
|
221 |
selectStateItem(comboStates, event.getViewConfigName()); |
|
222 | 222 |
} |
223 | 223 |
}); |
224 | 224 |
|
... | ... | |
231 | 231 |
matrix.getNatTable().doCommand(new DisplayPersistenceDialogCommand(matrix.getNatTable())); |
232 | 232 |
Object activeConfig = natTableState.get(PersistenceDialog.ACTIVE_VIEW_CONFIGURATION_KEY); |
233 | 233 |
if(activeConfig!=null){ |
234 |
matrix.selectStateItem(comboStates, activeConfig.toString());
|
|
234 |
selectStateItem(comboStates, activeConfig.toString()); |
|
235 | 235 |
} |
236 | 236 |
} |
237 | 237 |
}); |
... | ... | |
260 | 260 |
|
261 | 261 |
} |
262 | 262 |
|
263 |
private void selectStateItem(ComboViewer comboStates, String stateName){ |
|
264 |
String[] items = comboStates.getCombo().getItems(); |
|
265 |
for(int i=0;i<items.length;i++){ |
|
266 |
if(items[i].equals(stateName)){ |
|
267 |
comboStates.getCombo().select(i); |
|
268 |
break; |
|
269 |
} |
|
270 |
} |
|
271 |
} |
|
272 |
|
|
263 | 273 |
private void initButton(Button button, Image image, String tooltipText, |
264 | 274 |
String label, boolean enabled, boolean selected, Consumer<SelectionEvent> widgetSelected){ |
265 | 275 |
if(image!=null){ |
Also available in: Unified diff
ref #8335 Initially select default state + minor refactoring