private void copyToolsConfigurations(InspectionProfileImpl profile) {
   try {
     for (ToolsImpl toolList : profile.myTools.values()) {
       final ToolsImpl tools = myTools.get(toolList.getShortName());
       final ScopeToolState defaultState = toolList.getDefaultState();
       tools.setDefaultState(
           copyToolSettings((InspectionTool) defaultState.getTool()),
           defaultState.isEnabled(),
           defaultState.getLevel());
       tools.removeAllScopes();
       tools.setEnabled(toolList.isEnabled());
       final List<ScopeToolState> nonDefaultToolStates = toolList.getNonDefaultTools();
       if (nonDefaultToolStates != null) {
         for (ScopeToolState state : nonDefaultToolStates) {
           final InspectionTool inspectionTool =
               copyToolSettings((InspectionTool) state.getTool());
           if (state.getScope() != null) {
             tools.addTool(state.getScope(), inspectionTool, state.isEnabled(), state.getLevel());
           } else {
             tools.addTool(
                 state.getScopeName(), inspectionTool, state.isEnabled(), state.getLevel());
           }
         }
       }
     }
   } catch (WriteExternalException e) {
     LOG.error(e);
   } catch (InvalidDataException e) {
     LOG.error(e);
   }
 }
 private void reduceConvertedScopes() {
   for (ToolsImpl tools : myTools.values()) {
     final ScopeToolState toolState = tools.getDefaultState();
     final List<ScopeToolState> nonDefaultTools = tools.getNonDefaultTools();
     if (nonDefaultTools != null) {
       boolean equal = true;
       boolean isEnabled = toolState.isEnabled();
       for (ScopeToolState state : nonDefaultTools) {
         isEnabled |= state.isEnabled();
         if (!state.equalTo(toolState)) {
           equal = false;
         }
       }
       tools.setEnabled(isEnabled);
       if (equal) {
         tools.removeAllScopes();
       }
     }
   }
 }