public void restoreFromSettings()

in source/com.microsoft.tfs.client.common.ui/src/com/microsoft/tfs/client/common/ui/wit/WITSearchModel.java [135:259]


    public void restoreFromSettings(final IDialogSettings settings) {
        searchTerms = settings.get(SEARCH_TERMS_KEY);
        try {
            searchType = settings.getInt(SEARCH_TYPE_KEY);
            if (searchType != SEARCH_TYPE_ALL_TERMS && searchType != SEARCH_TYPE_ANY_TERM) {
                searchType = SEARCH_TYPE_ALL_TERMS;
            }
        } catch (final NumberFormatException ex) {
        }
        if (settings.get(INCLUDE_TITLE_KEY) != null) {
            includeTitle = settings.getBoolean(INCLUDE_TITLE_KEY);
        }
        if (settings.get(INCLUDE_DESCRIPTION_KEY) != null) {
            includeDescription = settings.getBoolean(INCLUDE_DESCRIPTION_KEY);
        }
        if (settings.get(INCLUDE_HISTORY_KEY) != null) {
            includeHistory = settings.getBoolean(INCLUDE_HISTORY_KEY);
        }
        if (settings.get(INCLUDE_CUSTOM_FIELD1_KEY) != null) {
            includeCustomField1 = settings.getBoolean(INCLUDE_CUSTOM_FIELD1_KEY);
        }
        if (settings.get(INCLUDE_CUSTOM_FIELD2_KEY) != null) {
            includeCustomField2 = settings.getBoolean(INCLUDE_CUSTOM_FIELD2_KEY);
        }
        if (settings.get(INCLUDE_CUSTOM_FIELD3_KEY) != null) {
            includeCustomField3 = settings.getBoolean(INCLUDE_CUSTOM_FIELD3_KEY);
        }

        customField1 = settings.get(CUSTOM_FIELD1_KEY);
        if (customField1 != null && !nameToFieldDefinition.containsKey(customField1)) {
            customField1 = null;
        }

        customField2 = settings.get(CUSTOM_FIELD2_KEY);
        if (customField2 != null && !nameToFieldDefinition.containsKey(customField2)) {
            customField2 = null;
        }

        customField3 = settings.get(CUSTOM_FIELD3_KEY);
        if (customField3 != null && !nameToFieldDefinition.containsKey(customField3)) {
            customField3 = null;
        }

        projectName = settings.get(PROJECT_NAME_KEY);
        Project project = null;
        if (projectName != null) {
            project = nameToProject.get(projectName);
            if (project == null) {
                projectName = null;
            }
        }

        workItemTypeName = settings.get(WORK_ITEM_TYPE_NAME_KEY);
        if (workItemTypeName != null) {
            if (project != null) {
                if (project.getWorkItemTypes().get(workItemTypeName) == null) {
                    workItemTypeName = null;
                }
            } else {
                if (!uniqueWorkItemTypeNames.contains(workItemTypeName)) {
                    workItemTypeName = null;
                }
            }
        }

        state = settings.get(STATE_KEY);
        if (state != null && state.trim().length() == 0) {
            state = null;
        }

        assignedTo = settings.get(ASSIGNED_TO_KEY);
        if (assignedTo != null && assignedTo.trim().length() == 0) {
            assignedTo = null;
        }

        areaPath = settings.get(AREA_PATH_KEY);
        if (areaPath != null) {
            if (project != null) {
                if (project.resolvePath(areaPath, Node.TreeType.AREA) == null) {
                    areaPath = null;
                }
            } else {
                areaPath = null;
            }
        }

        iterationPath = settings.get(ITERATION_PATH_KEY);
        if (iterationPath != null) {
            if (project != null) {
                if (project.resolvePath(iterationPath, Node.TreeType.ITERATION) == null) {
                    iterationPath = null;
                }
            } else {
                iterationPath = null;
            }
        }

        if (settings.get(CREATED_DATE_ON_AFTER_KEY) != null) {
            try {
                createdDateOnAfter = new Date(Long.parseLong(settings.get(CREATED_DATE_ON_AFTER_KEY)));
            } catch (final NumberFormatException ex) {
            }
        }

        if (settings.get(CREATED_DATE_ON_BEFORE_KEY) != null) {
            try {
                createdDateOnBefore = new Date(Long.parseLong(settings.get(CREATED_DATE_ON_BEFORE_KEY)));
            } catch (final NumberFormatException ex) {
            }
        }

        if (settings.get(CHANGED_DATE_ON_AFTER_KEY) != null) {
            try {
                changedDateOnAfter = new Date(Long.parseLong(settings.get(CHANGED_DATE_ON_AFTER_KEY)));
            } catch (final NumberFormatException ex) {
            }
        }

        if (settings.get(CHANGED_DATE_ON_BEFORE_KEY) != null) {
            try {
                changedDateOnBefore = new Date(Long.parseLong(settings.get(CHANGED_DATE_ON_BEFORE_KEY)));
            } catch (final NumberFormatException ex) {
            }
        }
    }