/** * if an editor of the same concrete kind exist, then the new one will replace it Ie. only one * Sirius editor, one XtextEditor, etc * * @param editorProject */ protected void addOrUpdateProjectToConf( EditorProject editorProject, LanguageDefinition language) { // add missing data to conf EditorProject existingEditor = null; String searchedClass = editorProject.getClass().getName(); // search first existing editor for (EditorProject possibleExistingEditor : language.getEditorProjects()) { if (possibleExistingEditor.getClass().getName().equals(searchedClass)) { existingEditor = possibleExistingEditor; break; } } if (existingEditor == null) { // simply add the new editor language.getEditorProjects().add(editorProject); } else { // replace the existing editor int index = language.getEditorProjects().indexOf(existingEditor); language.getEditorProjects().set(index, editorProject); } }