Project

General

Profile

« Previous | Next » 

Revision c2e9c57b

Added by Patrick Plitzner almost 5 years ago

ref #8335 Initially select default state + minor refactoring

View differences:

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