private boolean performDoctypeOk() { int index = fDocumentTypeCombo.getSelectionIndex(); if (index > -1) { String id = (String) fDocumentTypeIds.get(index); if (id == null || id.equalsIgnoreCase(SELECT_NONE)) { // if none, use null id = null; } try { HTMLContentProperties.setProperty(HTMLContentProperties.DOCUMENT_TYPE, getResource(), id); } catch (CoreException e) { // maybe in future, let user know there was a problem saving // file Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); return false; } } return true; }
private void initializeDoctypeValues() { int index = 0; String doctype = HTMLContentProperties.getProperty( HTMLContentProperties.DOCUMENT_TYPE, getResource(), false); if (doctype != null) { /* * If item is already part of combo, select it. Otherwise, select * none. */ index = fDocumentTypeIds.indexOf(doctype); } // set combobox index = index >= 0 ? index : 0; fDocumentTypeCombo.select(index); updateDoctypeText(index, doctype); }